Smooth scrolling

Trevor DeVore lists at mangomultimedia.com
Fri Feb 5 00:04:02 EST 2021


On Tue, Feb 2, 2021 at 4:25 PM Richard Gaskin via use-livecode <
use-livecode at lists.runrev.com> wrote:

> JeeJeeStudio wrote:
>
>  > Panos wrote:
>  >> This bug report contains a workaround for smooth scrolling - hope it
>  >> helps.
>  >> https://quality.livecode.com/show_bug.cgi?id=19759
>  >
>  >
>  > Maybe it's me but i don't see any difference in scrolling between the
>  > left and right on win10
>
> The original description of the problem here lacks specificity. It's not
> just any scrolling that is affected, but scrolling that happens in
> response to a scroll wheel or trackpad gestures.
>
> The script Panos posted in the bug report has two gradations of scroll
> increment, based on the interval between keydown messages corresponding
> to the scroll wheel/trackpad gesture.
>

I came across this thread and thought I would add an additional comment.
The scrolling can be improved further by using the scroll event values
provided by the operating system.

On macOS it is simple enough to get the true scroll values from the scroll
event using NSEvent.scrollingDeltaX and NSEvent.scrollingDeltaY. It is
possible to get those values using LCB as demonstrated in the
mac_scroll_wheel.lcb extension that is included with the DataView control
I've made available. Here is a link to the source code:

https://github.com/trevordevore/levurehelper-dataview/blob/develop/mac_scroll_wheel.lcb

Anyone who is interested and running macOS can download the compiled
version of the extension and test it out in the sample stack.

1) Visit the following link and click the "Download" button

https://github.com/trevordevore/levurehelper-dataview/blob/develop/mac_scroll_wheel.lcm

2) Then run this in the Message Box and select the .lcm file to load it:

answer file "Select Extension";load extension from file it;put the result

3) Add this script to any field you want to test with:

on rawKeyDown pKey

  if pKey = "65308" or pKey = "65309" then
    set the vscroll of me to the vscroll of me - item 2 of
macCurrentEventScrollValues(the effective linesize of me)
  else
    pass rawKeyDown
  end if

end rawKeyDown

On my computer I see the best results in the test stack from the bug report
using this method. Ideally any engine improvements would tap into the
scroll wheel values provided by the OS.

-- 
Trevor DeVore
ScreenSteps



More information about the use-livecode mailing list