Hi, i'm trying to define a zoom behavior mostly for panning, where a double click on the background would unzoom and return at scale 1 instead of zooming (i use zoom scales on other objects than the background). This works very fine with the desktop version through .on("dblclick.zoom")
handler.
mysvg.selectAll("image.bg")
.call(zoom)
.on("dblclick.zoom", autoRescale)
Good so far!
However i have an issue i can't solve on mobile with the touch events. I would like to emulate the same doubleclick behavior when the user makes a double tap.
If i add a handler .on("touchstart.zoom", myhandler)
i manage to emulate the double tap correctly (through my own timer). But then i lose all the gestures handled by d3 such as standard panning and pinch zoom and i'd definitely want to keep those.
I went a bit in the code and noticed the touchstart()
inner function calls dblclicked()
inner function regardless of my own handler that will be ignored. Maybe there could be a solution here?
I haven't found any workaround. I tried the dirty way reading the internal touchstart.zoom
callback function and calling it again but it has side effects. I also tried capturing the dispatch events such as zoomstart
but i couldn't solve this. Any suggestion?
Also i'm a bit lost with the documentation, between these 2 pages:
What is the good API reference? For instance the events are called zoomstart, zoom, zoomend
in the main page but start, zoom, end
in the zoom package (without prefix). The filter
function described in the package does not seem to be available on the zoom behavior but maybe i missed something here. The documentation in the zoom package is more detailed but the API reference matches the version i'm using (d3.min 3.5.16). A bit confused where to go here.
Many thanks for this awesome library!