Fix copy/paste of node into active group

Fixes #2686
This commit is contained in:
Nick O'Leary 2020-09-03 13:12:08 +01:00
parent 3b9065b057
commit d9900d8e4c
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
1 changed files with 22 additions and 3 deletions

View File

@ -1678,7 +1678,7 @@ RED.view = (function() {
}
}
if (ns.length > 0) {
if (ns.length > 0 && mouse_mode == RED.state.MOVING_ACTIVE) {
historyEvent = {t:"move",nodes:ns,dirty:RED.nodes.dirty()};
if (activeSpliceLink) {
// TODO: DRY - droppable/nodeMouseDown/canvasMouseUp
@ -2354,6 +2354,10 @@ RED.view = (function() {
mousedown_port_type = null;
activeSpliceLink = null;
spliceActive = false;
if (activeHoverGroup) {
activeHoverGroup.hovered = false;
activeHoverGroup = null;
}
d3.select(".red-ui-flow-link-splice").classed("red-ui-flow-link-splice",false);
if (spliceTimer) {
clearTimeout(spliceTimer);
@ -2869,7 +2873,7 @@ RED.view = (function() {
//RED.touch.radialMenu.show(d3.select(this),pos);
if (mouse_mode == RED.state.IMPORT_DRAGGING) {
RED.keyboard.remove("escape");
var historyEvent = RED.history.peek();
if (activeSpliceLink) {
// TODO: DRY - droppable/nodeMouseDown/canvasMouseUp
var spliceLink = d3.select(activeSpliceLink).data()[0];
@ -2886,12 +2890,27 @@ RED.view = (function() {
};
RED.nodes.addLink(link1);
RED.nodes.addLink(link2);
var historyEvent = RED.history.peek();
historyEvent.links = [link1,link2];
historyEvent.removedLinks = [spliceLink];
updateActiveNodes();
}
if (activeHoverGroup) {
for (var j=0;j<movingSet.length();j++) {
var n = movingSet.get(j);
RED.group.addToGroup(activeHoverGroup,n.n);
}
historyEvent.addedToGroup = activeHoverGroup;
activeHoverGroup.hovered = false;
enterActiveGroup(activeHoverGroup)
// TODO: check back whether this should add to moving_set
activeGroup.selected = true;
activeHoverGroup = null;
}
updateSelection();
RED.nodes.dirty(true);
redraw();