moveable
moveable copied to clipboard
Scrollable: Continuous Scrolling
Environments
- Framework name: ngx-moveable
- Framework version: 0.26.8
- Moveable Component version: 0.26.8
- Testable Address(optional):
Description
Is there a way to implement scroll so that the scroll event can continuously fire. Exposing a scrollStart/scrollEnd event I could create a while loop. Currently the scroll event only fires during drag.
@jtr-dev
See this example: https://daybrush.com/moveable/storybook2/?path=/story/support-scroll--tree-shaking-template
Currently it only triggers on drag move.
Pseudo Example:
class MyComponent {
moveable: any;
timer: number | null;
onMouseMove() {
if (this.timer) {
clearInterval(this.timer);
this.timer = null;
}
}
onScroll(event) {
const { scrollContainer, direction } = event;
scrollContainer.scrollBy(direction[0], direction[1]);
if (this.timer === null) {
if (this.moveable.isDragging()) {
this.timer = window.setInterval(() => {
console.log('contine to scroll');
this.onScroll(event); // old event state
}, 200)
}
}
}
}
Initally tried creating a timer myself with the proper events. However there seems to be code to allow for it to scroll while the mouse is not moving.
@scena/dragscroll timer has similar timer logic to what I was doing.
I ran into issues last week trying to put a sandbox demo together but I can work on this a bit more if further explanation would help.
Much appreciated, Thanks.