Add E2E test for transform gizmo commit and refactor viewport-host.ts

This commit is contained in:
2026-04-12 00:33:09 +02:00
parent 7a25c5c7b7
commit 0cfbab9de5
2 changed files with 179 additions and 21 deletions

View File

@@ -5099,13 +5099,18 @@ export class ViewportHost {
return;
}
if (this.currentTransformSession.kind === "active") {
if (this.currentTransformSession.sourcePanelId !== this.panelId) {
return;
}
event.preventDefault();
this.transformCommitHandler?.(this.currentTransformSession);
return;
}
const transformHandle = this.pickTransformHandle(event);
const interactionSession =
this.currentTransformSession.kind === "active"
? this.currentTransformSession.sourcePanelId === this.panelId
? this.currentTransformSession
: null
: this.getDisplayedTransformSession();
const interactionSession = this.getDisplayedTransformSession();
if (transformHandle !== null && interactionSession !== null) {
event.preventDefault();
@@ -5164,21 +5169,6 @@ export class ViewportHost {
return;
}
if (this.currentTransformSession.kind === "active") {
if (this.currentTransformSession.sourcePanelId !== this.panelId) {
return;
}
if (
this.currentTransformSession.source !== "gizmo" ||
this.currentTransformSession.sourcePanelId === this.panelId
) {
event.preventDefault();
this.transformCommitHandler?.(this.currentTransformSession);
return;
}
}
if (this.toolMode === "create" && this.creationPreview !== null) {
const previewCenter = this.getCreationPreviewCenter(
event,