From 9b666caf207cc4527e3c9446ba5d2805321c6a21 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Thu, 20 Jan 2022 18:32:43 +0100 Subject: [PATCH] feat(diagram): fixes for zoom --- packages/web/src/designer/Designer.svelte | 22 ++++++++++--------- .../web/src/designer/DesignerTable.svelte | 5 +++-- packages/web/src/utility/moveDrag.ts | 12 +++++++--- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/packages/web/src/designer/Designer.svelte b/packages/web/src/designer/Designer.svelte index 4e6a0b61..9c0676a7 100644 --- a/packages/web/src/designer/Designer.svelte +++ b/packages/web/src/designer/Designer.svelte @@ -70,6 +70,7 @@ $: tables = value?.tables as any[]; $: references = value?.references as any[]; + $: zoomKoef = settings?.customizeStyle && value?.style?.zoomKoef ? value?.style?.zoomKoef : 1; $: isMultipleTableSelection = tables.filter(x => x.isSelectedTable).length >= 2; @@ -580,10 +581,10 @@ }; const handleMoveStart = (x, y) => { - dragStartPoint = { x, y }; + dragStartPoint = { x: x / zoomKoef, y: y / zoomKoef }; }; const handleMove = (dx, dy, x, y) => { - dragCurrentPoint = { x, y }; + dragCurrentPoint = { x: x / zoomKoef, y: y / zoomKoef }; }; const handleMoveEnd = (x, y) => { if (dragStartPoint && dragCurrentPoint) { @@ -857,6 +858,7 @@ {table} {conid} {database} + {zoomKoef} {isMultipleTableSelection} onChangeTable={changeTable} onBringToFront={bringToFront} @@ -872,21 +874,21 @@ {settings} /> {/each} - - {#if dragStartPoint && dragCurrentPoint} - - + - - {/if} + /> + + {/if} +