An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:sparkles: Support middle-button dragging in mind maps https://github.com/siyuan-note/siyuan/issues/20786
Danieldda173ab4727
diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.syindex 4fe7b6f98e..3fe9158617 100644--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy@@ -2065,7 +2065,7 @@"Children": [{"Type": "NodeText",- "Data": "Without activating the canvas, hold Ctrl (Command on macOS) while using the mouse wheel to zoom around the pointer, or hold the same key and drag with the right mouse button to pan temporarily. Temporary panning preserves keyboard focus and node selection. On a touch screen, use two fingers to zoom and pan. These gestures preserve the current reading or active state. A saved view lock still disables editing, zooming, and panning; activate the canvas after unlocking when needed."+ "Data": "Without activating the canvas, hold Ctrl (Command on macOS) while using the mouse wheel to zoom around the pointer, or hold the same key and drag with the right mouse button to pan temporarily. You can also hold the middle mouse button and drag to pan temporarily without switching to the hand tool; release it to stop. Temporary panning preserves keyboard focus and node selection. On a touch screen, use two fingers to zoom and pan. These gestures preserve the current reading or active state. A saved view lock still disables editing, zooming, and panning; activate the canvas after unlocking when needed."}]},diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100950-9op5xi1.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100950-9op5xi1.syindex da2a776f6f..4a0b3fd7ab 100644--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100950-9op5xi1.sy+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100950-9op5xi1.sy@@ -13148,7 +13148,7 @@"Children": [{"Type": "NodeText",- "Data": "Hold Ctrl (Command on macOS) and drag the canvas with the right mouse button to pan temporarily without changing keyboard focus or activating a reading canvas. Ordinary wheel input then continues scrolling the document. This gesture is unavailable while the view is locked. Ordinary left dragging on blank canvas selects nodes with a box. For left-button panning, enable "+ "Data": "You can also hold the middle mouse button and drag to pan temporarily without switching to the hand tool; release it to stop. Hold Ctrl (Command on macOS) and drag the canvas with the right mouse button to pan temporarily without changing keyboard focus or activating a reading canvas. Ordinary wheel input then continues scrolling the document. This gesture is unavailable while the view is locked. Ordinary left dragging on blank canvas selects nodes with a box. For left-button panning, enable "},{"Type": "NodeTextMark",diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.syindex f5d5c09f96..25bc023337 100644--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy@@ -2068,7 +2068,7 @@"Children": [{"Type": "NodeText",- "Data": "无需进入画布操作,也可以按住 Ctrl(macOS 为 Command)滚动鼠标滚轮,以指针为中心缩放,或按住同一按键并用鼠标右键拖动画布进行临时平移。临时平移保留键盘焦点和节点选中状态。触屏上可用双指缩放、平移。这些手势保持当前的阅读或画布操作状态。已保存的视图锁定仍禁止编辑、缩放和平移,解锁后可按需进入画布操作。"+ "Data": "无需进入画布操作,也可以按住 Ctrl(macOS 为 Command)滚动鼠标滚轮,以指针为中心缩放,或按住同一按键并用鼠标右键拖动画布进行临时平移。也可直接按住鼠标中键拖动进行临时平移,松开即结束,无需切换手型工具。临时平移保留键盘焦点和节点选中状态。触屏上可用双指缩放、平移。这些手势保持当前的阅读或画布操作状态。已保存的视图锁定仍禁止编辑、缩放和平移,解锁后可按需进入画布操作。"}]},diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200813004551-gm0pbn1.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200813004551-gm0pbn1.syindex 91137e23fb..f7fc86395c 100644--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200813004551-gm0pbn1.sy+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200813004551-gm0pbn1.sy@@ -13130,7 +13130,7 @@"Children": [{"Type": "NodeText",- "Data": "按住 Ctrl(macOS 为 Command)并用鼠标右键拖动画布可临时平移,不会改变键盘焦点或激活阅读中的画布,之后普通滚轮仍滚动文档。视图锁定时此手势不可用。普通模式下,空白区域的鼠标左键拖动用于框选节点。需要左键平移时,可在 "+ "Data": "也可直接按住鼠标中键拖动进行临时平移,松开即结束,无需切换手型工具。按住 Ctrl(macOS 为 Command)并用鼠标右键拖动画布可临时平移,不会改变键盘焦点或激活阅读中的画布,之后普通滚轮仍滚动文档。视图锁定时此手势不可用。普通模式下,空白区域的鼠标左键拖动用于框选节点。需要左键平移时,可在 "},{"Type": "NodeTextMark",diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.syindex 2f2e1e5c67..9ea5c9ac0b 100644--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy@@ -2066,7 +2066,7 @@"Children": [{"Type": "NodeText",- "Data": "無須進入畫布操作,也可以按住 Ctrl(macOS 為 Command)捲動滑鼠滾輪,以指標為中心縮放,或按住同一按鍵並用滑鼠右鍵拖曳畫布進行暫時平移。暫時平移保留鍵盤焦點和節點選取狀態。觸控螢幕上可用雙指縮放、平移。這些手勢保持目前的閱讀或畫布操作狀態。已儲存的檢視鎖定仍禁止編輯、縮放和平移,解鎖後可視需要進入畫布操作。"+ "Data": "無須進入畫布操作,也可以按住 Ctrl(macOS 為 Command)捲動滑鼠滾輪,以指標為中心縮放,或按住同一按鍵並用滑鼠右鍵拖曳畫布進行暫時平移。也可直接按住滑鼠中鍵拖曳進行暫時平移,放開即結束,無須切換手形工具。暫時平移保留鍵盤焦點和節點選取狀態。觸控螢幕上可用雙指縮放、平移。這些手勢保持目前的閱讀或畫布操作狀態。已儲存的檢視鎖定仍禁止編輯、縮放和平移,解鎖後可視需要進入畫布操作。"}]},diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122549-jktxego.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122549-jktxego.syindex ceed3385f1..ca06db386d 100644--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122549-jktxego.sy+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122549-jktxego.sy@@ -13136,7 +13136,7 @@"Children": [{"Type": "NodeText",- "Data": "按住 Ctrl(macOS 為 Command)並用滑鼠右鍵拖曳畫布可暫時平移,不會改變鍵盤焦點或啟用閱讀中的畫布,之後一般滾輪仍捲動文件。檢視鎖定時此手勢無法使用。一般模式下,空白區域的滑鼠左鍵拖曳用於框選節點。需要左鍵平移時,可在 "+ "Data": "也可直接按住滑鼠中鍵拖曳進行暫時平移,放開即結束,無須切換手形工具。按住 Ctrl(macOS 為 Command)並用滑鼠右鍵拖曳畫布可暫時平移,不會改變鍵盤焦點或啟用閱讀中的畫布,之後一般滾輪仍捲動文件。檢視鎖定時此手勢無法使用。一般模式下,空白區域的滑鼠左鍵拖曳用於框選節點。需要左鍵平移時,可在 "},{"Type": "NodeTextMark",diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-xsbxokr.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-xsbxokr.syindex 4be67cd19a..719bdb106d 100644--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-xsbxokr.sy+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-xsbxokr.sy@@ -13086,7 +13086,7 @@"Children": [{"Type": "NodeText",- "Data": "Ctrl(macOS では Command)を押しながらマウスの右ボタンでキャンバスをドラッグすると、キーボードフォーカスや閲覧状態を変えずに一時的に移動できます。その後も通常のホイール操作で文書をスクロールできます。表示ロック中は使えません。通常モードでは空白部分を左ボタンでドラッグしてもキャンバスは移動しません。手のひらツールでは左ボタンでのドラッグも使えます。"+ "Data": "マウスの中央ボタンを押しながらドラッグしても一時的に移動でき、離すと終了します。手のひらツールへの切り替えは不要です。Ctrl(macOS では Command)を押しながらマウスの右ボタンでキャンバスをドラッグすると、キーボードフォーカスや閲覧状態を変えずに一時的に移動できます。その後も通常のホイール操作で文書をスクロールできます。表示ロック中は使えません。通常モードでは空白部分を左ボタンでドラッグしてもキャンバスは移動しません。手のひらツールでは左ボタンでのドラッグも使えます。"}]},diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.syindex 828fcf8f39..4e0b94505a 100644--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.sy+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.sy@@ -2212,7 +2212,7 @@"Children": [{"Type": "NodeText",- "Data": "キャンバス操作を開始しなくても、Ctrl(macOS では Command)を押しながらホイールを回すとポインターを中心に拡大・縮小でき、同じキーを押しながらマウスの右ボタンでキャンバスをドラッグすると一時的に移動できます。一時的な移動ではキーボードフォーカスとノードの選択を保持します。タッチ画面では 2 本指で拡大・縮小と移動ができます。これらのジェスチャーは現在の閲覧状態またはキャンバス操作状態を保持します。保存された表示ロックは、引き続き編集、拡大・縮小、移動を無効にします。ロック解除後、必要に応じてキャンバス操作を開始してください。"+ "Data": "キャンバス操作を開始しなくても、Ctrl(macOS では Command)を押しながらホイールを回すとポインターを中心に拡大・縮小でき、同じキーを押しながらマウスの右ボタンでキャンバスをドラッグすると一時的に移動できます。マウスの中央ボタンを押しながらドラッグしても一時的に移動でき、離すと終了します。手のひらツールへの切り替えは不要です。一時的な移動ではキーボードフォーカスとノードの選択を保持します。タッチ画面では 2 本指で拡大・縮小と移動ができます。これらのジェスチャーは現在の閲覧状態またはキャンバス操作状態を保持します。保存された表示ロックは、引き続き編集、拡大・縮小、移動を無効にします。ロック解除後、必要に応じてキャンバス操作を開始してください。"}]},diff --git a/app/src/protyle/render/listMindmap/model.test.ts b/app/src/protyle/render/listMindmap/model.test.tsindex 245c63b952..9bc9783705 100644--- a/app/src/protyle/render/listMindmap/model.test.ts+++ b/app/src/protyle/render/listMindmap/model.test.ts@@ -3465,7 +3465,9 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,reader.value = "Document reading selection";reader.style.cssText = "position:fixed;top:0;left:0";document.body.append(reader);- for (const modifier of ["control", "meta"]) {+ for (const modifier of ["control", "meta", "middle"]) {+ const button = modifier === "middle" ? "middle" : "right";+ const modifiers = modifier === "middle" ? [] : [modifier];panView.setReadOnly(modifier === "meta");panView.selectNode(panModel.root.id);panView.inspector.hidden = true;@@ -3476,17 +3478,36 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,const point = centerPoint(node);const end = {x: point.x + 30, y: point.y + 20};const before = [panView.offsetX, panView.offsetY];+ let auxiliaryClick: MouseEvent;+ if (button === "middle") {+ viewport.addEventListener("auxclick", event => auxiliaryClick = event, {once: true});+ }await nativeInput([{type: "mouseMove", ...point},- {type: "mouseDown", ...point, button: "right", clickCount: 1, modifiers: [modifier]},- {type: "mouseMove", ...end, button: "right", modifiers: [modifier]},- {type: "mouseUp", ...end, button: "right", clickCount: 1, modifiers: [modifier]},+ {type: "mouseDown", ...point, button, clickCount: 1, modifiers},+ {type: "mouseMove", ...end, button, modifiers},+ {type: "mouseUp", ...end, button, clickCount: 1, modifiers},]);check.deepEqual([panView.offsetX, panView.offsetY], [before[0] + 30, before[1] + 20]);- check.equal(panView.interactionActive, false, "temporary right dragging preserves reading mode");- check.equal(document.activeElement, reader, "temporary right dragging does not steal document focus");+ check.equal(panView.interactionActive, false, "temporary dragging preserves reading mode");+ check.equal(document.activeElement, reader, "temporary dragging does not steal document focus");check.deepEqual([reader.selectionStart, reader.selectionEnd], [2, 8]);check.equal(panView.getSelectedId(), panModel.root.id);+ if (button === "middle") {+ check.equal(auxiliaryClick?.defaultPrevented, true, "middle release cancels the browser auxiliary action");+ await nativeInput([+ {type: "mouseDown", ...end, button, clickCount: 1},+ {type: "mouseUp", ...end, button, clickCount: 1},+ ]);+ check.equal(panView.getSelectedId(), panModel.root.id, "a middle click preserves the selected node");+ check.equal(document.activeElement, reader, "a middle click preserves document focus");+ await nativeInput([{type: "mouseDown", ...end, button, clickCount: 1}]);+ check.ok(panView.pointer?.pan);+ viewport.dispatchEvent(new PointerEvent("pointercancel", {+ pointerId: panView.pointer.pointerId, pointerType: "mouse"}));+ check.equal(panView.pointer, undefined, "canceling a middle drag releases its state");+ await nativeInput([{type: "mouseUp", ...end, button, clickCount: 1}]);+ }let receivedWheel: WheelEvent;let scrollingFinished = false;viewport.addEventListener("wheel", event => receivedWheel = event, {once: true});diff --git a/app/src/protyle/render/listMindmap/view.ts b/app/src/protyle/render/listMindmap/view.tsindex b262eadb82..207fbf5557 100644--- a/app/src/protyle/render/listMindmap/view.ts+++ b/app/src/protyle/render/listMindmap/view.ts@@ -81,7 +81,7 @@ export interface ListMindmapViewOptions {interface PointerState {pointerId: number;- rightButton?: boolean;+ panButton?: boolean;pan?: boolean;id?: string;nodeId?: string;@@ -278,6 +278,11 @@ export class ListMindmapView {this.listen(this.viewport, "pointermove", this.pointerMove);this.listen(this.viewport, "pointerleave", () => this.setHoveredLine());this.listen(this.viewport, "pointerup", this.pointerUp);+ this.listen(this.viewport, "auxclick", (event: MouseEvent) => {+ if (event.button === 1 && this.isPanTarget(event as PointerEvent)) {+ event.preventDefault();+ }+ });this.listen(this.viewport, "touchstart", this.pinchStart, {passive: false});this.listen(this.viewport, "touchmove", this.pinchMove, {passive: false});this.listen(this.viewport, "touchend", this.pinchEnd, {passive: false});@@ -2292,17 +2297,17 @@ export class ListMindmapView {};private isTemporaryPan(event: PointerEvent) {- return event.button === 2 && (event.ctrlKey || event.metaKey);+ return event.button === 1 || event.button === 2 && (event.ctrlKey || event.metaKey);}public isPanTarget(event: PointerEvent) {const target = event.target as HTMLElement;- return !this.locked && !this.pinching && (event.button === 2 || !this.summarySelecting && !this.relationFrom) &&+ return !this.locked && !this.pinching && (event.button === 1 || event.button === 2 || !this.summarySelecting && !this.relationFrom) &&(event.pointerType !== "touch" || this.interactionActive || !!this.fullscreenMarker) &&- (event.pointerType !== "touch" || event.isPrimary) && [0, 2].includes(event.button) &&+ (event.pointerType !== "touch" || event.isPrimary) && [0, 1, 2].includes(event.button) &&this.viewport.contains(target) && target.closest(".mindmap-view") === this.options.host &&!target.closest("button, input, select, textarea, audio, video, iframe, .mindmap-view__node--editing") &&- (this.panning || event.button === 2 ||+ (this.panning || event.button === 1 || event.button === 2 ||event.pointerType === "touch" && !target.closest(".mindmap-view__node, .mindmap-view__summary") &&!this.findLine(event));}@@ -2316,7 +2321,7 @@ export class ListMindmapView {this.suppressLinkClick = false;this.suppressPanContextMenu = false;const target = event.target as HTMLElement;- if (![0, 2].includes(event.button) || target.closest("button, input, select, textarea, audio, video, iframe") ||+ if (![0, 1, 2].includes(event.button) || target.closest("button, input, select, textarea, audio, video, iframe") ||this.viewport.contains(target.closest(".mindmap-view__node--editing"))) {return;}@@ -2386,11 +2391,11 @@ export class ListMindmapView {this.updateSelection();return;}- if (this.panning || event.button === 2) {+ if (this.panning || event.button === 1 || event.button === 2) {id = undefined;event.preventDefault();}- if (event.button !== 2 && !this.panning && !id && !this.readOnly && !this.relationFrom) {+ if (event.button === 0 && !this.panning && !id && !this.readOnly && !this.relationFrom) {const line = this.findLine(event);const points = line?.relation && this.relationRoutes.get(line.id);if (points) {@@ -2441,8 +2446,8 @@ export class ListMindmapView {.filter(element => element.closest(".mindmap-view") === this.options.host);this.pointer = {pointerId: event.pointerId,- rightButton: event.button === 2,- pan: this.panning || event.button === 2 || event.pointerType === "touch",+ panButton: event.button === 1 || event.button === 2,+ pan: this.panning || event.button === 1 || event.button === 2 || event.pointerType === "touch",id: event.pointerType !== "touch" && !this.readOnly && id && !this.model.nodes.get(id)?.virtual ? id : undefined,nodeId: id,touchNode: event.pointerType === "touch" && !this.readOnly && this.options.onMove &&@@ -2493,7 +2498,7 @@ export class ListMindmapView {if (this.pinching) {return;}- if (this.relationFrom && !this.pointer?.rightButton) {+ if (this.relationFrom && !this.pointer?.panButton) {const bounds = this.viewport.getBoundingClientRect();const id = (event.target as Element).closest<HTMLElement>(".mindmap-view__node")?.dataset.mindmapId;this.relationPreview = {@@ -2749,7 +2754,7 @@ export class ListMindmapView {}if (moved && id && targetId && placement) {this.options.onMove?.(id, targetId, placement);- } else if (!moved && !pointer.nodeId && !pointer.rightButton && !this.readOnly && !this.panning) {+ } else if (!moved && !pointer.nodeId && !pointer.panButton && !this.readOnly && !this.panning) {if (this.editingId) {this.clearSelection();}diff --git a/app/src/protyle/render/listMindmap/viewportFocus.test.ts b/app/src/protyle/render/listMindmap/viewportFocus.test.tsindex 30dad842c2..9877a29c4e 100644--- a/app/src/protyle/render/listMindmap/viewportFocus.test.ts+++ b/app/src/protyle/render/listMindmap/viewportFocus.test.ts@@ -46,7 +46,7 @@ const setup = () => {if (selector === ".mindmap-view") {return host;}- return kind !== "background" && selector.includes(kind) ? element() : null;+ return kind !== "background" && selector.split(",").some(item => item.trim() === kind) ? element() : null;},});const event = (kind = "background", overrides: Record<string, unknown> = {}) => ({@@ -221,8 +221,8 @@ test("bottom clearance preserves the node top below the toolbar when the node isassert.equal(100 + target.offsetY, 64);});-test("hand-tool, right-button and primary touch panning preserve the editing focus", () => {- for (const overrides of [{}, {button: 2}, {pointerType: "touch"}]) {+test("hand-tool, middle-button, right-button and primary touch panning preserve the editing focus", () => {+ for (const overrides of [{}, {button: 1}, {button: 2}, {pointerType: "touch"}]) {const {target, event, focus, finished} = setup();target.panning = !Object.keys(overrides).length;const down = event("background", overrides);@@ -259,12 +259,12 @@ test("touch activation waits for a click and ignores an unfinished pinch or a neassert.equal(target.interactionActive, false);});-test("Ctrl and Meta right dragging preserves reading state, node selection and editor focus", () => {- for (const key of ["ctrlKey", "metaKey"]) {+test("middle dragging and Ctrl or Meta right dragging preserve reading state, node selection and editor focus", () => {+ for (const overrides of [{button: 1}, {button: 2, ctrlKey: true}, {button: 2, metaKey: true}]) {for (const interactionActive of [false, true]) {const {target, event, focus, finished} = setup();target.interactionActive = interactionActive;- const down = event("background", {button: 2, [key]: true});+ const down = event("background", overrides);target.dismissControls(down);target.activatePointer(down);target.pointerDown(down);@@ -282,7 +282,7 @@ test("Ctrl and Meta right dragging preserves reading state, node selection and econst {target, event, finished} = setup();target.locked = true;target.interactionActive = false;- const down = event("background", {button: 2, [key]: true});+ const down = event("background", overrides);target.activatePointer(down);target.pointerDown(down);assert.equal(target.pointer, undefined, "temporary gestures cannot bypass a saved view lock");@@ -291,7 +291,7 @@ test("Ctrl and Meta right dragging preserves reading state, node selection and efor (const mode of ["relationFrom", "summarySelecting"]) {const {target, event, finished} = setup();target[mode] = mode === "relationFrom" ? "new" : true;- const down = event("background", {button: 2, [key]: true});+ const down = event("background", overrides);target.dismissControls(down);target.activatePointer(down);target.pointerDown(down);@@ -303,6 +303,43 @@ test("Ctrl and Meta right dragging preserves reading state, node selection and e}});+test("middle clicks preserve selection and editing without moving or finishing annotations", () => {+ for (const kind of ["background", ".mindmap-view__node", ".mindmap-view__summary"]) {+ for (const mode of ["normal", "readOnly", "relationFrom", "summarySelecting"]) {+ const {target, event, finished, focus} = setup();+ if (mode !== "normal") {+ target[mode] = mode === "relationFrom" ? "new" : true;+ }+ const down = event(kind, {button: 1});+ target.dismissControls(down);+ target.activatePointer(down);+ target.pointerDown(down);+ assert.equal(target.pointer.pan, true);+ assert.equal(target.pointer.id, undefined);+ assert.equal(target.pointer.selection, undefined);+ target.pointerUp(down);+ assert.equal(target.selectedId, "new");+ assert.equal(target.editingId, "new");+ assert.equal(finished(), 0);+ assert.equal(focus(), "editor");+ }+ }+});++test("middle panning excludes controls, node editors, nested maps and pinches", () => {+ const {target, event} = setup();+ for (const kind of ["button", "input", "select", "textarea", "audio", "video", "iframe", ".mindmap-view__node--editing"]) {+ const down = event(kind, {button: 1});+ assert.equal(target.isPanTarget(down), false, kind);+ target.pointerDown(down);+ assert.equal(target.pointer, undefined, kind);+ }+ assert.equal(target.isPanTarget(event("background", {button: 1, target: {closest: () => ({})}})), false);+ target.pinching = true;+ target.pointerDown(event("background", {button: 1}));+ assert.equal(target.pointer, undefined);+});+test("a background click still finishes editing while a canceled drag leaves it active", () => {const {target, event, focus, finished} = setup();const down = event();