d3 / d3-zoom

Pan and zoom SVG, HTML or Canvas using mouse or touch input.
https://d3js.org/d3-zoom
ISC License
507 stars 143 forks source link

selection.interrupt #167

Closed oufresh closed 5 years ago

oufresh commented 5 years ago

Hello,

I'm using d3-zoom 1.7.3 with d3-selection 1.4.0 and I have this error when these functions are called:

svg.call( zoom.transform, zoomIdentity .translate(vX, vY) .scale(expScale) .translate(dx, dy) );

svg is the selection.

Error: selection.interrupt is not a function

Everything works with d3-selection 1.3.2.

Can you please help me? Is there a better method to invoke the initial transform to the svg?

thank you very much

mbostock commented 5 years ago

This occurs when you have multiple versions of d3-selection installed. Only one of them will be augmented by d3-transition (in this case, it appears 1.3.2). If you have multiple versions of d3-selection, then the other version won’t have transition methods. You should check your yarn.lock/package-lock.json and ensure that you only have one version as a dependency.

zsjun commented 5 years ago

@mbostock thank you. It works!

bmaranville commented 5 years ago

I get this same error when I import d3-zoom in a third-party library, then also import d3-selection in my main app. I'm not sure how to properly import ES module libraries that import 'd3' when I import 'd3' in the main app as well - is it possible?

arjit-webonise commented 3 years ago

although its is closed. I still get this error. I had 2 versions of d3-selectios, where i removed one, but the issue still persists

xiyangjun commented 2 years ago

although its is closed. I still get this error. I had 2 versions of d3-selectios, where i removed one, but the issue still persists

I had the same problem, The two packages I have to depend on use different d3-selection. it's very frustrating.