{"action":"opened","issue":{"url":"https://api.github.com/repos/d3/d3-zoom/issues/31","repository_url":"https://api.github.com/repos/d3/d3-zoom","labels_url":"https://api.github.com/repos/d3/d3-zoom/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/d3/d3-zoom/issues/31/comments","events_url":"https://api.github.com/repos/d3/d3-zoom/issues/31/events","html_url":"https://github.com/d3/d3-zoom/issues/31","id":158558749,"number":31,"title":"emulate double click with double touch/tap events and link their handlers","user":{"login":"virgile-hogman","id":16869068,"avatar_url":"https://avatars.githubusercontent.com/u/16869068?v=3","gravatar_id":"","url":"https://api.github.com/users/virgile-hogman","html_url":"https://github.com/virgile-hogman","followers_url":"https://api.github.com/users/virgile-hogman/followers","following_url":"https://api.github.com/users/virgile-hogman/following{/other_user}","gists_url":"https://api.github.com/users/virgile-hogman/gists{/gist_id}","starred_url":"https://api.github.com/users/virgile-hogman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/virgile-hogman/subscriptions","organizations_url":"https://api.github.com/users/virgile-hogman/orgs","repos_url":"https://api.github.com/users/virgile-hogman/repos","events_url":"https://api.github.com/users/virgile-hogman/events{/privacy}","received_events_url":"https://api.github.com/users/virgile-hogman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-06-05T15:09:20Z","updated_at":"2016-06-05T15:09:20Z","closed_at":null,"body":"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.\r\n```\r\n mysvg.selectAll(\"image.bg\")\r\n    .call(zoom)\r\n    .on(\"dblclick.zoom\", autoRescale)\r\n```\r\nGood so far!\r\n\r\nHowever 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\")` 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.\r\n\r\nI 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?\r\n\r\nI 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?\r\n\r\nAlso i'm a bit lost with the documentation, between these 2 pages:\r\n- Zoom main API ref: https://github.com/d3/d3/wiki/Zoom-Behavior\r\n- Zoom package: https://github.com/d3/d3-zoom\r\n\r\nWhat is the good API reference? For instance the events are called `zoomstart, zoom, zoomend` on the main page but `start, zoom, end` on 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 on 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.\r\n\r\nMany thanks for this awesome library!"}}
{"actor":{"display_login":"virgile-hogman"}}