New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: customizable drag and select triggers #1767
Comments
Got here looking for the same feature |
+1 Middle mouse to pan the canvas would be super useful for us. |
Thanks for this feature request. We could add a property for configuring the mouse button to drag the pane quite easily as d3-zoom already supports this. Open questions:
|
Hi @chrtze, thanks for the response. For our use case we actually would want to use both the left mouse and the middle mouse to pan under slightly different circumstances.
This seems to be a fairly common behaviour on canvas style apps, I think? So for us, I suppose maybe the flag would be a boolean like |
How about exposing a function via a hook. Any advanced scenario can then be
implemented by the user.
For example, by using use-gesture https://use-gesture.netlify.app/
Edit:
The above was a bit of a low-effort quick reply via mail. Some details:
Prioritizing drag-to-select or drag-to-pan depends a bit on the use case. Some implementations are really about exploring, in which case drag-to-pan on lmb is preferable. Others are more focused on editing (multiple) nodes. In that case drag-to-select on lmb is preferable.
I would suggest having sensible defaults (the current defaults are fine), which can be disabled or overridden by a prop.
One way to do this is a disable prop and adding the select and pan functions to the ReactFlow instance interface, e.g. by adding selectStart(x,y), selectMove(x,y) and selectEnd(x,y) functions. These can then be called by use-gesture callbacks. Same for panStart(x,y), panMove(x,y) and panEnd(x,y).
Implementors can use use-gesture to implement all sorts of things, such as fallback for touch interfaces, drag on space-lmb-drag etc.
|
I'd like to prioritize box selection over dragging the canvas, but allow both of them. To do that, I'd like to be able to appoint left mouse button drag to box selection (which is now shift-lmb-drag) and middle mouse button drag to canvas move (which is now lmb-drag).
I can imagine this being a configurable option though
The text was updated successfully, but these errors were encountered: