Commit 85ac5828 by 吴斌

update:连线样式修改

parent 1f4339e1
import {GO} from './GOJSKit' import {GO} from './GOJSKit'
import go from 'gojs' import go from 'gojs'
import {log} from "util";
export var linkSelectionAdornmentTemplate = export var linkSelectionAdornmentTemplate =
GO(go.Adornment, "Link", GO(go.Adornment, "Link",
GO(go.Shape, GO(go.Shape,
// isPanelMain declares that this Shape shares the Link.geometry // isPanelMain declares that this Shape shares the Link.geometry
{ isPanelMain: true, fill: null, stroke: "deepskyblue", strokeWidth: 1 }, { isPanelMain: true, fill: null, stroke: "deepskyblue", strokeWidth: 1 },
new go.Binding("stroke").makeTwoWay()
) // use selection object's strokeWidth ) // use selection object's strokeWidth
); );
export function MultiArrowLink() { export function MultiArrowLink() {
go.Link.call(this); go.Link.call(this);
// return GO(go.Link, {stroke:"red"})
} }
go.Diagram.inherit(MultiArrowLink, go.Link); go.Diagram.inherit(MultiArrowLink, go.Link);
MultiArrowLink.prototype.makeGeometry = function() { MultiArrowLink.prototype.makeGeometry = function() {
...@@ -54,4 +55,33 @@ MultiArrowLink.prototype.makeGeometry = function() { ...@@ -54,4 +55,33 @@ MultiArrowLink.prototype.makeGeometry = function() {
fy = ay; fy = ay;
} }
return geo; return geo;
}; };
\ No newline at end of file
export var FlowLink =
GO(go.Link,{
routing: go.Link.AvoidsNodes,
curve: go.Link.JumpGap,
corner: 5,
toShortLength: 4,
relinkableFrom: true,
relinkableTo: true,
reshapable: true,
// resegmentable: true,
},
new go.Binding("points", "points").makeTwoWay(),
GO(go.Shape, { isPanelMain:true, strokeWidth: 5, stroke: 'red'}),
GO(go.Shape, { isPanelMain:true, strokeWidth: 5, stroke: 'green',name:"FLOW", strokeDashArray: [10, 10]}),
GO(go.Shape, { toArrow: "Standard", stroke: null })
);
export function animateFlow(myDiagram:go.Diagram){
// if (myAnimation) myAnimation.stop();
// Animate the flow in the pipes
let myAnimation = new go.Animation();
myAnimation.easing = go.Animation.EaseLinear;
myDiagram.links.each(link => link.findObject("FLOW")?myAnimation.add(link.findObject("FLOW"), "strokeDashOffset", 20, 0): null);
myDiagram.links.each(link => console.log(link))
// Run indefinitely
myAnimation.runCount = Infinity;
myAnimation.start();
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment