fix: Drawflows Lösch-"x" beim Rechtsklick unterdrücken

Rechts dient nur zum Verschieben von Knoten bzw. der Ansicht; das
contextmenu-Event wird in der Capture-Phase gestoppt, bevor Drawflow
den Lösch-Button am selektierten Knoten einblendet.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-02 13:10:23 +02:00
parent 00f7b4f1ce
commit 72508a60bf

View File

@@ -379,7 +379,6 @@ function attach(host) {
// Ansicht verschoben (Panning). // Ansicht verschoben (Panning).
let rightDrag = null; let rightDrag = null;
let rightPan = null; let rightPan = null;
let suppressContextMenu = false;
container.addEventListener('mousedown', e => { container.addEventListener('mousedown', e => {
if (e.button !== 2) return; if (e.button !== 2) return;
e.preventDefault(); e.preventDefault();
@@ -395,7 +394,6 @@ function attach(host) {
} else { } else {
rightPan = { lastX: e.clientX, lastY: e.clientY }; rightPan = { lastX: e.clientX, lastY: e.clientY };
} }
suppressContextMenu = true;
}, true); }, true);
const onRightMove = e => { const onRightMove = e => {
@@ -424,13 +422,13 @@ function attach(host) {
document.addEventListener('mousemove', onRightMove); document.addEventListener('mousemove', onRightMove);
document.addEventListener('mouseup', onRightUp); document.addEventListener('mouseup', onRightUp);
// Browser-Kontextmenü nach Rechts-Ziehen (Knoten oder Canvas) unterdrücken. // Rechts dient nur zum Verschieben: Browser-Kontextmenü unterdrücken und
// das Event in der Capture-Phase stoppen, bevor Drawflows eigener
// contextmenu-Handler das Lösch-"x" am selektierten Knoten einblendet.
container.addEventListener('contextmenu', e => { container.addEventListener('contextmenu', e => {
if (suppressContextMenu) {
e.preventDefault(); e.preventDefault();
suppressContextMenu = false; e.stopPropagation();
} }, true);
});
// Zoomen mit dem Mausrad (ohne Strg). Läuft in der Capture-Phase und stoppt // Zoomen mit dem Mausrad (ohne Strg). Läuft in der Capture-Phase und stoppt
// die Propagation, damit Drawflows eigenes Strg+Rad-Zoom nicht zusätzlich // die Propagation, damit Drawflows eigenes Strg+Rad-Zoom nicht zusätzlich