updated card caching for frames
This commit is contained in:
+8
-2
@@ -106,6 +106,9 @@
|
|||||||
fit: "inside",
|
fit: "inside",
|
||||||
quality: 82
|
quality: 82
|
||||||
};
|
};
|
||||||
|
const defaultDeckWarmupOptions = {
|
||||||
|
includeThumbnails: true
|
||||||
|
};
|
||||||
const standardMajorCardNames = [
|
const standardMajorCardNames = [
|
||||||
"Fool",
|
"Fool",
|
||||||
"Magus",
|
"Magus",
|
||||||
@@ -1202,7 +1205,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function scheduleDeckImagePreload(deckId, options = {}) {
|
function scheduleDeckImagePreload(deckId, options = {}) {
|
||||||
return deferPreload(() => preloadDeckImages(deckId, options));
|
return deferPreload(() => preloadDeckImages(deckId, {
|
||||||
|
...defaultDeckWarmupOptions,
|
||||||
|
...options
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveDisplayNameWithDeck(deckId, cardName, trumpNumber) {
|
function resolveDisplayNameWithDeck(deckId, cardName, trumpNumber) {
|
||||||
@@ -1289,7 +1295,7 @@
|
|||||||
function setActiveDeck(deckId) {
|
function setActiveDeck(deckId) {
|
||||||
activeDeckId = normalizeDeckId(deckId);
|
activeDeckId = normalizeDeckId(deckId);
|
||||||
getDeckManifest(activeDeckId);
|
getDeckManifest(activeDeckId);
|
||||||
const preloadUrls = buildDeckImagePreloadUrls(activeDeckId);
|
const preloadUrls = buildDeckImagePreloadUrls(activeDeckId, defaultDeckWarmupOptions);
|
||||||
const totalCount = preloadUrls.length;
|
const totalCount = preloadUrls.length;
|
||||||
const isWarmed = deckPreloadStatus.warmedDeckIds.includes(activeDeckId);
|
const isWarmed = deckPreloadStatus.warmedDeckIds.includes(activeDeckId);
|
||||||
setDeckPreloadStatus({
|
setDeckPreloadStatus({
|
||||||
|
|||||||
@@ -4213,11 +4213,12 @@
|
|||||||
|
|
||||||
const imageSrc = resolveCardThumbnail(card);
|
const imageSrc = resolveCardThumbnail(card);
|
||||||
if (showImage && imageSrc) {
|
if (showImage && imageSrc) {
|
||||||
|
const imageCached = tarotCardImages.isImageLoaded?.(imageSrc) === true;
|
||||||
const image = document.createElement("img");
|
const image = document.createElement("img");
|
||||||
image.className = "tarot-frame-card-image";
|
image.className = "tarot-frame-card-image";
|
||||||
image.src = imageSrc;
|
image.src = imageSrc;
|
||||||
image.alt = getDisplayCardName(card);
|
image.alt = getDisplayCardName(card);
|
||||||
image.loading = "lazy";
|
image.loading = imageCached ? "eager" : "lazy";
|
||||||
image.decoding = "async";
|
image.decoding = "async";
|
||||||
image.draggable = false;
|
image.draggable = false;
|
||||||
button.appendChild(image);
|
button.appendChild(image);
|
||||||
|
|||||||
Reference in New Issue
Block a user