git.lucas.co / cce-designer
graphic design tool
git clone https://git.lucas.co/cce-designer.git

commit2fe5a4487707674f93acb46365b2d617b59582a4
parent1229b14f55
authorLucas Galante <[email protected]>
date2026-07-01 17:35
Fix scroll lock logic by tracking scroll gesture state in app.rs

 src/app.rs | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/app.rs b/src/app.rs
index 2fb6a99..639a8cf 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -4045,6 +4045,21 @@ pub(crate) fn geometry_to_spreadsheet_data(geom: &Geometry) -> (Vec<String>, Vec
                 let mut needs_sync_grid = false;
                 if !dialog_open && !self.modifiers.control_key() {
                     let ctx = &mut self.ui_context;
+                    let now = std::time::Instant::now();
+                    let elapsed_ms = match ctx.last_scroll_time {
+                        None => 999999,
+                        Some(last) => now.duration_since(last).as_millis(),
+                    };
+                    if elapsed_ms >= 5 {
+                        let is_new_gesture = elapsed_ms > 250;
+                        if is_new_gesture {
+                            ctx.scroll_initiate_widget_id = None;
+                            ctx.scroll_gesture_new = true;
+                        } else {
+                            ctx.scroll_gesture_new = false;
+                        }
+                        ctx.last_scroll_time = Some(now);
+                    }
                     for (i, w) in self.widgets.iter_mut().enumerate() {
                         if w.mouse_wheel(delta, self.cursor_x, self.cursor_y, ctx) {
                             handled = true;