infinite-viewer icon indicating copy to clipboard operation
infinite-viewer copied to clipboard

Is there a way to use the dragging instead of scrolling to move around board/document.

Open xNarkon opened this issue 2 years ago • 15 comments

Hi!

I looked inside and saw that you are using another of your libraries for this component called Gesto. You only react to the "touch" event, skip "mouse". And this causes a problem, I cannot do something like the Miro move tool. Sometimes, this movement is much more convenient than using a scroll.

I would like to enable document navigation by dragging the mouse on the board / document.

Would you consider introducing such an option? Otherwise, I will probably have to do my version via fork :( and I believe many people could use it!

xNarkon avatar May 04 '22 11:05 xNarkon

same here, I would like to have a way to pan the canvas without using the scrollbars (as @xNarkon said in mobile you can pan using 2 fingers gesture). @daybrush any idea on how to get this ?

ulissepress avatar Jul 03 '22 19:07 ulissepress

would be great

AustinHatem avatar Jul 17 '22 21:07 AustinHatem

In FIGMA, for example, you can pan clicking the mouse wheel and then moving the mouse...

ulissepress avatar Jul 21 '22 21:07 ulissepress

@ulissepress @AustinHatem @xNarkon

I'll add this feature soon. Thank you :)

daybrush avatar Jul 25 '22 18:07 daybrush

@ulissepress @AustinHatem @xNarkon

InfiniteViewer's new version is released. Update and Use useMouseDrag prop. (true / false)

daybrush avatar Jul 26 '22 15:07 daybrush

@daybrush great! I tested the new property (useMouseDrag) and is working fine (you can pan the infinite viewer canvas with the mouse)... BUT there is a bug / side effect: when I'm dragging an in item in my diagram (via Moveable), the infinite viewer canvas is moving as well...

ulissepress avatar Jul 27 '22 13:07 ulissepress

image

To be clear, for example when I drag the block 'CCC' the infinite viewer canvas is moving as well... This, instead, is not happening if I resize / rotate the element.

ulissepress avatar Jul 27 '22 14:07 ulissepress

@ulissepress

I'll add stopPropagation function to moveable.

daybrush avatar Jul 28 '22 14:07 daybrush

I added the stopPropagation property to <Moveable> and set it to TRUE... but the issue is still there (when dragging an item, the infinite viewer is moving as well).

I anyway solved the issue using the SHIFT key to enable the infinite viewer useMouseDrag:

const shiftPressed = useKeyModifier('Shift')     // From @VueUse/core
...
 <VueInfiniteViewer 
            :useMouseDrag   = "shiftPressed"
            :useWheelScroll = "true"
            ... />

<Moveable 
           :stopPropagation = "true"
            ... />

Here you can see a live demo: https://ec7o9v.sse.codesandbox.io/

ulissepress avatar Jul 29 '22 10:07 ulissepress

@ulissepress

  • lit-moveable 0.11.2
  • moveable 0.34.2
  • preact-moveable 0.36.2
  • react-compat-moveable 0.22.2
  • react-moveable 0.37.2
  • svelte-moveable 0.26.2
  • vue-moveable 2.0.0-beta.30
  • vue3-moveable 0.9.2
  • ngx-moveable 0.31.2

moveable's new version is released.

Use stopPropagation prop.

daybrush avatar Aug 01 '22 18:08 daybrush

Hi @daybrush I dit the updates and this solved the issue.

One small suggestion: in fact clicking and dragging the infinite viewer is ok unless.... you want to use the Selecto package. In this case clicking and dragging in the canvas area is used to select items.

My suggestion is to use a key modifier to enable the click-canvas to pan, like shift or better ctrl key, like is already to activate infinite viewer zoom using mouse wheel together with ctrl key (useWheelScroll = "true").

<VueInfiniteViewer 
            :useMouseDrag = "true"
            mouseDragKeyModifier ="ctrl".  // default, can be also 'shift' or 'alt'
            ... />

ulissepress avatar Aug 02 '22 14:08 ulissepress

@ulissepress

sorry. As much as possible, I try not to control the key internally. It is recommended to control through a hook and reactive state using a key controller as shown below.

https://codesandbox.io/s/laughing-danny-p8xd4s

daybrush avatar Aug 06 '22 04:08 daybrush

此 Can you turn off the sliding acceleration? useMouseDrag

d2461379109 avatar Oct 20 '22 03:10 d2461379109

@daybrush

d2461379109 avatar Oct 20 '22 03:10 d2461379109

@d2461379109

okay. i"ll add it soon.

daybrush avatar Oct 22 '22 05:10 daybrush