Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cola.drag() throws errors with d3v7 #326

Open
l0drex opened this issue Dec 12, 2021 · 5 comments
Open

cola.drag() throws errors with d3v7 #326

l0drex opened this issue Dec 12, 2021 · 5 comments

Comments

@l0drex
Copy link

l0drex commented Dec 12, 2021

selection.call(cola.drag) throws a bunch of errors when using the latest d3 version, d3v7. When using cola.js (not the min version), the output is as follows:

Uncaught TypeError: position is undefined
    drag layout.js:532
    drag d3v4adaptor.js:31
    call d3.v7.js:1431
    gesture d3.v7.js:2665
    mousemoved d3.v7.js:2588
    contextListener d3.v7.js:2215
    onAdd d3.v7.js:2254
    selection_each d3.v7.js:1889
    selection_on d3.v7.js:2277
    mousedowned d3.v7.js:2572
    contextListener d3.v7.js:2215
    onAdd d3.v7.js:2254
    selection_each d3.v7.js:1889
    selection_on d3.v7.js:2277
    drag d3.v7.js:2558
    selection_call d3.v7.js:1855
    drag d3v4adaptor.js:38
    selection_call d3.v7.js:1855

Since d3v7 seems to use an adaptor to d3v4, I checked if it works using d3v4 directly, and it does work there.

@ViggoV
Copy link

ViggoV commented Oct 3, 2022

Did you find a solution for this?

@l0drex
Copy link
Author

l0drex commented Oct 4, 2022

No, I'm not using the drag function anymore. You could try to write your own adaptor like this one

@ViggoV
Copy link

ViggoV commented Oct 6, 2022

Thanks. I'll look into it :)

@JustyrTsaiLar
Copy link

JustyrTsaiLar commented Dec 16, 2022

v7 same problem .

how to make my own adaotor ? still no drag moving and no error console .
is drag from d3.drag or cola.drag ?
and event name using like start.adptor or start ?

thanks

@ViggoV
Copy link

ViggoV commented Dec 19, 2022

v7 same problem .

how to make my own adaotor ? still no drag moving and no error console . is drag from d3.drag or cola.drag ? and event name using like start.adptor or start ?

thanks

I ended up copying the d3v4 adapter linked above and simplifying it a bit. Turned out I could avoid using the internal imports (at least for my use case) with a few tweaks, and by converting it to JS so the TypeScript time were redundant.

Here is a Gist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants