Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/studio/src/components/nle/NLEPreview.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,15 @@ describe("NLEPreview", () => {
globalThis.ResizeObserver = originalResizeObserver;
});

it("draws the canvas boundary on the preview stage", () => {
const view = renderPreview();

expect(view.stage.style.boxShadow).toBe(
"0 0 0 1px rgba(255,255,255,0.08), 0 4px 32px rgba(0,0,0,0.7)",
);
view.cleanup();
});

it("pans the preview with middle mouse drag", () => {
const view = renderPreview();
const target = document.createElement("div");
Expand Down
3 changes: 3 additions & 0 deletions packages/studio/src/components/nle/NLEPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,9 @@ export const NLEPreview = memo(function NLEPreview({
transform: `translate3d(${toDomPrecision(initial.panX)}px, ${toDomPrecision(initial.panY)}px, 0) scale(${toDomPrecision(initial.zoomPercent / 100)})`,
// resolvePreviewWheelZoom cursor math assumes center-center pivot
transformOrigin: "center center",
// Keep Studio chrome outside the scaled composition iframe. Painting
// this on the iframe creates a subpixel seam at fractional fit sizes.
boxShadow: "0 0 0 1px rgba(255,255,255,0.08), 0 4px 32px rgba(0,0,0,0.7)",
}}
data-testid="preview-zoom-stage"
>
Expand Down
10 changes: 10 additions & 0 deletions packages/studio/src/player/components/Player.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class TestHyperframesPlayer extends HTMLElement {

constructor() {
super();
this.attachShadow({ mode: "open" }).appendChild(this.iframeElement);

const addIframeListener = this.iframeElement.addEventListener.bind(this.iframeElement);
this.iframeElement.addEventListener = ((type, listener, options) => {
Expand Down Expand Up @@ -155,6 +156,15 @@ describe("preview errors", () => {
});
});

describe("preview canvas chrome", () => {
it("does not paint Studio chrome on the scaled composition iframe", async () => {
const { player } = await mountPlayer();
const injectedStyles = Array.from(player.shadowRoot?.querySelectorAll("style") ?? []);

expect(injectedStyles.some((style) => style.textContent?.includes("box-shadow"))).toBe(false);
});
});

describe("composition loading overlay", () => {
it("shows while the composition is loading", () => {
expect(shouldShowCompositionLoadingOverlay(true)).toBe(true);
Expand Down
12 changes: 0 additions & 12 deletions packages/studio/src/player/components/Player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,18 +281,6 @@ export const Player = forwardRef<HTMLIFrameElement, PlayerProps>(
player.setAttribute("src", src);
container.appendChild(player);

// Inject pasteboard shadow: let the shadow around the canvas bleed
// into the surrounding pasteboard area (overflow: visible on the container)
// and add a subtle outline + drop-shadow so the canvas boundary reads
// against the gray pasteboard, consistent with professional editors.
if (player.shadowRoot) {
const pasteboardStyle = document.createElement("style");
pasteboardStyle.textContent =
".hfp-container{overflow:visible}" +
".hfp-iframe{box-shadow:0 0 0 1px rgba(255,255,255,0.08),0 4px 32px rgba(0,0,0,.7)}";
player.shadowRoot.appendChild(pasteboardStyle);
}

enableInteractiveIframe(player);

cleanup = () => {
Expand Down
Loading