From a32b134ebae46eb014713c63d5655ff9be6a5eec Mon Sep 17 00:00:00 2001 From: Danila Poyarkov Date: Tue, 3 Mar 2026 11:44:31 +0300 Subject: [PATCH] Improve zoom smoothness, add absolute position cache (#21) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Improve trackpad pinch-zoom smoothness - Replace Math.pow(0.99, delta) with Math.exp(-delta/100) zoom curve for natural, symmetric scaling that handles both tiny trackpad deltas and large mouse wheel jumps gracefully - Normalize wheel deltaMode (LINE → 40px, PAGE → 800px) so external mice on Firefox produce consistent zoom behavior - Clamp per-flush scale factor to 0.75–1.25 to prevent jarring jumps from discrete mouse wheel ticks * Add per-frame absolute position cache for SceneGraph --- CHANGELOG.md | 1 + packages/core/src/renderer.ts | 4 +- packages/core/src/scene-graph.ts | 15 ++++- src/composables/use-canvas-input.ts | 21 ++++++- src/constants.ts | 9 ++- src/stores/editor.ts | 9 ++- tests/engine/abspos-cache.test.ts | 88 +++++++++++++++++++++++++++++ 7 files changed, 139 insertions(+), 8 deletions(-) create mode 100644 tests/engine/abspos-cache.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 2342187c6..9a7d70ac7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ ### UI - Replace all native `