Do you get the behavior that you want if you manually select those links in addition to the node(s) that you want to move?
If so, you could implement such behavior by overriding DraggingTool.computeEffectiveCollection to include partly connected Links that connect with selected Nodes.
I don’t know if there are any examples of exactly this case, but I do know that there are several examples of overriding that method for different purposes.
Hi Walter, you are right.
I overrode DraggingTool.computeEffectiveCollection to include the disconnected links of the nodes selected.
The code is
export function onDraggingParts(modelEditor: ModelEditorDiagramComponent, draggingTool: DraggingTool, parts) {
let nodes: Node[] = [];
let links: Link[] = [];
var it = parts.iterator;
while (it.next()) {
var part = it.value;
if (part instanceof Node) {
nodes.push(part);
}
if (part instanceof Link) {
links.push(part);
}
}
let iterator;
let link: Link;
let linksToAdd: Link[] = [];
for (let i = 0; i < nodes.length; i++) {
iterator = nodes[i].findLinksConnected();
while (iterator.next()) {
link = iterator.value;
// Only considers disconnected links that is not in the selection
if ((!link.fromNode || !link.toNode) &&
!isLinkInParts(parts, link, modelEditor.configuratorService.getLinkKeyProperty())) {
linksToAdd.push(link);
}
}
}
var map = DraggingTool.prototype.computeEffectiveCollection.call(draggingTool, parts);
for (let i = 0; i < linksToAdd.length; i++) {
map.add(linksToAdd[i], { point: new Point() });
}
return map;
}
function isLinkInParts(parts, link: Link, idProperty): boolean {
var it = parts.iterator;
while (it.next()) {
var part = it.value;
if (part instanceof Link && part.data[idProperty] === link.data[idProperty]) {
return true;
}
}
return false;
}