1
0
mirror of https://github.com/koloml/furbooru-tagging-assistant.git synced 2025-12-24 07:12:57 +00:00

Keep the current URIs and switch them when size is changed

This commit is contained in:
2024-12-30 23:08:06 +04:00
parent 757526ab52
commit 309dd15598

View File

@@ -17,6 +17,8 @@ export class FullscreenViewer extends BaseComponent {
/** @type {boolean|null} */
#isClosingSwipeStarted = null;
#isSizeFetched = false;
/** @type {App.ImageURIs|null} */
#currentURIs = null;
/**
* @protected
@@ -210,6 +212,10 @@ export class FullscreenViewer extends BaseComponent {
this.#sizeSelectorElement.addEventListener('input', () => {
const targetSize = this.#sizeSelectorElement.value;
if (this.#currentURIs) {
void this.show(this.#currentURIs);
}
if (!targetSize || targetSize === lastActiveSize || !(targetSize in FullscreenViewer.#previewSizes)) {
return;
}
@@ -220,6 +226,8 @@ export class FullscreenViewer extends BaseComponent {
}
#close() {
this.#currentURIs = null;
this.container.classList.remove(FullscreenViewer.#shownState);
document.body.style.overflow = null;
@@ -260,6 +268,8 @@ export class FullscreenViewer extends BaseComponent {
* @param {App.ImageURIs} imageUris
*/
async show(imageUris) {
this.#currentURIs = imageUris;
const url = await this.#resolveCurrentSelectedSizeUrl(imageUris);
if (!url) {