Scanning mouse button fixes (#866)

* Move mouse0 blocking during mousemove into options

* Update primary button detection
This commit is contained in:
toasted-nutbread 2020-09-26 17:51:52 -04:00 committed by GitHub
parent f18c28e519
commit c1b5976394
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 4 additions and 18 deletions

View File

@ -343,7 +343,7 @@
"default": [ "default": [
{ {
"include": "shift", "include": "shift",
"exclude": "", "exclude": "mouse0",
"types": { "types": {
"mouse": true, "mouse": true,
"touch": false, "touch": false,

View File

@ -550,7 +550,7 @@ class OptionsUtil {
} }
scanningInputs.push({ scanningInputs.push({
include: modifierInput, include: modifierInput,
exclude: '', exclude: 'mouse0',
types: {mouse: true, touch: false, pen: false}, types: {mouse: true, touch: false, pen: false},
options: createInputDefaultOptions() options: createInputDefaultOptions()
}); });

View File

@ -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) { static getActiveModifiers(event) {
const modifiers = new Set(); const modifiers = new Set();
if (event.altKey) { modifiers.add('alt'); } if (event.altKey) { modifiers.add('alt'); }

View File

@ -267,10 +267,6 @@ class TextScanner extends EventDispatcher {
_onMouseMove(e) { _onMouseMove(e) {
this._scanTimerClear(); this._scanTimerClear();
if (DocumentUtil.isMouseButtonDown(e, 'primary')) {
return;
}
const inputInfo = this._getMatchingInputGroupFromEvent(e, 'mouse'); const inputInfo = this._getMatchingInputGroupFromEvent(e, 'mouse');
if (inputInfo === null) { return; } if (inputInfo === null) { return; }
@ -286,7 +282,7 @@ class TextScanner extends EventDispatcher {
return false; return false;
} }
if (DocumentUtil.isMouseButtonDown(e, 'primary')) { if (e.button === 0) { // Primary
this._scanTimerClear(); this._scanTimerClear();
this.clearSelection(false); this.clearSelection(false);
} }

View File

@ -319,7 +319,7 @@ function createProfileOptionsUpdatedTestData1() {
inputs: [ inputs: [
{ {
include: 'shift', include: 'shift',
exclude: '', exclude: 'mouse0',
types: { types: {
mouse: true, mouse: true,
touch: false, touch: false,