Trying to implement smooth scrolling

Posted on
  • Recently got a Bangle.js 2, and one minor thing that annoys me is that there's no smooth scrolling, so I wanted to implement it. I did some poking around and found the implementation for E.showScroller. However I can't find any way to tell when a touch ends. Could someone point me to how to do that, or describe why that's not possible?

  • What do you mean by smooth scrolling? In what situations/apps?

    If you have updated the firmware and apps to current versions on the app loader I think you should have smooth scrolling e.g. in the settings menu, which uses E.showScroller, for scrolling, I think via E.showMenu.

  • You know how on phones scrolling has easing and keeps going at your velocity once you stop, and also has a bounce back if you scroll too high? I was trying to implement that.

  • Ah, ok!

    So I guess you already found the code for E.showScroller. On line #23 and onward the function for handling drag events is coded.

    You can read about the drag event in the hardware reference.

    So using e.b in the drag function in setUI you can see if the screen is touched or not. With that and e.dy I think you should be able to initiate the smooth scrolling behavior you describe when the finger is lifted from the screen.

    This tutorial is useful, and here is an example where I modified E.showScroller to work in discrete steps.

  • So using e.b in the drag function in setUI you can see if the screen is touched or not.

    Yes, this is it - best bet is just to add a print statement to the drag handler so you can see how the values vary as you drag and then release

  • Did you implement this, @KTibow?

    I'd be interested to try it out if you have it running 🙂

  • nope, if you do that i would be interested too

  • I probably won't 🙃 If I did I think I would end up using 'Swipe Menus' again anyway. But it would have been interesting to try it out.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Trying to implement smooth scrolling

Posted by Avatar for KTibow @KTibow

Actions