feat(editor): disable clickToDrag for edgeless toolbar shape and mindmap (#11310)

This commit is contained in:
CatsJuice
2025-04-04 05:10:05 +00:00
parent adbd41130c
commit 46d8d30e62
6 changed files with 51 additions and 5 deletions
@@ -254,6 +254,20 @@ export class EdgelessMindmapMenu extends EdgelessToolbarToolMixin(
}
},
});
this.edgeless.bindHotKey(
{
m: () => {
const gfx = this.gfx;
const locked = gfx.viewport.locked;
if (locked) return;
if (gfx.selection.editing) return;
// toolbar mindmap button will capture the `m` key and create a new overlay
this.draggableController.cancelWithoutAnimation();
},
},
{ global: true }
);
}
override render() {
@@ -231,7 +231,7 @@ export class EdgelessMindmapToolButton extends EdgelessToolbarToolMixin(
edgeless: this.edgeless,
scopeElement: this.toolbarContainer,
standardWidth: 100,
clickToDrag: true,
clickToDrag: false,
onOverlayCreated: (overlay, { data }) => {
const tool = this.draggableTools.find(t => t.name === data.name);
if (!tool) return;
@@ -321,7 +321,7 @@ export class EdgelessMindmapToolButton extends EdgelessToolbarToolMixin(
const { viewport } = this.edgeless.std.get(ViewportElementProvider);
const { left, top } = viewport;
const clientPos = { x: x + left, y: y + top };
this.draggableController.clickToDrag(icon, clientPos);
this.draggableController.dragAndMoveTo(icon, clientPos);
},
},
{ global: true }