1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Reset mouse state when switching tabs

Fixes #3639
This commit is contained in:
Nick O'Leary 2022-06-09 15:47:16 -05:00
parent 62cd3b2061
commit deb9c4ecc0
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -385,6 +385,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(),
@ -955,7 +958,7 @@ RED.view = (function() {
} }
function canvasMouseDown() { function canvasMouseDown() {
if (RED.view.DEBUG) { if (RED.view.DEBUG) {
console.warn("canvasMouseDown", { mouse_mode, point: d3.mouse(this), event: d3.event }); console.warn("canvasMouseDown", { mouse_mode, point: d3.mouse(this), event: d3.event });
} }
if (mouse_mode === RED.state.SELECTING_NODE) { if (mouse_mode === RED.state.SELECTING_NODE) {
@ -1719,7 +1722,7 @@ RED.view = (function() {
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) { if (RED.view.DEBUG) {
console.warn("canvasMouseUp", { mouse_mode, point: d3.mouse(this), event: d3.event }); console.warn("canvasMouseUp", { mouse_mode, point: d3.mouse(this), event: d3.event });
} }
var i; var i;
@ -3719,7 +3722,7 @@ RED.view = (function() {
function junctionMouseOutProxy(e) { junctionMouseOut(d3.select(this), this.__data__) } function junctionMouseOutProxy(e) { junctionMouseOut(d3.select(this), this.__data__) }
function linkMouseDown(d) { function linkMouseDown(d) {
if (RED.view.DEBUG) { if (RED.view.DEBUG) {
console.warn("linkMouseDown", { mouse_mode, point: d3.mouse(this), event: d3.event }); 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) {