mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-09 12:00:26 +00:00
fix(studio): address PR review — add tests, strip GSAP transform for rotation, remove dead exports
Addresses review feedback from Rames and Vai: 1. Add 7 new tests for createStudioPositionSeekReapplyScript: box-size reapplication, GSAP translate stripping (identity removal, scale+translate preservation, transform:none no-op), and rotation- only elements with GSAP-baked translate. 2. Add pinning test for the PiP-over-sub-composition selection bug: elementsFromPoint returns [pipVideo, subCompRoot, sfChromeImg] as siblings — assert the topmost (pipVideo) wins. 3. Apply stripGsapTranslateFromTransform to rotation-only elements too, not just path-offset elements. A rotation-only element with a GSAP-animated translate would have its position clobbered. 4. Remove dead exports: getPreviewLocalPointer, buildRasterClickSelectionContext, getPreviewPlayer, seekStudioPreview, PreviewPlayerCompat, PreviewLocalPointer from studioPreviewHelpers.ts. Unexport resolvePreviewLocalPointer.
This commit is contained in:
@@ -321,6 +321,29 @@ describe("resolveVisualDomEditSelectionTarget", () => {
|
||||
expect(visualTarget).toBe(headline);
|
||||
expect(explicitSelection?.id).toBe("container");
|
||||
});
|
||||
|
||||
it("prefers the visually-on-top sibling over a deeper element in a separate visual layer", () => {
|
||||
const document = createDocument(`
|
||||
<div id="comp-root">
|
||||
<div id="sub-comp" class="sub-comp">
|
||||
<img id="sf-chrome" class="sf-chrome" style="width:100%;height:100%" />
|
||||
</div>
|
||||
<video id="pip-studio" class="pip-studio" style="position:absolute;z-index:15" />
|
||||
</div>
|
||||
`);
|
||||
const pipStudio = document.getElementById("pip-studio") as HTMLElement;
|
||||
const sfChrome = document.getElementById("sf-chrome") as HTMLElement;
|
||||
const subComp = document.getElementById("sub-comp") as HTMLElement;
|
||||
setElementRect(pipStudio, { left: 50, top: 50, width: 320, height: 320 });
|
||||
setElementRect(sfChrome, { left: 0, top: 0, width: 1920, height: 1080 });
|
||||
setElementRect(subComp, { left: 0, top: 0, width: 1920, height: 1080 });
|
||||
|
||||
expect(
|
||||
resolveVisualDomEditSelectionTarget([pipStudio, subComp, sfChrome], {
|
||||
activeCompositionPath: "index.html",
|
||||
}),
|
||||
).toBe(pipStudio);
|
||||
});
|
||||
});
|
||||
|
||||
describe("isLargeRasterDomEditSelection", () => {
|
||||
|
||||
Reference in New Issue
Block a user