forked from 1b-agent/opencadstudio-upstream
fix(selection): prevent incidental mouse motion from starting lasso
This commit is contained in:
1 parent
0004113e0a
commit
8ebe3fc89f
1 file changed
+11
-6
@@ -1323,12 +1323,17 @@ impl OpenCADStudio {
|
|||||||
.left_press_time
|
.left_press_time
|
||||||
.map(|t| Instant::now().duration_since(t).as_millis())
|
.map(|t| Instant::now().duration_since(t).as_millis())
|
||||||
.unwrap_or(u128::MAX);
|
.unwrap_or(u128::MAX);
|
||||||
// The delay keeps a click made while the mouse is still moving
|
// Selection gestures need a wider dead zone than ordinary
|
||||||
// from turning into a drag; a press that has already travelled
|
// pointer clicks. In particular, a quick press/release with
|
||||||
// well past click jitter is a drag at once, or a fast flick
|
// residual mouse motion must not start a freeform lasso.
|
||||||
// released inside the delay read as a click. (#1808)
|
// Keep the existing delay and reserve immediate dragging for
|
||||||
let dragged =
|
// an unmistakable movement (24 px); after the delay, require
|
||||||
dist2 > 9.0 && (elapsed_ms >= POLY_START_DELAY_MS || dist2 > DRAG_START_FAST_PX2);
|
// at least 12 px. Grip editing follows its separate path.
|
||||||
|
const SELECTION_DRAG_MIN_PX2: f32 = 12.0 * 12.0;
|
||||||
|
const SELECTION_DRAG_FAST_PX2: f32 = 24.0 * 24.0;
|
||||||
|
let dragged = dist2 > SELECTION_DRAG_MIN_PX2
|
||||||
|
&& (elapsed_ms >= POLY_START_DELAY_MS
|
||||||
|
|| dist2 > SELECTION_DRAG_FAST_PX2);
|
||||||
if !sel.input.left_dragging && dragged {
|
if !sel.input.left_dragging && dragged {
|
||||||
sel.input.left_dragging = true;
|
sel.input.left_dragging = true;
|
||||||
if self.pick_drag_rect {
|
if self.pick_drag_rect {
|
||||||
|
|||||||
Reference in new issue
Block a user