tech-systems / panes

🎉📱 Create dynamic modals, cards, panes for your applications in few steps. One instance – Thousands solutions. Any framework and free.
https://panejs.com
MIT License
681 stars 40 forks source link

[FEAT] Preventing vertical drag when swiping horizontally #147

Closed CodeWithOz closed 3 years ago

CodeWithOz commented 3 years ago

What are you trying to add to Cupertino-Pane? Detection for horizontal swipe, so that swiping from sideways does not trigger slight up/down drag.

Describe your feature request detailed Sorry this is not a feature, more like a question. What is the correct way to make sure that horizontal swipes do not register as vertical swipes? If I move my finger from left to right within the sheet, sometimes the top of the sheet moves slightly, as if I'm dragging up/down. Is there a way to prevent that? I tried using touchAngle: 90 and touchAngle: 180, it didn't make a difference. Is there a config setting for this, or is it something you can add? I think a simple 45deg detection will be sufficient. So the drag is only activated if I swipe more vertically than horizontally.

Is there an alternative at the latest version?

[ ] Yes (descripe the alternative) [x] No

Is this related to an issue?

[ ] Yes (Give a link to the issue) [x] No

roman-rr commented 3 years ago

Hey @CodeWithOz Thank you for help. Actually touchAngle was created for this reason. Please try this example https://output.jsbin.com/xohipog Here touchAngle: 45. In other words: If between first and second touchmove point has angle less than 45 Deg - drag gesture disabled. Somethings ideas how to make it better ?

CodeWithOz commented 3 years ago

@roman-rr actually using touchAngle: 45 worked perfectly for me, thanks again! I think you should consider updating the docs for touchAngle with an explanation like the one you gave here, so that it will be easier to understand how the property should be used.