mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
parent
03e9e89558
commit
7ec1d42808
@ -955,8 +955,9 @@ RED.view = (function() {
|
||||
}
|
||||
|
||||
function canvasMouseDown() {
|
||||
if (RED.view.DEBUG) { console.warn("canvasMouseDown", mouse_mode); }
|
||||
var point;
|
||||
if (RED.view.DEBUG) {
|
||||
console.warn("canvasMouseDown", { mouse_mode, point: d3.mouse(this), event: d3.event });
|
||||
}
|
||||
if (mouse_mode === RED.state.SELECTING_NODE) {
|
||||
d3.event.stopPropagation();
|
||||
return;
|
||||
@ -973,26 +974,27 @@ RED.view = (function() {
|
||||
selectedLinks.clear();
|
||||
updateSelection();
|
||||
}
|
||||
if (mouse_mode === 0) {
|
||||
if (lasso) {
|
||||
if (mouse_mode === 0 && lasso) {
|
||||
lasso.remove();
|
||||
lasso = null;
|
||||
}
|
||||
}
|
||||
if ((mouse_mode === 0 || mouse_mode === RED.state.QUICK_JOINING) && (d3.event.touches || d3.event.button === 0) && (d3.event.metaKey || d3.event.ctrlKey)) {
|
||||
if (d3.event.touches || d3.event.button === 0) {
|
||||
if ((mouse_mode === 0 || mouse_mode === RED.state.QUICK_JOINING) && (d3.event.metaKey || d3.event.ctrlKey) && !(d3.event.altKey || d3.event.shiftKey)) {
|
||||
// Trigger quick add dialog
|
||||
d3.event.stopPropagation();
|
||||
clearSelection();
|
||||
point = d3.mouse(this);
|
||||
const point = d3.mouse(this);
|
||||
var clickedGroup = getGroupAt(point[0], point[1]);
|
||||
if (drag_lines.length > 0) {
|
||||
clickedGroup = clickedGroup || RED.nodes.group(drag_lines[0].node.g)
|
||||
}
|
||||
showQuickAddDialog({ position: point, group: clickedGroup });
|
||||
} else if (mouse_mode === 0 && (d3.event.touches || d3.event.button === 0) && !(d3.event.metaKey || d3.event.ctrlKey)) {
|
||||
// Tigger lasso
|
||||
} else if (mouse_mode === 0 && !(d3.event.metaKey || d3.event.ctrlKey)) {
|
||||
// CTRL not being held
|
||||
if (!d3.event.altKey) {
|
||||
// ALT not held (shift is allowed) Trigger lasso
|
||||
if (!touchStartTime) {
|
||||
point = d3.mouse(this);
|
||||
const point = d3.mouse(this);
|
||||
lasso = eventLayer.append("rect")
|
||||
.attr("ox", point[0])
|
||||
.attr("oy", point[1])
|
||||
@ -1005,15 +1007,18 @@ RED.view = (function() {
|
||||
.attr("class", "nr-ui-view-lasso");
|
||||
d3.event.preventDefault();
|
||||
}
|
||||
} else if (mouse_mode === 0 && d3.event.button === 2 && (d3.event.metaKey || d3.event.ctrlKey || d3.event.shiftKey)) {
|
||||
} else if (d3.event.altKey) {
|
||||
//Alt [+shift] held - Begin slicing
|
||||
clearSelection();
|
||||
mouse_mode = (d3.event.metaKey || d3.event.ctrlKey)?RED.state.SLICING : RED.state.SLICING_JUNCTION;
|
||||
point = d3.mouse(this);
|
||||
mouse_mode = (d3.event.shiftKey) ? RED.state.SLICING_JUNCTION : RED.state.SLICING;
|
||||
const point = d3.mouse(this);
|
||||
slicePath = eventLayer.append("path").attr("class", "nr-ui-view-slice").attr("d", `M${point[0]} ${point[1]}`)
|
||||
slicePathLast = point;
|
||||
RED.view.redraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showQuickAddDialog(options) {
|
||||
options = options || {};
|
||||
@ -1714,7 +1719,9 @@ RED.view = (function() {
|
||||
|
||||
function canvasMouseUp() {
|
||||
lastClickPosition = [d3.event.offsetX/scaleFactor,d3.event.offsetY/scaleFactor];
|
||||
if (RED.view.DEBUG) { console.warn("canvasMouseUp", mouse_mode); }
|
||||
if (RED.view.DEBUG) {
|
||||
console.warn("canvasMouseUp", { mouse_mode, point: d3.mouse(this), event: d3.event });
|
||||
}
|
||||
var i;
|
||||
var historyEvent;
|
||||
if (mouse_mode === RED.state.PANNING) {
|
||||
@ -3712,6 +3719,9 @@ RED.view = (function() {
|
||||
function junctionMouseOutProxy(e) { junctionMouseOut(d3.select(this), this.__data__) }
|
||||
|
||||
function linkMouseDown(d) {
|
||||
if (RED.view.DEBUG) {
|
||||
console.warn("linkMouseDown", { mouse_mode, point: d3.mouse(this), event: d3.event });
|
||||
}
|
||||
if (mouse_mode === RED.state.SELECTING_NODE) {
|
||||
d3.event.stopPropagation();
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user