rexrainbow / phaser3-rex-notes

Notes of phaser3 engine
MIT License
1.21k stars 260 forks source link

Scrollable Panel: Detect when scroll starts or ends #262

Closed felixlaguna closed 2 years ago

felixlaguna commented 2 years ago

Hello! I have been looking at the docs and have not found a way to detect when the scroll starts or ends. The only event described in the docs is 'scroll', and when I attach to any of the BaseSizer events (like the onClick method), the scroll doesn't seem to work.

Maybe there is a way I am not seeing, or a workaround that could be in the docs.

rexrainbow commented 2 years ago

How to define scroll start?

felixlaguna commented 2 years ago

I could work with either of them actually. My real problem is scroll end, but help on the scroll start would be really welcome.

rexrainbow commented 2 years ago

Scroll end would be pointer-up from scrollable panel. Is it correct? Scrollable panel will continue scrolling for a while after pointer-up.

rexrainbow commented 2 years ago

Update:

Add 'dragstart', 'dragend' events to scroller.

scrollablePanel.getElement('scroller')
    .on('dragstart', function () {
        console.log('scroller.dragstart')
    })
    .on('dragend', function () {
        console.log('scroller.dragend')
    })