diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-11-18 15:37:42 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-11-18 15:37:42 +0100 |
| commit | d351d8dd915c5075983eaa5cac6f0d5a1b99a877 (patch) | |
| tree | 57a89011f201711a902870f7b9a23426d1d40413 /animism-align/frontend/app/utils/annotation.utils.js | |
| parent | 50411efc89fabb77c02b472446221e6bcd9ff621 (diff) | |
staggered, cancellable preloading of all section image assets, as soon as the section loads
Diffstat (limited to 'animism-align/frontend/app/utils/annotation.utils.js')
| -rw-r--r-- | animism-align/frontend/app/utils/annotation.utils.js | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/animism-align/frontend/app/utils/annotation.utils.js b/animism-align/frontend/app/utils/annotation.utils.js index a055d91..90ac498 100644 --- a/animism-align/frontend/app/utils/annotation.utils.js +++ b/animism-align/frontend/app/utils/annotation.utils.js @@ -72,6 +72,30 @@ export const displayThumbnailURL = media => { } } +export const displayElementImageURL = (element, mediaItem) => { + // console.log(element, mediaItem) + if (!element || !mediaItem) return null + if (mediaItem.type === 'gallery') { + const index = parseInt(element.settings.frame_index) + const frame_id = mediaItem.settings.image_order[index] + const frame = mediaItem.settings.display_lookup[frame_id] + if (!frame) { + console.error("Slide not found:", element.settings.frame_index) + return null + } + return frame.url + } + return mediaItem.settings.display.url +} + +// list all full-size images URLs for the vitrine +export const galleryFullsizeImageURLS = media => { + const { image_order, image_lookup, display_lookup } = media.settings + return image_order.map(id => ( + display_lookup[id] || image_lookup[id] + )).map(img => img.url) +} + export const posterURL = media => { if (!media.settings.video) return null if (media.settings.poster) return media.settings.poster.url @@ -111,7 +135,7 @@ export const makeGalleryItems = (annotation, media) => { if (item.type !== 'gallery') return {} const gallery_items = item.settings.image_order.map((id, index) => { const caption = item.settings.caption_lookup && item.settings.caption_lookup[id] - console.log(caption) + // console.log(caption) return { name: index, label: (index + 1) + ") " + (caption ? (caption.title || "") : "") |
