diff --git a/src/components/project.vue b/src/components/project.vue index c1a4d3a..bfd3d8e 100644 --- a/src/components/project.vue +++ b/src/components/project.vue @@ -129,9 +129,16 @@ export default { positionFromTop: 0, resizeDuration: 400, hasVideo: true, - onMediaChange: (oMedia) => { + onMediaChange: async (oMedia) => { this.hash.items = [this.currProject.codename, 'media', oMedia.id]; - if(oMedia.set == 'post-medias') this.goToPost('media', oMedia.id)?.panMapToMarker(); + if(oMedia.set == 'post-medias') { + this.goToPost('media', oMedia.id)?.panMapToMarker(); + if(!this.lightbox.hasMediaAfterCurrent()) { + await this.getNextFeed(); + await this.$nextTick(); + this.lightbox.refreshAlbum(); + } + } }, onClosing: () => {this.hash.items = [this.hash.items[0]];} }); @@ -464,6 +471,10 @@ export default { const iXOffset = (this.settingsPanelOpen?getOuterWidth(this.$refs.settings):0) - (this.feedPanelOpen?getOuterWidth(this.$refs.feed):0); return new Promise((resolve) => { + if(!this.map) { + resolve(); + return; + } this.map.once('moveend', resolve); this.map.easeTo({ center: oLngLat, @@ -474,7 +485,7 @@ export default { }); }, isMarkerVisible(oLngLat){ - return this.map.getBounds().contains(oLngLat); + return !!this.map && this.map.getBounds().contains(oLngLat); }, getGoogleMapsLink(asInfo) { return $('', { diff --git a/src/scripts/lightbox.js b/src/scripts/lightbox.js index def2c20..dfa4850 100644 --- a/src/scripts/lightbox.js +++ b/src/scripts/lightbox.js @@ -55,51 +55,51 @@ export default class Lightbox { } onBodyClick(event) { - const link = event.target.closest('a[rel^="lightbox"], area[rel^="lightbox"], a[data-lightbox], area[data-lightbox]'); + const link = event.target.closest('a[data-lightbox], area[data-lightbox]'); if (!link) return; event.preventDefault(); this.start(link); } - renderIcon(name) { - return icon(getIcon(name), {classes: ['spot-icon', name]}).html; + renderIcon(name, sClass=null) { + return icon(getIcon(name), {classes: ['spot-icon', name, sClass]}).html; } build() { if (!document.getElementById('lightbox')) { const wrapper = document.createElement('div'); wrapper.innerHTML = ` -
-