From bdaa77ff0d7c23f1594575ac22fb9693f1802b24 Mon Sep 17 00:00:00 2001 From: Cashew <52880648+Scrub1492@users.noreply.github.com> Date: Mon, 25 Dec 2023 17:13:34 +0900 Subject: Narrow down enum types (#431) * narrow down enum types * add enum types * change from default to case * add enum types * remove comments * remove comments * fix * Move getErrorLevelValue to Logger * Add enum type for LogErrorLevelValue * add eslint switch-exhaustiveness-check rule * Revert "add eslint switch-exhaustiveness-check" This reverts commit 49f9caabf0af900bc5ba2b80f5baff72c27e02cd. * move from labelled loop to helper functions * move helper functions downward --- ext/js/language/text-scanner.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'ext/js/language') diff --git a/ext/js/language/text-scanner.js b/ext/js/language/text-scanner.js index 800e3697..164e150e 100644 --- a/ext/js/language/text-scanner.js +++ b/ext/js/language/text-scanner.js @@ -137,8 +137,8 @@ export class TextScanner extends EventDispatcher { this._preventNextClick = false; /** @type {boolean} */ this._preventScroll = false; - /** @type {0|1|2|3} */ - this._penPointerState = 0; // 0 = not active; 1 = hovering; 2 = touching; 3 = hovering after touching + /** @type {import('text-scanner').PenPointerState} */ + this._penPointerState = 0; /** @type {Map} */ this._pointerIdTypeMap = new Map(); @@ -1382,13 +1382,13 @@ export class TextScanner extends EventDispatcher { return input.scanOnPenRelease; } switch (this._penPointerState) { - case 1: // hovering + case 1: return input.scanOnPenHover; - case 2: // touching + case 2: return input.scanOnPenMove; - case 3: // hovering after touching + case 3: return input.scanOnPenReleaseHover; - default: // not active + case 0: return false; } } -- cgit v1.2.3