Comments (16)
Hey,
we just released v.4.0.0. There we dropped isInteractive
and added nodesDraggable
, nodesConnectable
and elementsSelectable
. This use case should be working with nodesDraggable
= false
and nodesConnectable
and elementsSelectable
= true. You can see a working example here: https://react-flow.netlify.app/interaction. Can you confirm @bartvanremortele ?
from xyflow.
Hey,
I disabled the pointer events for inactive graphs in order to be able to zoom and pan even if the pointer is above a node.
Maybe we could introduce another option like ‘disablePointerEventsWhenInactive’ or something like that.
What do you think about that?
from xyflow.
Hey,
Yes, I did some further digging and now understand why it's implemented in the way it is. The zoom layer has a lower z-index
than the nodes and the pointer-events: none
makes it possible to trigger the handlers on the zoom layer because the node's events are disabled.
As far as I understood by reading this issue on d3-zoom, the UX I want is probably not a good idea.
That being said, I believe react-flow should still give a user the choice of enabling/disabling pointer-events in a straightforward manner. I'm not a fan of disablePointerEventsWhenInactive
, I would inverse this by adding an option to disable the dragging. enableDragging
which defaults to true seems like a better option in my opinion.
That being said, I have decided to take a different path for now and re-introducing the pointer-events: all
inside of the node and improving the UX around the zooming/panning by highlighting the hovered node and changing to cursor to give a clearer indication as to which actions are accessible on his current cursor position.
from xyflow.
perhaps we can figure out a better solution using d3-zoom's filter
from xyflow.
Maybe enablePointerEvents
would be a good option. And yes I would like to drop d3-zoom and d3-selection. But maybe you are right and we can figure out a better way how to use it for now
from xyflow.
@moklick I did some searching to improve the zooming / panning behaviour in conjunction with click handlers on nodes and came across https://github.com/prc5/react-zoom-pan-pinch#readme this implementation. I believe this might be a good contender to replace d3-zoom.
Your thoughts?
from xyflow.
I will have a look, thanks!
from xyflow.
Another feature that is related to this is an option to allow drag & drop the elements (nodes), but prevent creating new edges.
As far as I understand this is not possible atm.
@moklick is there an option for this out-of-the-box?
from xyflow.
hey @dekelb
sorry I can't follow you. What do you want to achieve?
from xyflow.
thanks for the super fast reply @moklick !
I want to be able to move the nodes (drag and drop), but in my case - the creation of new edges (create new connection between nodes) should be disabled.
Maybe I missed something in the docs, but from what I understand there is no simple way to do this.
from xyflow.
@dekelb can you open a new issue for this? thanks!
from xyflow.
@moklick just opened #291 - let me know what you think.
from xyflow.
If you use nodesDraggable={false}
then the onElementClick
is not working anymore.
from xyflow.
Good catch @emielwit! The bug should be fixed with version 4.2.2
from xyflow.
hey @bartvanremortele I will close this issue for now. Feel free to open a new one for discussing the switch from d3-zoom to another zoom/pan library.
from xyflow.
Hi, I met issue similar to @emiel-betty but for onNodeDoubleClick event. I opened a bug #2525
from xyflow.
Related Issues (20)
- Svelte Flow: change background color with class name for Background component HOT 1
- Default node type with black border HOT 1
- Inconsistent Edge Routing with Reactflow + Elkjs
- Support multiple edges/paths between a pair of nodes HOT 2
- Copy-Paste keeps the copied edges selected after pasting HOT 2
- How to achieve the example shown in react flow home page for edge intersection HOT 4
- Documentation on <ReactFlow>'s isValidConnection callback is incorrect HOT 1
- NodeResizer - SvelteFlow HOT 4
- selectHandle
- Example to have multiple edges on the same node with auto spacing between edges. HOT 1
- Zoom on pinch not working on Windows HOT 15
- The connection arrow jumps off the node on connect HOT 3
- ✨ React Flow 12 beta is here
- Dnd kit problem with component dragging and positioning HOT 3
- d3-hierarchy useAutoLayout HOT 1
- React Flow v12: addNodes/addEdges doesn't work HOT 2
- screenToFlowPosition and snapToGrid snaps mouse position when publishing Mouse Presence in multiplayer HOT 2
- <Control/> doesn't propogate aria-label HOT 5
- Create Svelte RFC for component prop warnings HOT 1
- @xyflow/system: refactor public stuff HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xyflow.