mirror of
https://github.com/penpot/penpot.git
synced 2025-05-10 23:16:38 +02:00
🐛 Fix zoom to fit all didn't fit all (#5673)
This commit is contained in:
parent
a5dc9eb458
commit
dbf7b94651
3 changed files with 205956 additions and 1 deletions
205906
frontend/playwright/data/workspace/get-file-9930.json
Normal file
205906
frontend/playwright/data/workspace/get-file-9930.json
Normal file
File diff suppressed because it is too large
Load diff
|
@ -321,6 +321,55 @@ test("[Taiga #9929] Paste text in workspace", async ({ page, context }) => {
|
||||||
.getByText("Lorem ipsum dolor");
|
.getByText("Lorem ipsum dolor");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("[Taiga #9930] Zoom fit all doesn't fits all", async ({
|
||||||
|
page,
|
||||||
|
context,
|
||||||
|
}) => {
|
||||||
|
const workspacePage = new WorkspacePage(page);
|
||||||
|
await workspacePage.setupEmptyFile(page);
|
||||||
|
await workspacePage.mockRPC(/get\-file\?/, "workspace/get-file-9930.json");
|
||||||
|
await workspacePage.goToWorkspace({
|
||||||
|
fileId: "8f843b59-7fbb-81ce-8005-aa6d47ae3111",
|
||||||
|
pageId: "fb9798e7-a547-80ae-8005-9ffda4a13e2c",
|
||||||
|
});
|
||||||
|
|
||||||
|
const zoom = await page.getByTitle("Zoom");
|
||||||
|
await zoom.click();
|
||||||
|
|
||||||
|
const zoomIn = await page.getByTitle("Zoom in");
|
||||||
|
await zoomIn.click();
|
||||||
|
await zoomIn.click();
|
||||||
|
await zoomIn.click();
|
||||||
|
|
||||||
|
// Zoom fit all
|
||||||
|
await page.keyboard.press("Shift+1");
|
||||||
|
|
||||||
|
const ids = [
|
||||||
|
"shape-165d1e5a-5873-8010-8005-9ffdbeaeec59",
|
||||||
|
"shape-165d1e5a-5873-8010-8005-9ffdbeaf8d8a",
|
||||||
|
"shape-165d1e5a-5873-8010-8005-9ffdbeaf8d9e",
|
||||||
|
"shape-165d1e5a-5873-8010-8005-9ffdbeb053d9",
|
||||||
|
"shape-165d1e5a-5873-8010-8005-9ffdbeb09738",
|
||||||
|
"shape-165d1e5a-5873-8010-8005-9ffdbeb0f3fc",
|
||||||
|
];
|
||||||
|
|
||||||
|
function contains(container, contained) {
|
||||||
|
return (
|
||||||
|
container.x <= contained.x &&
|
||||||
|
container.y <= contained.y &&
|
||||||
|
container.width >= contained.width &&
|
||||||
|
container.height >= contained.height
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const viewportBoundingBox = await workspacePage.viewport.boundingBox();
|
||||||
|
for (const id of ids) {
|
||||||
|
const shape = await page.locator(`.ws-shape-wrapper > g#${id}`);
|
||||||
|
const shapeBoundingBox = await shape.boundingBox();
|
||||||
|
expect(contains(viewportBoundingBox, shapeBoundingBox)).toBeTruthy();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
test("Bug 9877, user navigation to dashboard from header goes to blank page", async ({
|
test("Bug 9877, user navigation to dashboard from header goes to blank page", async ({
|
||||||
page,
|
page,
|
||||||
}) => {
|
}) => {
|
||||||
|
|
|
@ -90,7 +90,7 @@
|
||||||
state
|
state
|
||||||
(update state :workspace-local
|
(update state :workspace-local
|
||||||
(fn [{:keys [vport] :as local}]
|
(fn [{:keys [vport] :as local}]
|
||||||
(let [srect (gal/adjust-to-viewport vport srect {:padding 40})
|
(let [srect (gal/adjust-to-viewport vport srect {:padding 160})
|
||||||
zoom (/ (:width vport) (:width srect))]
|
zoom (/ (:width vport) (:width srect))]
|
||||||
(-> local
|
(-> local
|
||||||
(assoc :zoom zoom)
|
(assoc :zoom zoom)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue