Open quantuminformation opened 9 years ago
I am wanting to detect any pinch zoom on any supported browser other than the default zoom.
No it is not possible to use the trackpad in this way. Also as mentioned in #843 you cannot reliably detect zoom.
@QuantumInformation to follow up on this though, what google maps does is detect scroll events and prevent their default behavior and use them to zoom. This is why you can't scroll around on a google map. See some of the talk in
https://github.com/hammerjs/hammer.js/issues/658
and
@runspired @QuantumInformation wants to detect pinching not scrolling zoom motions on the trac pad and wants to also be able to detect zoom level. @runspired correct me if i'm wrong but i don't believe either of these are possible.
@arschmitz visit maps.google.com, pinch to zoom :) Notice only the map resizes, nothing else.
Maps also supports 3 finger drag on the map.
I'm pretty sure they do all three of these things by listening to scroll events, preventing the default behavior, then looking at the pointers involved.
This is currently out of scope of hammer, but it is something I'd like to see an OSS lib build to handle.
ah it acts as though ctrl key is pressed for pinching motions thats how they do it tricky...
@runspired what do you mean by 3 finger drag this does not work for me?
@arschmitz On Chrome I can use 3 fingers on the trackpad to move the map around on the screen.
@runspired on Yosemite Chrome for me anything 3 fingers triggers native OS actions
Interesting, I'm on Yosemite too.
Video'd it: https://twitter.com/Runspired/status/631849624928677888
You can start dragging with 3 fingers and drop to 2 or 1 and keep dragging so long as the remaining finger was the first finger put down.
@runspired crazy that does not work at all for me in fact if i start with one finger click to drag and add a second it continues to work but as soon as i put down a third it triggers the native switching screens or bringing up the mini screens thing lol removing the 3rd finger also does not restore dragging.
@runspired weird no matter what i do i cant reproduce that i even turned off all the OSX gestures this allows me to zoom in and out with 3 fingers but not to drag
Do you have to physically click or just tap to click on your keypad? I have to physically click.
physically
@runspired figured it out this is an OSX setting that you need to turn on nothing to do with chrome or google maps https://support.apple.com/en-us/HT204609
:'( I was really hopeful google had come up with a clever trick for doing it. Their scroll tricks are still pretty neat.
yeah ctrl
for detecting pinch scrolling direction is neat i didnt know about it.
But i do know there is no access to the touch point info for doing any type of actual gesture detection on a tracpad sadly.
also just a for reference people HATE the way scroll is hijacked for zoom on google maps https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=google%20maps%20scrolling there are tons of threads about it across the internet and even a browser plugin to disabled it and restore normal scrolling. https://chrome.google.com/webstore/detail/scrollmaps/jifommjndpnefcfplgnbhabocomgdjjg?hl=en . People dislike this feature so much there is a popular mechanics article about it and how to use the plugin to remove it. http://www.popularmechanics.com/technology/apps/reviews/a10753/scrollmaps-is-the-google-maps-fix-you-need-16931788/ In all likely hood its best for user experience to not attempt this sort of thing.
Also worth noting if pinch zooming is disabled at the OS level it also breaks in google maps. As far as i can tell pinch zoom does not work at all in firefox on osx.
Looks like Safari 9.1 brings new events for trackpad on Mac:
iOS gesture events are now supported on Safari for OS X. Use OS X gesture events to detect pinching and rotation on the Magic trackpad. The gestureStart, gestureChange, and gestureEnd events are supported with event.rotation and event.scale properties. For more information on gesture events, see GestureEvent Class Reference.
Also, I found that Mapbox GL supports pinch-to-zoom on Mac too (examples). Their code is opensource: https://github.com/mapbox/mapbox-gl-js ; maybe something to find there ?
Interesting and worth looking into since we are a "gesture library"
worth looking into working with the forceTouch
api's too at some point I think, or at least it will be if Google/Samsung release a competing feature which seems likely.
yeah +1
I know I’m 4 years late to the party, but what is the status on this?
Is it possible to detect pinch zoom on mac trackpad with hammer.js? How can I do this?