Skip to content
This repository has been archived by the owner on Feb 25, 2023. It is now read-only.

Scanning mouse button fixes #866

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/bg/data/options-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@
"default": [
{
"include": "shift",
"exclude": "",
"exclude": "mouse0",
"types": {
"mouse": true,
"touch": false,
Expand Down
2 changes: 1 addition & 1 deletion ext/bg/js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ class OptionsUtil {
}
scanningInputs.push({
include: modifierInput,
exclude: '',
exclude: 'mouse0',
types: {mouse: true, touch: false, pen: false},
options: createInputDefaultOptions()
});
Expand Down
10 changes: 0 additions & 10 deletions ext/mixed/js/document-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'); }
Expand Down
6 changes: 1 addition & 5 deletions ext/mixed/js/text-scanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand All @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion test/test-options-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ function createProfileOptionsUpdatedTestData1() {
inputs: [
{
include: 'shift',
exclude: '',
exclude: 'mouse0',
types: {
mouse: true,
touch: false,
Expand Down