mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-18 16:08:56 +00:00
fix(core): a logo image no longer renders stretched to the frame bottom (#7179)
* fix(core): a logo image no longer renders stretched to the frame bottom * style(core): name the image layout exception instead of commenting it
This commit is contained in:
@@ -5755,6 +5755,23 @@ describe("initSandboxRuntimeModular", () => {
|
||||
expect(card.style.height).toBe("100%");
|
||||
});
|
||||
|
||||
it("leaves a still-loading image at its own size instead of filling the frame", () => {
|
||||
const root = makeRoot();
|
||||
const logo = document.createElement("img");
|
||||
logo.setAttribute("data-start", "0");
|
||||
logo.setAttribute("data-duration", "5");
|
||||
logo.style.width = "340px";
|
||||
root.appendChild(logo);
|
||||
// Before its file loads, a width-only <img> measures 0px tall.
|
||||
modelBrowserLayout(logo, { width: "340px", height: "0px" });
|
||||
|
||||
window.__timelines = { main: createMockTimeline(10) };
|
||||
initSandboxRuntimeModular();
|
||||
|
||||
expect(logo.style.height).toBe("");
|
||||
expect(logo.style.width).toBe("340px");
|
||||
});
|
||||
|
||||
it("puts back an author's display:none !important after measuring the clip", () => {
|
||||
const root = makeRoot();
|
||||
const card = document.createElement("div");
|
||||
|
||||
@@ -1027,6 +1027,7 @@ export function initSandboxRuntimeModular(): void {
|
||||
el.style.position = "absolute";
|
||||
}
|
||||
if (tag !== "audio") {
|
||||
const sizedByItsFile = tag === "img";
|
||||
const forcedWidth = parseDimensionPx(el.getAttribute("data-width"));
|
||||
const forcedHeight = parseDimensionPx(el.getAttribute("data-height"));
|
||||
const hasMeaningfulComputedWidth = computed.width !== "0px" && computed.width !== "auto";
|
||||
@@ -1035,14 +1036,14 @@ export function initSandboxRuntimeModular(): void {
|
||||
if (!el.style.width && !hasMeaningfulComputedWidth) {
|
||||
el.style.width = forcedWidth;
|
||||
}
|
||||
} else if (!el.style.width && computed.width === "0px") {
|
||||
} else if (!sizedByItsFile && !el.style.width && computed.width === "0px") {
|
||||
el.style.width = "100%";
|
||||
}
|
||||
if (forcedHeight) {
|
||||
if (!el.style.height && !hasMeaningfulComputedHeight) {
|
||||
el.style.height = forcedHeight;
|
||||
}
|
||||
} else if (!el.style.height && computed.height === "0px") {
|
||||
} else if (!sizedByItsFile && !el.style.height && computed.height === "0px") {
|
||||
el.style.height = "100%";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user