Comments (7)
Hello
There is no implemented function as such.
But you can refer to this example: #20 (comment)
In the future I will add the function.
You could also change the onput / input circles to triangles with css.
from drawflow.
I've created an alternative solution here which adds a separate SVG path for the arrow so it can be styled differently to the main path.
https://github.com/vivianspencer/Drawflow/tree/arrows
from drawflow.
Other solutions for arrows #163 (comment)
Using this same approach, I added a class to the output/input that informs it's connected (@jerosoler something it would be nice to have intrinsically to the library). Then I added the css Jero suggested, only when connected. Looks cleaner...
I used for input only though.
CSS:
.drawflow .drawflow-node .inputConnected {
width: 0;
height: 0;
border-style: solid;
border-width: 12px 0 12px 12px;
border-color: transparent transparent transparent #007bff;
background: transparent;
border-radius: 0px;
}
JS:
editor.on("connectionCreated", function(info) {
// Add arrow shape to input
document.getElementById('node-'+info.input_id).getElementsByClassName(info.input_class)[0].classList.add('inputConnected');
});
editor.on("connectionRemoved", function(info) {
// Remove arrow shape from input
document.getElementById('node-'+info.input_id).getElementsByClassName(info.input_class)[0].classList.remove('inputConnected');
});
PS: I'm also restricting the inputs/outputs to one connection only. If allowing more connections per connection, a protection would be needed when removing the class ( if(editor.getNodeFromId(info.input_id).inputs[info.input_class].connections.length === 0)
).
from drawflow.
Other solutions for arrows #163 (comment)
from drawflow.
I've created an alternative solution here which adds a separate SVG path for the arrow so it can be styled differently to the main path.
The arrow is hidden under the point:
Maybe the point must be littler in arrow mode:
from drawflow.
Easy fix to update the transform on the CSS
Before:
.drawflow .connection .arrow {
transform: translate(-9999px,-9999px);
}
After:
.drawflow .connection .arrow {
transform: translate(-10005px,-9999px);
}
from drawflow.
@ArFe 's solution worked well for me; exactly what I wanted. However it assumes you are building the graph live & processing events. If you're loading a graph (e.g. via .import()), then add this immediately after the import:
var nodes = this.allNodes()
for (var i in nodes) {
// I don't like the 'input_1' magic symbol here - but it always seems to be the same... maybe a cleaner way to do this.
var inpNodes = document.getElementById('node-'+nodes[i]).getElementsByClassName('input_1')
if (inpNodes.length > 0) {
inpNodes[0].classList.add('inputConnected');
}
}
And allNodes() (which would be a nice addition to the editor API):
allNodes() {
var nodes = [];
const editor = this.editor.drawflow.drawflow // Replace this.editor with wherever you have your Drawflow()
Object.keys(editor).map(function(moduleName, index) {
for (var node in editor[moduleName].data) {
nodes.push(editor[moduleName].data[node].id);
}
});
return nodes;
}
from drawflow.
Related Issues (20)
- dynamic value added in input field is not avalible in export HOT 1
- How to disable movement of a Node [QUESTION] HOT 1
- How Can i show cross icon using click instated of right click. In line between two node HOT 4
- How can i make only single input and single output for all node. HOT 7
- drawflow NODES connections HOT 7
- Adding event listener to button inside drawflow node HOT 1
- Suggestion to get exact mouse position
- "view" editor mode disables translate click/drag HOT 2
- Is it possible to create a drawflow connection with a different curvature than the others? HOT 1
- Can we have a before node delete event in angular? HOT 2
- Cannot read properties of undefined (reading 'inputs') HOT 3
- After setting zoom out manually and then zoomrefresh() so the connected lines of each node gets disconnected. HOT 3
- When input type = "password" the node can't be drag from list HOT 4
- [question] How to dynamically add point? HOT 1
- How to lock the full screen nodes and move into the area HOT 1
- Component return click event goes out of the canvas HOT 1
- Mouse gets stuck when leaving parent container HOT 1
- How to do a right click context menu on the connection links HOT 2
- How to place Inputs/Outputs at top & bottom instead of left and right HOT 1
- how can distribute flow in 2 part HOT 4
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 drawflow.