mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-12 07:09:59 +00:00
fix(studio): flashless z-order commits and visible-overlap stepping
Two legibility fixes for the canvas z-order menu, from user feel-testing: - z-only commits no longer remount the preview iframe. The commit hook already applies the inline z (+ injected position) to the live elements and updates the store synchronously; the post-commit reloadPreview() was a redundant full remount that read as a canvas 'blink' on every action. commitDomEditPatchBatches gains skipReload, engaged only when provably safe: every op is an inline-style patch AND the server reports every patch matched — anything else falls back to the reload so the preview reconverges with disk. The file-watcher's own reload stays suppressed by the existing domEditSaveTimestampRef window, so the skip is real. - Bring Forward / Send Backward step over the next VISIBLY overlapping sibling. The nearest z-neighbor in a composition is often invisible at the current frame (runtime hides time-inactive clips with inline visibility/display; GSAP parks elements at opacity 0), so the step crossed something the user couldn't see — 'enabled but nothing happens'. The forward/backward set now filters on element-level computed visibility (display/visibility/opacity, injectable for tests); enable/disable shares the resolver so the menu is honest: actions disable when no visible neighbor exists. Front/back keep the full painting family. - The neighbor that was stepped over gets a 600ms accent flash, drawn in the studio overlay layer (never in the iframe DOM), so the action shows its work.
This commit is contained in:
@@ -18,6 +18,7 @@ afterEach(() => {
|
||||
interface BatchOptions {
|
||||
label: string;
|
||||
coalesceKey: string;
|
||||
skipReload?: boolean;
|
||||
}
|
||||
|
||||
interface CapturedBatchCall {
|
||||
@@ -110,6 +111,25 @@ describe("useElementLifecycleOps — z-index reorder payload", () => {
|
||||
act(() => root.unmount());
|
||||
});
|
||||
|
||||
it("requests skipReload on every z-reorder persist (live DOM already final)", async () => {
|
||||
// The commit applies the z-index (and any injected position) to the live
|
||||
// iframe DOM and the store synchronously, so the persisted style-only patch
|
||||
// adds nothing the preview doesn't already show — the batch commit is asked
|
||||
// to skip the iframe remount. commitDomEditPatchBatches still falls back to
|
||||
// reloading when the server can't confirm every patch target matched.
|
||||
const el = document.createElement("div");
|
||||
el.id = "clip-z";
|
||||
|
||||
const { captured, root } = await runReorderCommit(el, [
|
||||
{ element: el, zIndex: 4, id: "clip-z", sourceFile: "index.html" },
|
||||
]);
|
||||
|
||||
expect(captured).toHaveLength(1);
|
||||
expect(captured[0]?.options.skipReload).toBe(true);
|
||||
|
||||
act(() => root.unmount());
|
||||
});
|
||||
|
||||
it("preserves a real id when the element has one", async () => {
|
||||
const el = document.createElement("video");
|
||||
el.id = "v-hero";
|
||||
|
||||
Reference in New Issue
Block a user