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

Track mouse release outside workspace so current action completes

manual cherry pick a16032a
This commit is contained in:
Steve-Mcl 2022-06-14 07:39:19 +01:00
parent 83f1729d83
commit 30f08a9f17

View File

@ -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);
@ -1744,7 +1746,14 @@ 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) { if (RED.view.DEBUG) {