glide icon indicating copy to clipboard operation
glide copied to clipboard

Slides occasionally don't bounce back when swipeDistance < threshold

Open rinart73 opened this issue 4 years ago • 2 comments

Plugin version: The last one? I'm testing on the official website. Browsers: Chrome 91.0.4472.77, Firefox 89.0

Occasionally when trying to do a short and quick swipe if swipeDistance < threshold instead of bouncing back to previous position, slide gets 'stuck' in this 'between' area. This happens both with mouse drag and touch. Clicking/touching slider once resolves the issue.

Screenshot: https://i.ibb.co/9W0jCPz/screenshot-glidejs-com-2021-06-29-01-42-01.png

UPD: It seems that when the issue happens there is always an extra swipe.move happening after swipe.end. Perhaps due to throttling?

UPD2: It may not be the best solution but seems to work for me. I edited the Swiper component:

let ignoreSwipeMove = true

bindSwipeMove () {
  ignoreSwipeMove = false
  Binder.on(MOVE_EVENTS, Components.Html.wrapper, throttle((event) => {
    if(!ignoreSwipeMove) {
      this.move(event)
    }
  }, Glide.settings.throttle), capture)
},

unbindSwipeMove () {
  ignoreSwipeMove = true
  Binder.off(MOVE_EVENTS, Components.Html.wrapper, capture)
},

rinart73 avatar Jun 28 '21 23:06 rinart73

Any comments on this? Were you able to reproduce this?

rinart73 avatar Dec 15 '21 09:12 rinart73

Just to confirm the observation: there are certain forms of swipes, that are provoking another Swipe.move with offset, even after the offset was already reset to 0 by Swipe.end.

In my case, instead of swiping „press button → start moving → end moving → release button“,
I did „press button → start moving → release button → end moving” which led to this sort of racing condition.

(GlideJS 3.4.1)

kaipahl avatar Nov 05 '23 11:11 kaipahl