Change class name for coherence

This commit is contained in:
artisticMink 2023-11-06 17:20:18 +01:00
parent a0f828a2da
commit dbc7f460e4
2 changed files with 13 additions and 13 deletions

View File

@ -246,7 +246,7 @@ class BulkTagPopupHandler {
} }
} }
class CharacterGroupOverlayState { class BulkEditOverlayState {
/** /**
* *
* @type {number} * @type {number}
@ -278,7 +278,7 @@ class BulkEditOverlay {
static longPressDelay = 2800; static longPressDelay = 2800;
#state = CharacterGroupOverlayState.browse; #state = BulkEditOverlayState.browse;
#longPress = false; #longPress = false;
#stateChangeCallbacks = []; #stateChangeCallbacks = [];
#selectedCharacters = []; #selectedCharacters = [];
@ -336,12 +336,12 @@ class BulkEditOverlay {
/** /**
* Set the overlay to browse mode * Set the overlay to browse mode
*/ */
browseState = () => this.state = CharacterGroupOverlayState.browse; browseState = () => this.state = BulkEditOverlayState.browse;
/** /**
* Set the overlay to select mode * Set the overlay to select mode
*/ */
selectState = () => this.state = CharacterGroupOverlayState.select; selectState = () => this.state = BulkEditOverlayState.select;
/** /**
* Set up a Sortable grid for the loaded page * Set up a Sortable grid for the loaded page
@ -368,7 +368,7 @@ class BulkEditOverlay {
*/ */
handleStateChange = () => { handleStateChange = () => {
switch (this.state) { switch (this.state) {
case CharacterGroupOverlayState.browse: case BulkEditOverlayState.browse:
this.container.classList.remove(BulkEditOverlay.selectModeClass); this.container.classList.remove(BulkEditOverlay.selectModeClass);
this.#enableClickEventsForCharacters(); this.#enableClickEventsForCharacters();
this.clearSelectedCharacters(); this.clearSelectedCharacters();
@ -376,7 +376,7 @@ class BulkEditOverlay {
this.#disableBulkEditButtonHighlight(); this.#disableBulkEditButtonHighlight();
CharacterContextMenu.hide(); CharacterContextMenu.hide();
break; break;
case CharacterGroupOverlayState.select: case BulkEditOverlayState.select:
this.container.classList.add(BulkEditOverlay.selectModeClass); this.container.classList.add(BulkEditOverlay.selectModeClass);
this.#disableClickEventsForCharacters(); this.#disableClickEventsForCharacters();
this.enableContextMenu(); this.enableContextMenu();
@ -415,9 +415,9 @@ class BulkEditOverlay {
this.isLongPress = true; this.isLongPress = true;
setTimeout(() => { setTimeout(() => {
if (this.isLongPress) { if (this.isLongPress) {
if (this.state === CharacterGroupOverlayState.browse) if (this.state === BulkEditOverlayState.browse)
this.selectState(); this.selectState();
else if (this.state === CharacterGroupOverlayState.select) else if (this.state === BulkEditOverlayState.select)
CharacterContextMenu.show(...this.#getContextMenuPosition(event)); CharacterContextMenu.show(...this.#getContextMenuPosition(event));
} }
}, BulkEditOverlay.longPressDelay); }, BulkEditOverlay.longPressDelay);
@ -428,7 +428,7 @@ class BulkEditOverlay {
} }
handleCancelClick = () => { handleCancelClick = () => {
this.state = CharacterGroupOverlayState.browse; this.state = BulkEditOverlayState.browse;
} }
/** /**
@ -563,4 +563,4 @@ class BulkEditOverlay {
} }
} }
export {CharacterGroupOverlayState, CharacterContextMenu, BulkEditOverlay}; export {BulkEditOverlayState, CharacterContextMenu, BulkEditOverlay};

View File

@ -1,5 +1,5 @@
import { characters, getCharacters, handleDeleteCharacter, callPopup } from "../script.js"; import { characters, getCharacters, handleDeleteCharacter, callPopup } from "../script.js";
import {BulkEditOverlay, CharacterGroupOverlayState} from "./BulkEditOverlay.js"; import {BulkEditOverlay, BulkEditOverlayState} from "./BulkEditOverlay.js";
let is_bulk_edit = false; let is_bulk_edit = false;
@ -29,8 +29,8 @@ const toggleBulkEditMode = (isBulkEdit) => {
} }
(new BulkEditOverlay()).addStateChangeCallback((state) => { (new BulkEditOverlay()).addStateChangeCallback((state) => {
if (state === CharacterGroupOverlayState.select) enableBulkEdit(); if (state === BulkEditOverlayState.select) enableBulkEdit();
if (state === CharacterGroupOverlayState.browse) disableBulkEdit(); if (state === BulkEditOverlayState.browse) disableBulkEdit();
}); });
/** /**