Smoother scrolling w/ deceleration for LC fields
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 4002
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Smoother scrolling w/ deceleration for LC fields
A while ago there was a discussion on the use-list to get smoother scrolling and decelerating scrolling for LC fields.
https://quality.livecode.com/show_bug.cgi?id=19759
and a an old discussion on the use-list
http://lists.runrev.com/pipermail/use-l ... 96772.html
My script is based on above proposal by John Miskimins but with added deceleration.
Here is my take on this.
Feedback welcome, especially on slower computers.
Kind regards
Bernd
https://quality.livecode.com/show_bug.cgi?id=19759
and a an old discussion on the use-list
http://lists.runrev.com/pipermail/use-l ... 96772.html
My script is based on above proposal by John Miskimins but with added deceleration.
Here is my take on this.
Feedback welcome, especially on slower computers.
Kind regards
Bernd
- Attachments
-
- smoothScrolling_0_2.livecode.zip
- (5.03 KiB) Downloaded 87 times
Re: Smoother scrolling w/ deceleration for LC fields
Hi Bernd,
i tested your stack on my mac (intel i7 mbp, macOS 12.3.1 Monterey, LC 10.0 DP3) but there were problems with etc 'smooth scrolling' window; it's a lot slower and laggier that the normal scroll. By slower i don't just mean scroll speed but how much of the window is scrolled for the same movement on the trackpad is much less and on a 'free scroll' it travels much less and with variable scrolling speed...
The version i have doesn't seem useable i'm afraid...
i tested your stack on my mac (intel i7 mbp, macOS 12.3.1 Monterey, LC 10.0 DP3) but there were problems with etc 'smooth scrolling' window; it's a lot slower and laggier that the normal scroll. By slower i don't just mean scroll speed but how much of the window is scrolled for the same movement on the trackpad is much less and on a 'free scroll' it travels much less and with variable scrolling speed...
The version i have doesn't seem useable i'm afraid...
-
- VIP Livecode Opensource Backer
- Posts: 4002
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Smoother scrolling w/ deceleration for LC fields
Hi Stam,
thanks for the feedback. On my M1 MacBookPro it scrolls quite nicely. That is why I was very interested in feedback.
Could you try to change some parameters? kCutOff to 150 and kDiv to 15 and tell me if that is better?
Kind regards
Bernd
thanks for the feedback. On my M1 MacBookPro it scrolls quite nicely. That is why I was very interested in feedback.
Could you try to change some parameters? kCutOff to 150 and kDiv to 15 and tell me if that is better?
Code: Select all
constant kCutOff = 150 -- milliseconds between rawKeyDown, below decelerating scrolling kicks in
constant kDiv = 15 -- used to adapt stepsize to scrolling speed
Bernd
Re: Smoother scrolling w/ deceleration for LC fields
No sadly these changes don't improve performance, possibly it's worse.
I'll try and do a screen recording this evening or tomorrow, don't have time right now...
regards
Stam
I'll try and do a screen recording this evening or tomorrow, don't have time right now...
regards
Stam
-
- Posts: 720
- Joined: Thu Sep 11, 2014 1:49 pm
- Location: The Netherlands
Re: Smoother scrolling w/ deceleration for LC fields
On Windows Laptop it works nice.
Slow scrolling is with small steps and fast scrolling is with large steps.
FYI: I do have a very fast laptop.
Regards,
Paul
Slow scrolling is with small steps and fast scrolling is with large steps.
FYI: I do have a very fast laptop.
Regards,
Paul
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Smoother scrolling w/ deceleration for LC fields
You can never be too careful:
-
-
-
- VIP Livecode Opensource Backer
- Posts: 9665
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Smoother scrolling w/ deceleration for LC fields
Bernd.
iMac 27 4GHz Quad I7 on Catalina.
Took me a moment to look at the handlers to see that one should not use the scrollbar to do the scrolling, but rather the scrollwheel on the mouse.
I see a certain difference between the two fields, but not so much that I would rush to use the "smooth" one.
But why not play around with something like this?
The fun thing here would be to change the "5" (an arbitrary value) to a larger one if the scroll wheel was moved more quickly.
Craig
iMac 27 4GHz Quad I7 on Catalina.
Took me a moment to look at the handlers to see that one should not use the scrollbar to do the scrolling, but rather the scrollwheel on the mouse.
I see a certain difference between the two fields, but not so much that I would rush to use the "smooth" one.
But why not play around with something like this?
Code: Select all
on rawKeyDown tkey
if tKey = 65308 then set the scroll of me to the scroll of me + 5 else set the scroll of me to the scroll of me - 5
end rawKeyDown
Craig
-
- VIP Livecode Opensource Backer
- Posts: 9665
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Smoother scrolling w/ deceleration for LC fields
I tried a few things, none of which seem to work. The idea is to detect the rate of scroll wheel movement, fast or slow. There does not seem to be a "scrollWheelRate" message.
The number in fld "ss" (about 25) does not change much regardless of the scrollwheel speed. I was hoping that I could exploit a difference there to change the arbitrary "5", hard-coded in the handler, so that a faster wheel rate would scroll more quickly.
Still playing....
Craig
Code: Select all
on rawKeyDown tkey
get the milliseconds
if tKey = 65308 then set the scroll of me to the scroll of me + 5 else set the scroll of me to the scroll of me - 5
put the milliseconds - it into fld "ss"
end rawKeyDown
Still playing....
Craig
-
- VIP Livecode Opensource Backer
- Posts: 4002
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Smoother scrolling w/ deceleration for LC fields
Craig,
Apparently the code does work differently on different processors (on slower ones less well). It seems to work well for @Paul.
The whole point of the exercise was to add deceleration to mouse-wheel scrolling like native fields scroll.
The main difference would be that towards the end of a scroll the amount of scrolling goes down. You should see the effect also when using the mouse-wheel/touchpad to scroll slowly.
The field with non-smooth scrolling uses a fixed amount of pixels when scrolling, for me it is about 97 pixels up or down. There is no code interfering with what Livecode thinks it should scroll.
I guess we will have to wait until Livecode somehow hooks into the operating system and adapts scrolling accordingly.
Kind regards
Bernd
Apparently the code does work differently on different processors (on slower ones less well). It seems to work well for @Paul.
The whole point of the exercise was to add deceleration to mouse-wheel scrolling like native fields scroll.
The main difference would be that towards the end of a scroll the amount of scrolling goes down. You should see the effect also when using the mouse-wheel/touchpad to scroll slowly.
The field with non-smooth scrolling uses a fixed amount of pixels when scrolling, for me it is about 97 pixels up or down. There is no code interfering with what Livecode thinks it should scroll.
I guess we will have to wait until Livecode somehow hooks into the operating system and adapts scrolling accordingly.
Kind regards
Bernd
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Smoother scrolling w/ deceleration for LC fields
Am I missing something?
-
-
-
- VIP Livecode Opensource Backer
- Posts: 4002
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Smoother scrolling w/ deceleration for LC fields
Not very much except for the operating system and platforms.
Kind regards
Bernd
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Smoother scrolling w/ deceleration for LC fields
Well, obviously those matter.Not very much except for the operating system and platforms.