From a5fbdf8b4f9a8d211089c6b425ac2c939e820b4c Mon Sep 17 00:00:00 2001 From: Dave Patrick Caberto Date: Mon, 12 Feb 2024 17:23:54 +0800 Subject: [PATCH] refactor(area_selector/view_port): make selection size a const --- src/area_selector/view_port.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/area_selector/view_port.rs b/src/area_selector/view_port.rs index 677f6910..180e1b06 100644 --- a/src/area_selector/view_port.rs +++ b/src/area_selector/view_port.rs @@ -22,6 +22,7 @@ use std::{ // * Add minimum selection size. const DEFAULT_SIZE: f64 = 100.0; +const DEFAULT_SELECTION_SIZE: f32 = 40.0; const SHADE_COLOR: gdk::RGBA = gdk::RGBA::new(0.0, 0.0, 0.0, 0.5); @@ -797,7 +798,7 @@ impl ViewPort { && selection.end_x == selection.start_x && selection.end_y == selection.start_y { - let offset = 20.0; + let offset = DEFAULT_SELECTION_SIZE / 2.0; selection.start_x -= offset; selection.start_y -= offset; selection.end_x += offset;