From 3e980e950a8a9cbf165117c29bbe4ef256fbea02 Mon Sep 17 00:00:00 2001 From: Hans Dijkema Date: Sat, 5 Sep 2026 12:06:04 +0200 Subject: [PATCH] consistent Alt-key behavior --- static/js/cmap/controller/cmap-interaction-controller.js | 8 ++++++-- static/js/wiki/cmap/cmap-concept-controller.js | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/static/js/cmap/controller/cmap-interaction-controller.js b/static/js/cmap/controller/cmap-interaction-controller.js index 29b29d8..93f29a7 100644 --- a/static/js/cmap/controller/cmap-interaction-controller.js +++ b/static/js/cmap/controller/cmap-interaction-controller.js @@ -488,12 +488,16 @@ export class CmapInteractionController { if (!target) { this.editor.ensureCanvasExtent(point.x, point.y); const parentSubmap = this.editor.submapAtPoint(point); + const direct = event.altKey || upEvent.altKey; debug("relation dropped on empty canvas", { sourceId: source.id, point, - parentSubmapId: parentSubmap ? parentSubmap.id : null + parentSubmapId: parentSubmap ? parentSubmap.id : null, + direct }); - if (this.editor.onCreateConnectedItem) this.editor.onCreateConnectedItem({ source, point, parentSubmap }); + if (this.editor.onCreateConnectedItem) { + this.editor.onCreateConnectedItem({ source, point, parentSubmap, direct }); + } return; } if (target === source) return; diff --git a/static/js/wiki/cmap/cmap-concept-controller.js b/static/js/wiki/cmap/cmap-concept-controller.js index 07c6f5f..c6f63ae 100644 --- a/static/js/wiki/cmap/cmap-concept-controller.js +++ b/static/js/wiki/cmap/cmap-concept-controller.js @@ -99,8 +99,9 @@ export class CmapConceptController { changes.submapDepth = createContext.parentSubmap.submapDepth + 1; } const newRecord = this.addNode(changes); - if (createContext.source && newRecord) editor.finishRelation(createContext.source, newRecord); - else if (newRecord) editor.selectItem(newRecord); + if (createContext.source && newRecord) { + editor.finishRelation(createContext.source, newRecord, Boolean(createContext.direct)); + } else if (newRecord) editor.selectItem(newRecord); } editor.commitHistory(); if (this.getCurrentStorageMap()) await this.save({ automatic: true });