From 6a8afcc20ae6333c14747dccea5c048e35be334f Mon Sep 17 00:00:00 2001 From: abakkk Date: Mon, 31 Aug 2020 14:03:24 +0200 Subject: [PATCH] use timestamps instead of Math.random in elementGrabber --- area.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/area.js b/area.js index 5bbeb5c..06198bd 100644 --- a/area.js +++ b/area.js @@ -45,6 +45,7 @@ const _ = imports.gettext.domain(Me.metadata['gettext-domain']).gettext; const CAIRO_DEBUG_EXTENDS = false; const SVG_DEBUG_EXTENDS = false; const TEXT_CURSOR_TIME = 600; // ms +const ELEMENT_GRABBER_TIME = 80; // ms, default is about 16 ms const GRID_TILES_HORIZONTAL_NUMBER = 30; const { Shapes, ShapeNames, Transformations, LineCapNames, LineJoinNames, FillRuleNames, FontWeightNames, FontStyleNames } = Elements; @@ -434,8 +435,9 @@ var DrawingArea = new Lang.Class({ } // Reduce computing without notable effect. - if (Math.random() <= 0.75) + if (event.get_time() - (this.elementGrabberTimestamp || 0) < ELEMENT_GRABBER_TIME) return; + this.elementGrabberTimestamp = event.get_time(); let coords = event.get_coords(); let [s, x, y] = this.transform_stage_point(coords[0], coords[1]);