Update viewport-test-helpers.ts with new selection properties and clickViewportAtRatio function
This commit is contained in:
@@ -23,7 +23,12 @@ interface EditorStoreSnapshot {
|
|||||||
selection: {
|
selection: {
|
||||||
kind: string;
|
kind: string;
|
||||||
ids?: string[];
|
ids?: string[];
|
||||||
|
brushId?: string;
|
||||||
|
faceId?: string;
|
||||||
|
edgeId?: string;
|
||||||
|
vertexId?: string;
|
||||||
};
|
};
|
||||||
|
whiteboxSelectionMode: string;
|
||||||
toolMode: string;
|
toolMode: string;
|
||||||
document: {
|
document: {
|
||||||
assets: Record<string, { id: string; kind: string; sourceName: string }>;
|
assets: Record<string, { id: string; kind: string; sourceName: string }>;
|
||||||
@@ -153,6 +158,22 @@ export async function clickViewport(page: Page, panelId: string = DEFAULT_VIEWPO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function clickViewportAtRatio(page: Page, panelId: string, xRatio: number, yRatio: number) {
|
||||||
|
const viewportCanvas = getViewportCanvas(page, panelId);
|
||||||
|
const box = await viewportCanvas.boundingBox();
|
||||||
|
|
||||||
|
if (box === null) {
|
||||||
|
throw new Error(`Missing viewport canvas for ${panelId}.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
await viewportCanvas.click({
|
||||||
|
position: {
|
||||||
|
x: box.width * xRatio,
|
||||||
|
y: box.height * yRatio
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export async function setSharedBoxCreationPreview(
|
export async function setSharedBoxCreationPreview(
|
||||||
page: Page,
|
page: Page,
|
||||||
panelId: ViewportPanelId,
|
panelId: ViewportPanelId,
|
||||||
|
|||||||
Reference in New Issue
Block a user