Comments (15)
Same workaround as @ianchanning but for when using createEngine
const engine = createEngine()
engine.maxNumberPointsPerLink = 0
from react-diagrams.
You can delete it after selecting with a shift. And yes, it is not obvious and comfortable )
from react-diagrams.
One way I've found to get this to work as expected is to remove the ability to create points. For my diagram I have no need for points, and so if you set maxNumberPointsPerLink
to zero then when you click on a link it selects it instead of creating a point
<DiagramWidget
className="srd-canvas"
diagramEngine={this.props.engine}
maxNumberPointsPerLink="0" // no extra points so link selection is fired straight away
/>
from react-diagrams.
@gen4sp I feel like that would make the feature very hidden, and i really like how its already so intuitive to just click and drag to add points. I think I'm going to implement the click to select, but click + drag to create point system. I will add a little bit of a threshold so that you have to move the mouse more than 5px or something to trigger it.
from react-diagrams.
maybe we should have a setting where you can click a link, but if you don't drag, then it just selects the link instead of creating a point...
from react-diagrams.
@xaviershay thank you tada , I battled with this for almost two days. Definitely this should be on the documentation. I will be happy to add it if someone can point me out where would be the best place to document this. pray
Only two days ? :) It takes me more. I can add some to documentation but I am not familiar with this repo (and "React way of doing this")
Regards
from react-diagrams.
Worth noting, while this approach work, doesn't necessarily fix the user experience issue that its hard to realize when the link is selected vs when the link its hover, right now both states are the same.
Does anybody know how to detect when a link its select or click it? I haven't found a way to perform this action.
from react-diagrams.
After a day, I discovered that we could select a link by doing Shift + Click on the link, then use delete button to delete the link after that. react-diagrams has a lot of hidden treasure underneath.
from react-diagrams.
It's better to move creation of points to Alt+click or Ctrl+click or something. It would be better, I believe
from react-diagrams.
@xaviershay thank you 🎉 , I battled with this for almost two days. Definitely this should be on the documentation. I will be happy to add it if someone can point me out where would be the best place to document this. 🙏
from react-diagrams.
I'm still finding my way around, but I'm beginning to suspect that some guidance along the lines of createEngine()
is just default settings would be useful, if you look at the definition of that function it customizes a heap of useful stuff. Possibly combined with "you'll probably want to customize the state handlers at some point."
from react-diagrams.
I think that would feel more intuitive.
from react-diagrams.
Has there been any advances or workaround in this feature?
from react-diagrams.
Worth noting, while this approach work, doesn't necessarily fix the user experience issue that its hard to realize when the link is selected vs when the link its hover, right now both states are the same.
Does anybody know how to detect when a link its select or click it? I haven't found a way to perform this action.
Hi @nahumzs, Its been a while since I worked with this library but do you mean differentiate them visually or identify it via code?
If I remember correctly via code the link element has an .isSelected()
method you could call to detect if an element is selected or not.
As for customizing how elements look the best way I found back in the day is to extend your elements(widgets) to encapsulate into a skin/theme and states for that particular diagram. That way your project work with your themed elements. I believe you might have to create a custom link.
These two links can be a good place to start:
from react-diagrams.
@dylanvorster Any updates on this feature? I would like to help if you could point me in right direction
from react-diagrams.
Related Issues (20)
- custom code
- [Bug] Right angled links are diagonal if the points are added after the link is created
- 50 Errors in build HOT 2
- BezierCurve
- Tutorial not working HOT 1
- Deserialization not working HOT 2
- Demos should be refactored to be consistent with modern react standards and styles HOT 2
- I can't see the any nodes. HOT 1
- Is there a way with smart routing to ensure that the link line is never going through the node?
- Deregister Listener when links are created
- DragNewLinkState bug when pressing down with another mouse button while dragging.
- Does storm-react-diagrams support nonce attribute for CSP?
- Node EventListeners don't work when setting a state from component
- can't find createEngine export HOT 1
- Adding NodeModel to NodeLayer set itself as its parent, but NodeModel's parent must be a Diagram
- Module '"@projectstorm/react-diagrams"' has no exported member 'AbstractReactFactory'.
- Intermittent bug in dragNewLink with allowLooseLinks = false HOT 2
- Bug: running `diagrams-demo-project` error `TS2345: Argument of type 'Element' is not assignable to parameter of type 'ReactNode'. Property 'children' is missing in type 'Element' but required in type 'ReactPortal'.`
- Deserialization isn't working properly HOT 1
- got an error in gallary demo: diagrams-demo-gallery 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 react-diagrams.