Coder Social home page Coder Social logo

gestures.mouse is not a function about d3-drag HOT 4 CLOSED

d3 avatar d3 commented on April 29, 2024
gestures.mouse is not a function

from d3-drag.

Comments (4)

mbostock avatar mbostock commented on April 29, 2024

Possibly related, possibly not, but you shouldn’t have both d3 and D3 modules such as d3-axis listed in your package.json dependencies; either use the d3 default bundle (which includes d3-axis, d3-scale, d3-selection, etc.), or use the D3 modules individually. Depending on your toolchain, mixing D3 modules with the d3 default bundle may cause problems with d3.event being null, which could be what’s happening here.

Unfortunately, I can’t diagnose the issue more specifically that that without a link that demonstrates the issue. When asking for help, please include a link to demonstrate the issue, preferably as an Observable notebook. It is often impossible to debug from code snippets alone. Isolate the issue and reduce your code as much as possible before asking for help. The less code you post, the easier it is for someone to debug, and the more likely you are to get a helpful response.

If you have further questions, please use Stack Overflow tag d3.js to ask for help. Stack Overflow provides a better collaborative forum: thousands of D3-related questions have been asked there, and some answers may be relevant to you.

If you have a question about D3’s behavior and want to discuss it with other users, also consider the d3-js Google Group or joining the d3-js Slack.

Thank you! 🤗

from d3-drag.

samal-rasmussen avatar samal-rasmussen commented on April 29, 2024

Thanks for the response @mbostock!

I've tried removing the other packages and only keeping the d3 package. It made no difference. So at least we know that. Let's see if I can wrangle out a minimal example that reproduces the problem.

from d3-drag.

samal-rasmussen avatar samal-rasmussen commented on April 29, 2024

We found the issue. It's that d3-drag doesn't play well with this library that adds {passive: true} to all event handlers that don't specify otherwise: https://github.com/zzarcon/default-passive-events

So the fix for d3-drag is for it to explicitly add {passive: false} when it sets up event handlers.

from d3-drag.

samal-rasmussen avatar samal-rasmussen commented on April 29, 2024

default-passive-events have described a workaround for the issue here: https://github.com/zzarcon/default-passive-events/blob/master/README.md#is-there-a-possibility-to-bring-default-addeventlistener-method-back-for-chosen-elementsglobally-eg-for-time-of-running-some-of-the-code

from d3-drag.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.