fix(webui): keep zoomed Mermaid images sharp
This commit is contained in:
1 parent
ae5cb64e9e
commit
e44ebb164d
2 files changed
+5
-3
No files matched your search
@@ -39,8 +39,10 @@ test("same-source completion loads a real Pele image only after generation, with
|
||||
await page.keyboard.press("Enter");
|
||||
const dialog = page.getByRole("dialog");
|
||||
await expect(dialog).toBeVisible();
|
||||
await dialog.getByRole("button", { name: "Zoom in" }).click();
|
||||
await expect(dialog.getByRole("button", { name: "Fit image" })).toHaveText("150%");
|
||||
for (let step = 0; step < 3; step++) await dialog.getByRole("button", { name: "Zoom in" }).click();
|
||||
await expect(dialog.getByRole("button", { name: "Fit image" })).toHaveText("338%");
|
||||
// CDP screenshots can hide fit-size raster caching, so check the compositor hint.
|
||||
await expect(dialog.locator("img")).toHaveCSS("will-change", "auto");
|
||||
const viewport = dialog.getByTestId("image-viewport");
|
||||
await viewport.focus();
|
||||
await page.keyboard.press("0");
|
||||
|
||||
@@ -140,7 +140,7 @@ export function ImageViewport({
|
||||
event.stopPropagation();
|
||||
}}>
|
||||
<img ref={image} src={src} alt={alt} decoding="async" draggable={false} onLoad={() => apply(viewRef.current)}
|
||||
className={cn("max-h-full max-w-full select-none object-contain will-change-transform", imageClassName)}
|
||||
className={cn("max-h-full max-w-full select-none object-contain", imageClassName)}
|
||||
style={{ transform: `translate3d(${view.x}px, ${view.y}px, 0) scale(${view.scale})` }} />
|
||||
</div>
|
||||
<div className={cn("flex items-center justify-center gap-1 rounded-full p-1 text-muted-foreground", controlsClassName)}>
|
||||
|
||||
Reference in new issue
Block a user