Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a compatibility setting to disable detection of pen eraser mode #1057

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion src/js/prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ const defaultPrefs = {
skipBlankBoards: true
},

enableBoardAudition: true
enableBoardAudition: true,
disablePenEraserDetection: false
}

// For slow computers, override the defaults here.
Expand Down
5 changes: 3 additions & 2 deletions src/js/window/storyboarder-sketch-pane.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const { LAYER_NAME_BY_INDEX } = require('../constants')
const prefsModule = require('electron').remote.require('./prefs')
const enableBrushCursor = prefsModule.getPrefs('main')['enableBrushCursor']
const enableStabilizer = prefsModule.getPrefs('main')['enableStabilizer']
const disablePenEraserDetection = prefsModule.getPrefs('main')['disablePenEraserDetection']

/**
* Wrap the SketchPane component with features Storyboarder needs
Expand Down Expand Up @@ -790,7 +791,7 @@ class DrawingStrategy {
this.container.isPointerDown = true

// via https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events#Determining_button_states
if (e.buttons == 32 || e.buttons == 2) {
if (!disablePenEraserDetection && (e.buttons == 32 || e.buttons == 2)) {
this.container.isEraseButtonActive = true
} else {
this.container.isEraseButtonActive = false
Expand Down Expand Up @@ -819,7 +820,7 @@ class DrawingStrategy {
this.container.isPointerDown = false

// via https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events#Determining_button_states
if (e.buttons == 32 || e.buttons == 2) {
if (!disablePenEraserDetection && (e.buttons == 32 || e.buttons == 2)) {
this.container.isEraseButtonActive = true
} else {
this.container.isEraseButtonActive = false
Expand Down
17 changes: 17 additions & 0 deletions src/preferences.html
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,23 @@ <h2 class="preferences-subhead">Performance Enhancements</h2>

</div>

<div class="preferences-fieldset">
<h2 class="preferences-subhead">Compatibility settings</h2>
<div class="preferences-hint" style="margin: 0 0 24px">
Advanced settings for compatibility issues with your hardware.
</div>
<div class="preferences-input">
<input
type="checkbox"
name="disablePenEraserDetection"
id="disablePenEraserDetection" />

<label for="disablePenEraserDetection">
<span></span>Disable detection of the eraser mode of your pen
</label>
</div>
</div>

<div id="storyboardersAccount" class="preferences-fieldset">
<div class="preferences-input">
<a id="signOut" class="button" href="#">
Expand Down