diff --git a/browser_tests/interaction.spec.ts b/browser_tests/interaction.spec.ts index 382b0d913b..8e801b042e 100644 --- a/browser_tests/interaction.spec.ts +++ b/browser_tests/interaction.spec.ts @@ -110,6 +110,23 @@ test.describe('Canvas Interaction', () => { await expect(comfyPage.canvas).toHaveScreenshot('zoomed-out.png') }) + test('Can zoom in/out with ctrl+shift+vertical-drag', async ({ + comfyPage + }) => { + await comfyPage.page.keyboard.down('Control') + await comfyPage.page.keyboard.down('Shift') + await comfyPage.dragAndDrop({ x: 10, y: 100 }, { x: 10, y: 40 }) + await expect(comfyPage.canvas).toHaveScreenshot('zoomed-in-ctrl-shift.png') + await comfyPage.dragAndDrop({ x: 10, y: 40 }, { x: 10, y: 160 }) + await expect(comfyPage.canvas).toHaveScreenshot('zoomed-out-ctrl-shift.png') + await comfyPage.dragAndDrop({ x: 10, y: 280 }, { x: 10, y: 220 }) + await expect(comfyPage.canvas).toHaveScreenshot( + 'zoomed-default-ctrl-shift.png' + ) + await comfyPage.page.keyboard.up('Control') + await comfyPage.page.keyboard.up('Shift') + }) + test('Can pan', async ({ comfyPage }) => { await comfyPage.pan({ x: 200, y: 200 }) await expect(comfyPage.canvas).toHaveScreenshot('panned.png') diff --git a/browser_tests/interaction.spec.ts-snapshots/zoomed-default-ctrl-shift-chromium-linux.png b/browser_tests/interaction.spec.ts-snapshots/zoomed-default-ctrl-shift-chromium-linux.png new file mode 100644 index 0000000000..3bccbc9196 Binary files /dev/null and b/browser_tests/interaction.spec.ts-snapshots/zoomed-default-ctrl-shift-chromium-linux.png differ diff --git a/browser_tests/interaction.spec.ts-snapshots/zoomed-in-ctrl-shift-chromium-linux.png b/browser_tests/interaction.spec.ts-snapshots/zoomed-in-ctrl-shift-chromium-linux.png new file mode 100644 index 0000000000..2a50a8ab43 Binary files /dev/null and b/browser_tests/interaction.spec.ts-snapshots/zoomed-in-ctrl-shift-chromium-linux.png differ diff --git a/browser_tests/interaction.spec.ts-snapshots/zoomed-out-ctrl-shift-chromium-linux.png b/browser_tests/interaction.spec.ts-snapshots/zoomed-out-ctrl-shift-chromium-linux.png new file mode 100644 index 0000000000..69584c5a9f Binary files /dev/null and b/browser_tests/interaction.spec.ts-snapshots/zoomed-out-ctrl-shift-chromium-linux.png differ diff --git a/src/scripts/app.ts b/src/scripts/app.ts index 911319aa4b..ee2b491c90 100644 --- a/src/scripts/app.ts +++ b/src/scripts/app.ts @@ -1245,8 +1245,8 @@ export class ComfyApp { let scale = startScale - deltaY / 100 this.ds.changeScale(scale, [ - this.ds.element.width / 2, - this.ds.element.height / 2 + self.zoom_drag_start[0], + self.zoom_drag_start[1] ]) this.graph.change()