mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge pull request #3664 from Steve-Mcl/backport-3643
Reset mouse state when switching tabs (Backport #3643 to v2.x)
This commit is contained in:
commit
74e3b9e9ed
@ -224,6 +224,7 @@ RED.view = (function() {
|
|||||||
.on("mousedown", canvasMouseDown)
|
.on("mousedown", canvasMouseDown)
|
||||||
.on("mouseup", canvasMouseUp)
|
.on("mouseup", canvasMouseUp)
|
||||||
.on("mouseenter", function() {
|
.on("mouseenter", function() {
|
||||||
|
d3.select(document).on('mouseup.red-ui-workspace-tracker', null)
|
||||||
if (lasso) {
|
if (lasso) {
|
||||||
if (d3.event.buttons !== 1) {
|
if (d3.event.buttons !== 1) {
|
||||||
lasso.remove();
|
lasso.remove();
|
||||||
@ -239,6 +240,7 @@ RED.view = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.on("mouseleave", canvasMouseLeave)
|
||||||
.on("touchend", function() {
|
.on("touchend", function() {
|
||||||
d3.event.preventDefault();
|
d3.event.preventDefault();
|
||||||
clearTimeout(touchStartTime);
|
clearTimeout(touchStartTime);
|
||||||
@ -378,6 +380,9 @@ RED.view = (function() {
|
|||||||
drag_lines = [];
|
drag_lines = [];
|
||||||
|
|
||||||
RED.events.on("workspace:change",function(event) {
|
RED.events.on("workspace:change",function(event) {
|
||||||
|
// Just in case the mouse left the workspace whilst doing an action,
|
||||||
|
// put us back into default mode so the refresh works
|
||||||
|
mouse_mode = 0
|
||||||
if (event.old !== 0) {
|
if (event.old !== 0) {
|
||||||
workspaceScrollPositions[event.old] = {
|
workspaceScrollPositions[event.old] = {
|
||||||
left:chart.scrollLeft(),
|
left:chart.scrollLeft(),
|
||||||
@ -1741,10 +1746,19 @@ RED.view = (function() {
|
|||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function canvasMouseLeave() {
|
||||||
|
if (mouse_mode !== 0 && d3.event.buttons !== 0) {
|
||||||
|
d3.select(document).on('mouseup.red-ui-workspace-tracker', function() {
|
||||||
|
d3.select(document).on('mouseup.red-ui-workspace-tracker', null)
|
||||||
|
canvasMouseUp.call(this)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
function canvasMouseUp() {
|
function canvasMouseUp() {
|
||||||
lastClickPosition = [d3.event.offsetX/scaleFactor,d3.event.offsetY/scaleFactor];
|
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 i;
|
||||||
var historyEvent;
|
var historyEvent;
|
||||||
if (mouse_mode === RED.state.PANNING) {
|
if (mouse_mode === RED.state.PANNING) {
|
||||||
@ -3588,6 +3602,9 @@ RED.view = (function() {
|
|||||||
function portMouseOutProxy(e) { portMouseOut(d3.select(this), this.__data__,this.__portType__,this.__portIndex__, e); }
|
function portMouseOutProxy(e) { portMouseOut(d3.select(this), this.__data__,this.__portType__,this.__portIndex__, e); }
|
||||||
|
|
||||||
function linkMouseDown(d) {
|
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) {
|
if (mouse_mode === RED.state.SELECTING_NODE) {
|
||||||
d3.event.stopPropagation();
|
d3.event.stopPropagation();
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user