aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-09-26 17:51:52 -0400
committerGitHub <noreply@github.com>2020-09-26 17:51:52 -0400
commitc1b59763941a74367b81e9b8329319f1ede72317 (patch)
tree959a0dbaaa6682bfd5bc5430fcfb77b21c5e97d3
parentf18c28e519e86cb0bd240fbf20b907ef1a9e7f14 (diff)
Scanning mouse button fixes (#866)
* Move mouse0 blocking during mousemove into options * Update primary button detection
-rw-r--r--ext/bg/data/options-schema.json2
-rw-r--r--ext/bg/js/options.js2
-rw-r--r--ext/mixed/js/document-util.js10
-rw-r--r--ext/mixed/js/text-scanner.js6
-rw-r--r--test/test-options-util.js2
5 files changed, 4 insertions, 18 deletions
diff --git a/ext/bg/data/options-schema.json b/ext/bg/data/options-schema.json
index 71d5e7db..2e324984 100644
--- a/ext/bg/data/options-schema.json
+++ b/ext/bg/data/options-schema.json
@@ -343,7 +343,7 @@
"default": [
{
"include": "shift",
- "exclude": "",
+ "exclude": "mouse0",
"types": {
"mouse": true,
"touch": false,
diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js
index 5b61b870..f9571ec2 100644
--- a/ext/bg/js/options.js
+++ b/ext/bg/js/options.js
@@ -550,7 +550,7 @@ class OptionsUtil {
}
scanningInputs.push({
include: modifierInput,
- exclude: '',
+ exclude: 'mouse0',
types: {mouse: true, touch: false, pen: false},
options: createInputDefaultOptions()
});
diff --git a/ext/mixed/js/document-util.js b/ext/mixed/js/document-util.js
index d448fc3c..90add8f9 100644
--- a/ext/mixed/js/document-util.js
+++ b/ext/mixed/js/document-util.js
@@ -169,16 +169,6 @@ class DocumentUtil {
}
}
- static isMouseButtonDown(mouseEvent, button) {
- const mouseEventButtons = mouseEvent.buttons;
- switch (button) {
- case 'primary': return (mouseEventButtons & 0x1) !== 0x0;
- case 'secondary': return (mouseEventButtons & 0x2) !== 0x0;
- case 'auxiliary': return (mouseEventButtons & 0x4) !== 0x0;
- default: return false;
- }
- }
-
static getActiveModifiers(event) {
const modifiers = new Set();
if (event.altKey) { modifiers.add('alt'); }
diff --git a/ext/mixed/js/text-scanner.js b/ext/mixed/js/text-scanner.js
index f38ca1de..aacc683a 100644
--- a/ext/mixed/js/text-scanner.js
+++ b/ext/mixed/js/text-scanner.js
@@ -267,10 +267,6 @@ class TextScanner extends EventDispatcher {
_onMouseMove(e) {
this._scanTimerClear();
- if (DocumentUtil.isMouseButtonDown(e, 'primary')) {
- return;
- }
-
const inputInfo = this._getMatchingInputGroupFromEvent(e, 'mouse');
if (inputInfo === null) { return; }
@@ -286,7 +282,7 @@ class TextScanner extends EventDispatcher {
return false;
}
- if (DocumentUtil.isMouseButtonDown(e, 'primary')) {
+ if (e.button === 0) { // Primary
this._scanTimerClear();
this.clearSelection(false);
}
diff --git a/test/test-options-util.js b/test/test-options-util.js
index 67dc57b7..3c6e8733 100644
--- a/test/test-options-util.js
+++ b/test/test-options-util.js
@@ -319,7 +319,7 @@ function createProfileOptionsUpdatedTestData1() {
inputs: [
{
include: 'shift',
- exclude: '',
+ exclude: 'mouse0',
types: {
mouse: true,
touch: false,