Files
aego/tools/websmoke/try-capture.mjs
T
sanspie 50be5c04bc
ci-platforms / darwin amd64 smoke (push) Skipped
GitHub / linux amd64 native GitHub-hosted native CI: success
ci-platforms / windows amd64 smoke (push) Skipped
GitHub / windows amd64 native GitHub-hosted native CI: success
GitHub / darwin arm64 native GitHub-hosted native CI: success
GitHub / darwin amd64 native GitHub-hosted native CI: success
ci / checks (push) Failing after 1h21m34s
ci / native-authoring (push) Skipped
ci-platforms / darwin arm64 smoke (push) Skipped
github-native / gitea-pending (push) Skipped
github-native / darwin amd64 native (push) Skipped
github-native / linux amd64 native (push) Skipped
github-native / windows amd64 native (push) Skipped
github-native / darwin arm64 native (push) Skipped
github-native / gitea-result (push) Skipped
ci / build (amd64, linux, ubuntu-24.04) (push) Successful in 12m4s
ci / release (push) Skipped
Stage 12.5: Art Workspace and asset authoring
Add dockable Art tools, animation and previews, guarded asset workflows,
and the Web Asset Studio built on the shared Art Core. Expand English and
Russian documentation, interactive Try scenes, examples and editor icons.

Add audio waveform navigation, source analysis, guarded previews and a
browser Worker mixer. Preserve source changes and recovery with bounded
checks, and strengthen native, browser and interoperability CI.

Prepare version 0.12.5 and manually built native artifact candidates.
Fix the production site image demo build dependency.
Reuse immutable scene indices when capturing keyframes.
Wait for real Persist save/load completion in component tests.
Stabilize browser Game View captures outside pointer hover.
Aseprite interchange and persistent Audio EDL recovery remain limited;
the artifact workflow does not publish releases or change stable.
2026-11-15 10:37:50 +03:00

36 lines
2.1 KiB
JavaScript

const fields = ["x", "y", "width", "height", "canvasWidth", "canvasHeight"];
export function sameCaptureViewport(a, b) {
return !!a && !!b && fields.every(key => Number.isFinite(a[key]) && a[key] === b[key]);
}
export function neutralCapturePoint(viewport, bounds) {
if (!viewport || !fields.every(key => Number.isFinite(viewport[key])) ||
viewport.width <= 0 || viewport.height <= 0 || viewport.canvasWidth < 4 || viewport.canvasHeight < 4 ||
viewport.x < 0 || viewport.y < 0 || viewport.x + viewport.width > viewport.canvasWidth ||
viewport.y + viewport.height > viewport.canvasHeight || !bounds ||
![bounds.x, bounds.y, bounds.width, bounds.height].every(Number.isFinite) || bounds.width < 4 || bounds.height < 4) {
throw new Error("invalid Game View or canvas capture bounds");
}
const {canvasWidth: w, canvasHeight: h} = viewport;
// The surrounding Try stage has rounded, clipped corners; measure this
// inset in CSS pixels rather than in the runtime's logical coordinates.
const mx = Math.min(12 * w / bounds.width, w / 4), my = Math.min(12 * h / bounds.height, h / 4);
const corners = [[w - mx, my], [mx, my], [w - mx, h - my], [mx, h - my]];
const outside = ([x, y]) => x < viewport.x || y < viewport.y ||
x >= viewport.x + viewport.width || y >= viewport.y + viewport.height;
const point = corners.find(outside);
if (!point) throw new Error("no neutral pointer location outside Game View");
return {x: bounds.x + point[0] * bounds.width / w, y: bounds.y + point[1] * bounds.height / h};
}
// Use a real pointer move inside the canvas, away from the captured Game View.
export async function parkCapturePointer(page, viewport) {
const canvas = page.locator(".try canvas");
await canvas.scrollIntoViewIfNeeded();
const point = neutralCapturePoint(viewport, await canvas.boundingBox());
const onCanvas = await page.evaluate(({x, y}) => document.elementFromPoint(x, y) === document.querySelector(".try canvas"), point);
if (!onCanvas) throw new Error("neutral capture location is not on the canvas");
await page.mouse.move(point.x, point.y);
}