mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
parent
428fbb8622
commit
aef8aaa0bd
@ -23,6 +23,9 @@ RED.history = (function() {
|
|||||||
undo_history[i].dirty = true;
|
undo_history[i].dirty = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
list: function() {
|
||||||
|
return undo_history
|
||||||
|
},
|
||||||
depth: function() {
|
depth: function() {
|
||||||
return undo_history.length;
|
return undo_history.length;
|
||||||
},
|
},
|
||||||
@ -284,6 +287,9 @@ RED.history = (function() {
|
|||||||
RED.workspaces.refresh();
|
RED.workspaces.refresh();
|
||||||
RED.sidebar.config.refresh();
|
RED.sidebar.config.refresh();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
peek: function() {
|
||||||
|
return undo_history[undo_history.length-1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,7 +400,7 @@ RED.view = (function() {
|
|||||||
|
|
||||||
var spliceLink = $(ui.helper).data('splice');
|
var spliceLink = $(ui.helper).data('splice');
|
||||||
if (spliceLink) {
|
if (spliceLink) {
|
||||||
// TODO: DRY - canvasMouseUp
|
// TODO: DRY - droppable/nodeMouseDown/canvasMouseUp
|
||||||
RED.nodes.removeLink(spliceLink);
|
RED.nodes.removeLink(spliceLink);
|
||||||
var link1 = {
|
var link1 = {
|
||||||
source:spliceLink.source,
|
source:spliceLink.source,
|
||||||
@ -647,7 +647,7 @@ RED.view = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mouse_mode == RED.state.MOVING_ACTIVE && moving_set.length === 1) {
|
if ((mouse_mode == RED.state.MOVING_ACTIVE || mouse_mode == RED.state.IMPORT_DRAGGING) && moving_set.length === 1) {
|
||||||
node = moving_set[0];
|
node = moving_set[0];
|
||||||
if (spliceActive) {
|
if (spliceActive) {
|
||||||
if (!spliceTimer) {
|
if (!spliceTimer) {
|
||||||
@ -770,7 +770,7 @@ RED.view = (function() {
|
|||||||
}
|
}
|
||||||
historyEvent = {t:'move',nodes:ns,dirty:RED.nodes.dirty()};
|
historyEvent = {t:'move',nodes:ns,dirty:RED.nodes.dirty()};
|
||||||
if (activeSpliceLink) {
|
if (activeSpliceLink) {
|
||||||
// TODO: DRY - droppable
|
// TODO: DRY - droppable/nodeMouseDown/canvasMouseUp
|
||||||
var spliceLink = d3.select(activeSpliceLink).data()[0];
|
var spliceLink = d3.select(activeSpliceLink).data()[0];
|
||||||
RED.nodes.removeLink(spliceLink);
|
RED.nodes.removeLink(spliceLink);
|
||||||
var link1 = {
|
var link1 = {
|
||||||
@ -1185,6 +1185,29 @@ RED.view = (function() {
|
|||||||
//RED.touch.radialMenu.show(d3.select(this),pos);
|
//RED.touch.radialMenu.show(d3.select(this),pos);
|
||||||
if (mouse_mode == RED.state.IMPORT_DRAGGING) {
|
if (mouse_mode == RED.state.IMPORT_DRAGGING) {
|
||||||
RED.keyboard.remove(/* ESCAPE */ 27);
|
RED.keyboard.remove(/* ESCAPE */ 27);
|
||||||
|
|
||||||
|
if (activeSpliceLink) {
|
||||||
|
// TODO: DRY - droppable/nodeMouseDown/canvasMouseUp
|
||||||
|
var spliceLink = d3.select(activeSpliceLink).data()[0];
|
||||||
|
RED.nodes.removeLink(spliceLink);
|
||||||
|
var link1 = {
|
||||||
|
source:spliceLink.source,
|
||||||
|
sourcePort:spliceLink.sourcePort,
|
||||||
|
target: moving_set[0].n
|
||||||
|
};
|
||||||
|
var link2 = {
|
||||||
|
source:moving_set[0].n,
|
||||||
|
sourcePort:0,
|
||||||
|
target: spliceLink.target
|
||||||
|
};
|
||||||
|
RED.nodes.addLink(link1);
|
||||||
|
RED.nodes.addLink(link2);
|
||||||
|
var historyEvent = RED.history.peek();
|
||||||
|
historyEvent.links = [link1,link2];
|
||||||
|
historyEvent.removedLinks = [spliceLink];
|
||||||
|
updateActiveNodes();
|
||||||
|
}
|
||||||
|
|
||||||
updateSelection();
|
updateSelection();
|
||||||
RED.nodes.dirty(true);
|
RED.nodes.dirty(true);
|
||||||
redraw();
|
redraw();
|
||||||
@ -1993,6 +2016,12 @@ RED.view = (function() {
|
|||||||
}
|
}
|
||||||
if (!touchImport) {
|
if (!touchImport) {
|
||||||
mouse_mode = RED.state.IMPORT_DRAGGING;
|
mouse_mode = RED.state.IMPORT_DRAGGING;
|
||||||
|
spliceActive = false;
|
||||||
|
if (new_ms.length === 1) {
|
||||||
|
node = new_ms[0];
|
||||||
|
spliceActive = node.n._def.inputs > 0 &&
|
||||||
|
node.n._def.outputs > 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RED.keyboard.add(/* ESCAPE */ 27,function(){
|
RED.keyboard.add(/* ESCAPE */ 27,function(){
|
||||||
|
Loading…
Reference in New Issue
Block a user