Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 6966

LinkDrawn event

$
0
0

@Mickey wrote:

I don't know is this bug but I want to check with you. If you look at next code you will see my workaround to get what I need.

BPMN.diagram.addDiagramListener("LinkDrawn", function (e) {
if (e.subject.fromNode.category === "annotation") {
e.subject.category = "annotation"; // annotation association
} else if (e.subject.fromNode.category === "dataobject" || e.subject.toNode.category === "dataobject") {
e.subject.category = "data"; // data association
} else if (e.subject.fromNode.category === "datastore" || e.subject.toNode.category === "datastore") {
e.subject.category = "data"; // data association
}
e.subject.data.points = e.subject.points;
BPMN.modelUpdater.createObject(e.subject.data);
});

Because in this moment link.points has initialized but those values are not reflected in data.points property yet (two way binding occurs later) I must manually store this value to link.data instead of two way binding do that. Two way binding does it but obviously later because when I check clicking on link after it is created I see that in console.

BPMN.diagram.addDiagramListener("ObjectSingleClicked", function (e) {
console.log(e.subject.part.data);
//console.log(e.subject.part.actualBounds.toString());
document.getElementById("infoDraggable").style.visibility = "hidden";
if (e.subject.part instanceof go.Link) {
let link = e.subject.part;
console.log(link.data);
//console.log(link.findObject('label').segmentOffset.toString(), link.findObject('label').segmentIndex);
//console.log(e.diagram.model.toJson());
}
});

Did I found bug or I don't understand something?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6966

Trending Articles