From 7df7e1b2bf475edd771a73a950004ab8d5f85ccb Mon Sep 17 00:00:00 2001 From: Kuuuube <61125188+Kuuuube@users.noreply.github.com> Date: Sun, 14 Apr 2024 12:48:25 -0400 Subject: Add scanOnTouchTap and improve touch scanning defaults (#791) * Add scanOnTouchTap * Update version to 30 * Cleanup if statement --- ext/js/data/options-util.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'ext/js/data') diff --git a/ext/js/data/options-util.js b/ext/js/data/options-util.js index af81f29e..4e468aea 100644 --- a/ext/js/data/options-util.js +++ b/ext/js/data/options-util.js @@ -535,7 +535,8 @@ export class OptionsUtil { this._updateVersion26, this._updateVersion27, this._updateVersion28, - this._updateVersion29 + this._updateVersion29, + this._updateVersion30 ]; /* eslint-enable @typescript-eslint/unbound-method */ if (typeof targetVersion === 'number' && targetVersion < result.length) { @@ -605,7 +606,7 @@ export class OptionsUtil { showAdvanced: false, searchTerms: true, searchKanji: true, - scanOnTouchMove: true, + scanOnTouchMove: false, scanOnPenHover: true, scanOnPenPress: true, scanOnPenRelease: false, @@ -1217,6 +1218,20 @@ export class OptionsUtil { await this._applyAnkiFieldTemplatesPatch(options, '/data/templates/anki-field-templates-upgrade-v29.handlebars'); } + /** + * - Added scanning.inputs[].options.scanOnTouchTap. + * - Set touch settings to be more sensible. + * @type {import('options-util').UpdateFunction} + */ + async _updateVersion30(options) { + for (const profile of options.profiles) { + for (const input of profile.options.scanning.inputs) { + input.options.scanOnTouchTap = true; + input.options.scanOnTouchPress = false; + input.options.scanOnTouchRelease = false; + } + } + } /** * @param {string} url -- cgit v1.2.3