daybrush / guides

A Guides component that can draw ruler and manage guidelines.
https://daybrush.com/guides/
MIT License
336 stars 44 forks source link

Feature Request: Allow for scrolling when dragging guides #64

Closed SidIcarus closed 1 year ago

SidIcarus commented 1 year ago

Environments

Description

Users will then be able to implement something like the following, much like the scroll events implemented for selecto and moveable

// horizontal
  scroll (e) {
    const deltaY = e.direction[1] * scrollSpeed
    infiniteViewer.scrollBy(0, deltaY)
  }

  // vertical
  scroll (e) {
    const deltaX = e.direction[0] * scrollSpeed
    infiniteViewer.scrollBy(deltaX, 0)
  }
daybrush commented 1 year ago

@SidIcarus

Okay, I'll add it soon.

daybrush commented 1 year ago

@SidIcarus

https://daybrush.com/guides/release/latest/doc/Guides.html#.GuidesOptions Use scrollOptions

scrollOptions: {
        container: () => viewer.getContainer(),
        getScrollPosition: () => {
            return [
                viewer.getScrollLeft(),
                viewer.getScrollTop(),
            ];
        },
        threshold: 200,
        throttleTime: 30,
        requestScroll: ({ direction }) => viewer.scrollBy(0, direction[1] * 10),
},
SidIcarus commented 1 year ago

@daybrush Curious about your rationale on the decision of making the scroll(requestScroll) event handle as part of the scrollOptions instead of as part of the on events in other places (i.e Selecto & Moveable)

Never mind, I see it is also part of events.