Discuss Scratch

nembence
Scratcher
1000+ posts

Add a reliable way to detect scrolling speed

The only way to detect scrolling is currently this hat block:
when [arrow v] key pressed
However, it behaves differently with a touchpad and a mouse, because it doesn't mind how much a scroll event scolls, only when the scroll wheel event happens.

A real mouse usually emits a few big scroll events, and depending on the speed it emits more or less events.
A touchpad usually emits lots of small scroll events, because it tries to make smooth scrolling this way - which works in most programs but not in Scratch because it doesn't look at the size of the scrolling.

Projects that were made with a mouse don't work with a touchpad because even the smallest scolling scrolls the project very quickly.
Projects that were made with a touchpad don't work with a mouse, because the scroll wheel moves just a few pixels


I have two ideas on how to solve this:
  • Trigger the hat block only if the scrolling adds up to a specific distance (maybe also if the last scroll event happened more than a few seconds ago, so the scrolling always starts instantly)
  • Add blocks that report the sum of the distance scrolled over the project since Green Flag was clicked (this already exists in a TurboWarp extension)
    (y scrolled::sensing)
    (x scrolled::sensing) // detects horizontal scrolling (eg. Shift + scroll)
    reset scroll counter::sensing

Last edited by nembence (April 23, 2026 19:41:19)

nembence
Scratcher
1000+ posts

Add a reliable way to detect scrolling speed

bump
nembence
Scratcher
1000+ posts

Add a reliable way to detect scrolling speed

bump
nembence
Scratcher
1000+ posts

Add a reliable way to detect scrolling speed

bump
cosmic-giga
Scratcher
40 posts

Add a reliable way to detect scrolling speed

Support! It would help I think
nembence
Scratcher
1000+ posts

Add a reliable way to detect scrolling speed

bump
MagicCoder330
Scratcher
1000+ posts

Add a reliable way to detect scrolling speed

I think that this would be a good idea.

However, it may be difficult for scrolling to work since scrolling will send you down to the comments section unless you have the project zoomed in.

to fix this, if the project was the thing last clicked on, the scrolling should not scroll the whole page, only give scrolling signals to the project. If a project doesn't support scrolling (has no scrolling blocks used) this should be ignored and it should just scroll the page like normal.

Clicking outside of the project box should set scrolling back to normal.
I_wantasheep
Scratcher
1000+ posts

Add a reliable way to detect scrolling speed

i know this might be useful for detecting swipes (i think) but why do you want to check if they swiped to the comment section

semi-support for now
nembence
Scratcher
1000+ posts

Add a reliable way to detect scrolling speed

I wrote:

Trigger the hat block only if the scrolling adds up to a specific distance (maybe also if the last scroll event happened more than a few seconds ago, so the scrolling always starts instantly)
I tried this out on a touchpad since then, and it doesn't feel good so only the new block idea is left

MagicCoder330 wrote:

I think that this would be a good idea.

However, it may be difficult for scrolling to work since scrolling will send you down to the comments section unless you have the project zoomed in.

to fix this, if the project was the thing last clicked on, the scrolling should not scroll the whole page, only give scrolling signals to the project. If a project doesn't support scrolling (has no scrolling blocks used) this should be ignored and it should just scroll the page like normal.

Clicking outside of the project box should set scrolling back to normal.
Or it could depend on where the mouse is pointing, like with the descriptions
MagicCoder330
Scratcher
1000+ posts

Add a reliable way to detect scrolling speed

nembence wrote:

I wrote:

Trigger the hat block only if the scrolling adds up to a specific distance (maybe also if the last scroll event happened more than a few seconds ago, so the scrolling always starts instantly)
I tried this out on a touchpad since then, and it doesn't feel good so only the new block idea is left

MagicCoder330 wrote:

I think that this would be a good idea.

However, it may be difficult for scrolling to work since scrolling will send you down to the comments section unless you have the project zoomed in.

to fix this, if the project was the thing last clicked on, the scrolling should not scroll the whole page, only give scrolling signals to the project. If a project doesn't support scrolling (has no scrolling blocks used) this should be ignored and it should just scroll the page like normal.

Clicking outside of the project box should set scrolling back to normal.
Or it could depend on where the mouse is pointing, like with the descriptions
Since the project is likely to be what is intereacted with most, someone playing without zooming it in may let their mouse drift off the project by accident. Both ways could work though
AndPherbCodes
Scratcher
1000+ posts

Add a reliable way to detect scrolling speed

This is a good suggestion, and I hope it gets more attention.
MagicCoder330
Scratcher
1000+ posts

Add a reliable way to detect scrolling speed

bumping
nembence
Scratcher
1000+ posts

Add a reliable way to detect scrolling speed

bump

Powered by DjangoBB