@chzh.austin wrote:
I am following this http://gojs.net/latest/extensions/LinkLabelDragging.html to enable draggable label. It works great.
I would like to do more -- make label only move along the link line. If the label is moved to a horizontal segment, it can only move horizontally. Similar to vertical segment. While passing the segment points, it should switch from horizontal to vertical or vice versa. Is that something doable?
this.$(go.Panel, "Auto", { name: "LINK_LABEL", cursor: "move" // visual hint that the user can do something with this link label }, new go.Binding("visible", "fromNode", (node) => { return node.data.category === NodeCategories.DECISION }).ofObject(), this.$(go.Shape, "RoundedRectangle", // the link shape { fill: "white", parameter1: 8, // radius stroke: "#444444", strokeWidth: 1, maxSize: new go.Size(80, NaN), minSize: new go.Size(40, 17) }), this.$(go.TextBlock, { font: "normal 9pt \"Segoe UI\", Arial, sans-serif", textAlign: "center", editable: true, maxSize: new go.Size(70, NaN), minSize: new go.Size(30, 17) }, new go.Binding("text", "_text").makeTwoWay() ), new go.Binding("segmentOffset", "segmentOffset", go.Point.parse).makeTwoWay(go.Point.stringify) )Regards,
Chuan
Posts: 4
Participants: 2
