mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge pull request #3643 from node-red/fix-drag-hidden
Reset mouse state when switching tabs
This commit is contained in:
commit
8093ae8570
@ -230,6 +230,7 @@ RED.view = (function() {
|
||||
.on("mousedown", canvasMouseDown)
|
||||
.on("mouseup", canvasMouseUp)
|
||||
.on("mouseenter", function() {
|
||||
d3.select(document).on('mouseup.red-ui-workspace-tracker', null)
|
||||
if (lasso) {
|
||||
if (d3.event.buttons !== 1) {
|
||||
lasso.remove();
|
||||
@ -245,6 +246,7 @@ RED.view = (function() {
|
||||
}
|
||||
}
|
||||
})
|
||||
.on("mouseleave", canvasMouseLeave)
|
||||
.on("touchend", function() {
|
||||
d3.event.preventDefault();
|
||||
clearTimeout(touchStartTime);
|
||||
@ -385,6 +387,9 @@ RED.view = (function() {
|
||||
drag_lines = [];
|
||||
|
||||
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) {
|
||||
workspaceScrollPositions[event.old] = {
|
||||
left:chart.scrollLeft(),
|
||||
@ -972,7 +977,7 @@ RED.view = (function() {
|
||||
}
|
||||
|
||||
function canvasMouseDown() {
|
||||
if (RED.view.DEBUG) {
|
||||
if (RED.view.DEBUG) {
|
||||
console.warn("canvasMouseDown", { mouse_mode, point: d3.mouse(this), event: d3.event });
|
||||
}
|
||||
if (mouse_mode === RED.state.SELECTING_NODE) {
|
||||
@ -1733,10 +1738,17 @@ RED.view = (function() {
|
||||
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() {
|
||||
lastClickPosition = [d3.event.offsetX/scaleFactor,d3.event.offsetY/scaleFactor];
|
||||
if (RED.view.DEBUG) {
|
||||
if (RED.view.DEBUG) {
|
||||
console.warn("canvasMouseUp", { mouse_mode, point: d3.mouse(this), event: d3.event });
|
||||
}
|
||||
var i;
|
||||
@ -3736,7 +3748,7 @@ RED.view = (function() {
|
||||
function junctionMouseOutProxy(e) { junctionMouseOut(d3.select(this), this.__data__) }
|
||||
|
||||
function linkMouseDown(d) {
|
||||
if (RED.view.DEBUG) {
|
||||
if (RED.view.DEBUG) {
|
||||
console.warn("linkMouseDown", { mouse_mode, point: d3.mouse(this), event: d3.event });
|
||||
}
|
||||
if (mouse_mode === RED.state.SELECTING_NODE) {
|
||||
|
Loading…
Reference in New Issue
Block a user