fix: anchor board zoom to pointer

This commit is contained in:
2026-08-14 16:44:43 +02:00
parent f97dceb4fe
commit a4b22a574b
4 changed files with 34 additions and 4 deletions
+8 -1
View File
@@ -83,9 +83,16 @@ test('move, folder expansion, hand pan, desktop wheel zoom, mobile pinch, and re
const transformBeforeWheel = await board.getAttribute('style')
const browserMetricsBeforeWheel = await page.evaluate(() => ({ width: window.innerWidth, height: window.innerHeight, devicePixelRatio: window.devicePixelRatio }))
await page.mouse.move(viewportBox.x + 400, viewportBox.y + 260)
const folderAnchorBefore = await folder.boundingBox()
if (!folderAnchorBefore) throw new Error('Folder is not visible for cursor-centered zoom')
const wheelAnchor = { x: folderAnchorBefore.x + folderAnchorBefore.width / 2, y: folderAnchorBefore.y + folderAnchorBefore.height / 2 }
await page.mouse.move(wheelAnchor.x, wheelAnchor.y)
await page.mouse.wheel(0, -80)
await expect.poll(() => board.getAttribute('style')).not.toEqual(transformBeforeWheel)
const folderAnchorAfter = await folder.boundingBox()
if (!folderAnchorAfter) throw new Error('Folder disappeared after zoom')
expect(folderAnchorAfter.x + folderAnchorAfter.width / 2).toBeCloseTo(wheelAnchor.x, 0)
expect(folderAnchorAfter.y + folderAnchorAfter.height / 2).toBeCloseTo(wheelAnchor.y, 0)
expect(await page.evaluate(() => ({ width: window.innerWidth, height: window.innerHeight, devicePixelRatio: window.devicePixelRatio }))).toEqual(browserMetricsBeforeWheel)
const transformBeforeDesktopPinch = await board.getAttribute('style')