Simplify lightbox

This commit is contained in:
2026-05-04 00:04:07 +02:00
parent a4e0a345d6
commit b759508779
4 changed files with 118 additions and 128 deletions

View File

@@ -4,7 +4,7 @@ import { Map, NavigationControl, Marker, LngLatBounds, LngLat, Popup } from 'map
import { createApp, ref, provide, inject } from 'vue';
import Simplebar from 'simplebar-vue';
import lightbox from '@scripts/lightbox';
import Lightbox from '@scripts/lightbox';
import { getOuterWidth } from '@scripts/common';
import SpotIcon from '@components/spotIcon';
@@ -44,6 +44,7 @@ export default {
baseMaps: {},
baseMap: null,
map: null,
lightbox: null,
hikes: {
colors:{'main':'#00ff78', 'off-track':'#0000ff', 'hitchhiking':'#FF7814'},
width: 4
@@ -120,9 +121,8 @@ export default {
*/
},
async init() {
let bFirstLoad = (typeof this.currProject.codename == 'undefined');
this.initProject();
if(bFirstLoad) this.initLightbox();
this.initLightbox();
await Promise.all([
this.initFeed(),
@@ -133,7 +133,7 @@ export default {
if(this.hash.items.length == 3) await this.findPost(this.hash.items[1], this.hash.items[2]);
},
quit() {
lightbox.end();
this.lightbox?.end();
this.$refs.feedSimpleBar.scrollElement.removeEventListener('scroll', this.onFeedScroll);
this.setFeedUpdateTimer(-1);
this.map.remove();
@@ -147,7 +147,7 @@ export default {
this.baseMaps = {};
},
initLightbox() {
lightbox.option({
this.lightbox = new Lightbox({
alwaysShowNavOnTouchDevices: true,
albumLabel: 'Media %1 / %2',
fadeDuration: 300,