fix: frame complete HiCAD models after generation
This commit is contained in:
parent
74801ae7d6
commit
aebcedaf71
@ -269,6 +269,25 @@ function patchOfficialSource() {
|
||||
` // We need a padding of 0.1 for zoom_to_fit for all E2E tests since they were originally\n // written with zoom_to_fit with padding 0.1\n const padding = 0.1\n if (isPlaywright()) {`,
|
||||
` // Keep the official E2E framing stable while giving HiCAD users enough\n // breathing room to see the complete model after generation and file loads.\n const padding = isPlaywright() ? 0.1 : 0.35\n if (isPlaywright()) {`
|
||||
);
|
||||
replaceSource(
|
||||
"src/lib/resetCameraPosition.ts",
|
||||
` await engineViewIsometric({
|
||||
engineCommandManager,
|
||||
padding,
|
||||
})`,
|
||||
` await engineViewIsometric({
|
||||
engineCommandManager,
|
||||
padding,
|
||||
})
|
||||
|
||||
// view_isometric changes the direction but can preserve the previous
|
||||
// close-up distance. Refit against every generated entity so newly
|
||||
// completed models open fully framed instead of showing a local detail.
|
||||
await engineStreamZoomToFit({
|
||||
engineCommandManager,
|
||||
padding,
|
||||
})`
|
||||
);
|
||||
replaceSource(
|
||||
"src/lib/commandBarConfigs/standardViewsConfig.ts",
|
||||
"engineStreamZoomToFit({ engineCommandManager, padding: 0.1 })",
|
||||
|
||||
@ -40,4 +40,18 @@ test.describe("HiCAD embedded startup", () => {
|
||||
/location = \/vendor\/zoo-modeling-app\/kcl_wasm_lib_bg\.wasm \{[\s\S]*?gzip_static on;/
|
||||
);
|
||||
});
|
||||
|
||||
test("fits the complete generated model after selecting the isometric view", () => {
|
||||
const vendorScript = fs.readFileSync(
|
||||
path.join(projectRoot, "scripts/vendor-zoo-modeling-app.mjs"),
|
||||
"utf8"
|
||||
);
|
||||
|
||||
expect(vendorScript).toMatch(
|
||||
/await engineViewIsometric\(\{[\s\S]*?await engineStreamZoomToFit\(\{\s*engineCommandManager,\s*padding,/
|
||||
);
|
||||
expect(vendorScript).toContain(
|
||||
"Refit against every generated entity so newly"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user