mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Merge pull request #5027 from node-red/5026-fix-splice-group-add
Handle dragging node into group and splicing link at same time
This commit is contained in:
commit
9694c8bdfa
@ -2170,19 +2170,24 @@ RED.view = (function() {
|
|||||||
n.n.moved = true;
|
n.n.moved = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// If a node has moved and ends up being spliced into a link, keep
|
||||||
// Check to see if we need to splice a link
|
// track of which historyEvent to add the splice info to
|
||||||
|
let targetSpliceEvent = null
|
||||||
if (moveEvent.nodes.length > 0) {
|
if (moveEvent.nodes.length > 0) {
|
||||||
historyEvent.events.push(moveEvent)
|
historyEvent.events.push(moveEvent)
|
||||||
if (activeSpliceLink) {
|
targetSpliceEvent = moveEvent
|
||||||
var linkToSplice = d3.select(activeSpliceLink).data()[0];
|
|
||||||
spliceLink(linkToSplice, movingSet.get(0).n, moveEvent)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (moveAndChangedGroupEvent.nodes.length > 0) {
|
if (moveAndChangedGroupEvent.nodes.length > 0) {
|
||||||
historyEvent.events.push(moveAndChangedGroupEvent)
|
historyEvent.events.push(moveAndChangedGroupEvent)
|
||||||
|
targetSpliceEvent = moveAndChangedGroupEvent
|
||||||
}
|
}
|
||||||
|
// activeSpliceLink will only be set if the movingSet has a single
|
||||||
|
// node that is able to splice.
|
||||||
|
if (targetSpliceEvent && activeSpliceLink) {
|
||||||
|
var linkToSplice = d3.select(activeSpliceLink).data()[0];
|
||||||
|
spliceLink(linkToSplice, movingSet.get(0).n, targetSpliceEvent)
|
||||||
|
}
|
||||||
|
|
||||||
// Only continue if something has moved
|
// Only continue if something has moved
|
||||||
if (historyEvent.events.length > 0) {
|
if (historyEvent.events.length > 0) {
|
||||||
RED.nodes.dirty(true);
|
RED.nodes.dirty(true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user