From fbf6cfac9535645119c03913aae0f649ebfa4be6 Mon Sep 17 00:00:00 2001 From: Greg Pomerantz Date: Sat, 9 May 2026 20:04:23 -0400 Subject: [PATCH] Fix ScaleEvent: track prevScale and only send when scale actually changes --- cmd/pad/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/pad/main.go b/cmd/pad/main.go index 812babb..8dd7c05 100644 --- a/cmd/pad/main.go +++ b/cmd/pad/main.go @@ -40,6 +40,8 @@ func run(w *app.Window) error { // Track pixel dimensions from ConfigEvent (for resize handling) var pixelW, pixelH int + // Track previous scale to detect changes + prevScale := float32(1.0) // Create logic instance with initial DP size and scale=1.0 logic := editor.NewLogic(initialDPW, initialDPH) @@ -76,8 +78,9 @@ func run(w *app.Window) error { newScale := gtx.Metric.PxPerDp // If scale changed, send scale event to logic goroutine - if newScale != 1.0 { + if newScale != prevScale { logic.ScaleChan() <- editor.ScaleEvent{Scale: newScale} + prevScale = newScale } // Convert pixel dimensions to DP using actual scale