fix: cannot exit editing mode when click frame body (#11603)

This commit is contained in:
doouding
2025-04-11 03:23:27 +00:00
parent bcd1cd2629
commit 714f2e79dc
6 changed files with 17 additions and 11 deletions

View File

@@ -115,8 +115,8 @@ export class ElementTransformManager extends GfxExtension {
fallback: lockedElement !== picked,
};
view?.onSelected(context);
return true;
const selected = view?.onSelected(context);
return selected ?? true;
}
return false;

View File

@@ -193,13 +193,15 @@ export class GfxElementModelView<
this.model.xywh = currentBound.moveDelta(dx, dy).serialize();
}
onSelected(context: SelectedContext) {
onSelected(context: SelectedContext): void | boolean {
if (this.model instanceof GfxPrimitiveElementModel) {
if (context.multiSelect) {
this.gfx.selection.toggle(this.model);
} else {
this.gfx.selection.set({ elements: [this.model.id] });
}
return true;
}
}

View File

@@ -103,12 +103,14 @@ export abstract class GfxBlockComponent<
this.model.pop('xywh');
}
onSelected(context: SelectedContext) {
onSelected(context: SelectedContext): void | boolean {
if (context.multiSelect) {
this.gfx.selection.toggle(this.model);
} else {
this.gfx.selection.set({ elements: [this.model.id] });
}
return true;
}
onRotate() {}
@@ -219,12 +221,14 @@ export function toGfxBlockComponent<
}
// eslint-disable-next-line sonarjs/no-identical-functions
onSelected(context: SelectedContext) {
onSelected(context: SelectedContext): void | boolean {
if (context.multiSelect) {
this.gfx.selection.toggle(this.model);
} else {
this.gfx.selection.set({ elements: [this.model.id] });
}
return true;
}
onRotate() {}