Stay in quick-add mode following context menu insert

Fixes #4881
This commit is contained in:
Nick O'Leary 2024-09-16 16:39:41 +01:00
parent 674eb36e15
commit aa74d8160a
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -1209,7 +1209,11 @@ RED.view = (function() {
lasso = null;
}
if (d3.event.touches || d3.event.button === 0) {
if ((mouse_mode === 0 || mouse_mode === RED.state.QUICK_JOINING) && isControlPressed(d3.event) && !(d3.event.altKey || d3.event.shiftKey)) {
if (
(mouse_mode === 0 && isControlPressed(d3.event) && !(d3.event.altKey || d3.event.shiftKey))
||
mouse_mode === RED.state.QUICK_JOINING
) {
// Trigger quick add dialog
d3.event.stopPropagation();
clearSelection();
@ -1285,7 +1289,6 @@ RED.view = (function() {
}
var mainPos = $("#red-ui-main-container").position();
if (mouse_mode !== RED.state.QUICK_JOINING) {
mouse_mode = RED.state.QUICK_JOINING;
$(window).on('keyup',disableQuickJoinEventHandler);
@ -3057,8 +3060,8 @@ RED.view = (function() {
}
function disableQuickJoinEventHandler(evt) {
// Check for ctrl (all browsers), "Meta" (Chrome/FF), keyCode 91 (Safari)
if (evt.keyCode === 17 || evt.key === "Meta" || evt.keyCode === 91) {
// Check for ctrl (all browsers), "Meta" (Chrome/FF), keyCode 91 (Safari), or Escape
if (evt.keyCode === 17 || evt.key === "Meta" || evt.keyCode === 91 || evt.keyCode === 27) {
resetMouseVars();
hideDragLines();
redraw();