From 8061d978655ffee05ff6755014d72d580f63fb22 Mon Sep 17 00:00:00 2001 From: Lumi Pakkanen Date: Wed, 5 Jun 2024 18:45:00 +0300 Subject: [PATCH] Automatically infer good lattice configuration Inspect scale contents to figure out good initial lattice configuration. ref #680 --- src/components/GridLattice.vue | 13 +++- src/stores/grid.ts | 62 ++++++++++++++++- src/stores/state.ts | 2 +- src/views/LatticeView.vue | 121 +++++++++++++++++++++++++++++++-- 4 files changed, 187 insertions(+), 11 deletions(-) diff --git a/src/components/GridLattice.vue b/src/components/GridLattice.vue index 30ec36e9..cc04cbd7 100644 --- a/src/components/GridLattice.vue +++ b/src/components/GridLattice.vue @@ -92,7 +92,18 @@ watch(svgElement, (element) => { observer.observe(element) }) -watch(() => store.modulus, computeExtent) +watch( + () => [ + store.viewScale, + store.minX, + store.maxX, + store.minY, + store.maxY, + store.viewCenterX, + store.viewCenterY + ], + computeExtent +)