impetus icon indicating copy to clipboard operation
impetus copied to clipboard

Remove scrollbars from swiping surface

Open pyrsmk opened this issue 8 years ago • 4 comments

I don't know if it's intended, but I ran into a problem with my Horizon library. I'm listening to several events and Impetus is triggering swipe event even when the mouse is over the scrollbar. I currently fixed this by automatically measuring the scrollbar width and then listening to mousedown/mouseup to know if we're manually scrolling or not.

pyrsmk avatar Apr 12 '16 14:04 pyrsmk

I think this problem comes not from impetus itself. As I can see, you just attached it to the entire document, try to use another source.

yckart avatar Apr 12 '16 20:04 yckart

That's the case for Horizon 3 but not for the upcoming Horizon 4. In the next release we'll be able to set any scene we want. So, if we have scrollbars on this scene, for any reason, the problem would be the same, isn't it?

pyrsmk avatar Apr 13 '16 06:04 pyrsmk

That sounds like a really specific edgecase and is maybe better to handle it in your own library... However, I'm not the maintainer, let's wait what @chrisbateman says.

Btw. there's no need to measure the scrollbar sizes, instead you could just compare the scrollable container with the current clicked target (requires that the scollarea completely fills its parent):

scrollable.addEventListener('mousedown', function(e) {
  var isScrollbar = this === e.target
})

yckart avatar Apr 14 '16 04:04 yckart

We can't know in advance if the specified scene has scrollbars. Moreover, I just need to disable swiping when the mouse is over a scrollbar, and not a scrollable content. Because my library can listen to scroll events and swipe events at the same time (and many more). So I've got incompatibilities between scroll and swipe because both events are triggered and it shouldn't be the case.

But yeah, let's wait for @chrisbateman 's point of view. For the time, I'll put a fix in my library ^^

pyrsmk avatar Apr 14 '16 09:04 pyrsmk