mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-23 04:04:27 +08:00
feat(editor): disable clickToDrag for edgeless toolbar shape and mindmap (#11310)
This commit is contained in:
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user