Open IlyaSemenov opened 2 years ago
I have the same problem. @IlyaSemenov do you know a solution for this? Any progress?
Here's my quick workaround:
target.mm = function (e: TouchEvent) {
const isMouseEvent = e instanceof window.MouseEvent
let newScrollX, newScrollY
if (pushed) {
// pushed
if (!binding.modifiers.x && !binding.modifiers.y) { // <-------------
e.preventDefault()
}
and then:
// disable one scroll direction in case x or y is specified
if (binding.modifiers.x) {
newScrollY = -0
if (newScrollX) { // <--------------
e.cancelable && e.preventDefault()
}
}
if (binding.modifiers.y) {
newScrollX = -0
if (newScrollY) { // <--------------
e.cancelable && e.preventDefault()
}
}
I'm not sure if I want to create a PR, the library is not maintained, the code quality is rather poor, there are lots of stray code/weird types. Perhaps it's better to rewrap this under new name.
The use case is, I have a horizontal scrolling div which turns to vertical non-scrollable with mobile viewport media rules.
v-dragscroll
andv-dragscroll.x
completely break (prevent) native vertical page scrolling on mobile. It's not possible to scroll the page by dragging elements inside the dragscroll container.v-dragscroll.pass
andv-dragscroll.pass.x
allow vertical scrolling on mobile but lead to jerky experience on desktop when drag-scrolling the container with mouse (unintentional small vertical mouse drag is 'passed' to the body scroll container and makes the page jiggle)I would expect
v-dragscroll.x
to completely ignore/pass 'as is' all vertical events. Currently, they are either lost (without.pass
) or converted from drag to scroll (with.pass
).