diff --git a/app/modifiers/ui_select.js b/app/modifiers/ui_select.js index 77fe62ce26f2fdd98fdd8437f0eed552b37c9b70..8bb30cf5fca646466d90d8c4e2e563bd8019b8e6 100644 --- a/app/modifiers/ui_select.js +++ b/app/modifiers/ui_select.js @@ -9,6 +9,16 @@ class UISelect { Desktop like select **/ + get DRAG_THRESHOLD() { + /* + Some mouse clicks are acompanied by slight mouse movements, which + makes 'clicks' look like mouse drag events. In order the avoid + this confusion, DRAG_THRESHOLD is introduced. Any rectangle with + height or width < DRAG_THRESHOLD will be discarded. + */ + return 5; + } + constructor(parent_selector) { /*** x, y coordinates where selection started. @@ -77,6 +87,11 @@ class UISelect { new Rectangle(left, top, width, height) ); + if (width < this.DRAG_THRESHOLD && height < this.DRAG_THRESHOLD) { + console.log('Not passing DRAG_THRESHOLD. Ignored.'); + return; + } + this.select_nodes(selected_nodes); this.unselect_nodes(unselected_nodes); }