Fix direct link to post

This commit is contained in:
2026-04-17 23:45:17 +02:00
parent 3416ace4ee
commit fcbb3d9d14

View File

@@ -125,12 +125,18 @@ export default {
this.quit(); this.quit();
}, },
methods: { methods: {
init() { async init() {
let bFirstLoad = (typeof this.currProject.codename == 'undefined'); let bFirstLoad = (typeof this.currProject.codename == 'undefined');
this.initProject(); this.initProject();
if(bFirstLoad) this.initLightbox(); if(bFirstLoad) this.initLightbox();
this.initFeed();
this.initMap(); await Promise.all([
this.initFeed(),
this.initMap()
]);
//Direct link: Scroll to post
if(this.$parent.hash.items.length == 3) this.findPost({type: this.$parent.hash.items[1], id: this.$parent.hash.items[2]});
}, },
quit() { quit() {
lightbox.end(); lightbox.end();
@@ -176,9 +182,6 @@ export default {
await this.getNextFeed(); await this.getNextFeed();
this.$refs.feedSimpleBar.scrollElement.scrollTop = 0; this.$refs.feedSimpleBar.scrollElement.scrollTop = 0;
//Scroll to post
if(this.$parent.hash.items.length == 3) this.findPost({type: this.$parent.hash.items[1], id: this.$parent.hash.items[2]});
//Start auto-update //Start auto-update
if(!this.modeHisto) this.setFeedUpdateTimer(this.refreshRate); if(!this.modeHisto) this.setFeedUpdateTimer(this.refreshRate);
}, },
@@ -223,7 +226,12 @@ export default {
attributionControl: false attributionControl: false
}); });
this.map.once('load', async () => { //Force wait for load event
await new Promise((resolve) => {
if(this.map.loaded()) resolve();
else this.map.once('load', resolve);
});
//Default Basemap //Default Basemap
this.baseMap = this.baseMaps.filter((asBM) => asBM.default_map)[0].codename; this.baseMap = this.baseMaps.filter((asBM) => asBM.default_map)[0].codename;
@@ -316,11 +324,11 @@ export default {
//Toggle only when map is ready, for the tilt effet //Toggle only when map is ready, for the tilt effet
this.toggleFeedPanel(bOpenFeedPanel); this.toggleFeedPanel(bOpenFeedPanel);
//Force wait for idle event
await new Promise((resolve) => {
this.map.once('idle', resolve);
}); });
this.map.on('idle', () => { });
//Legend
}, },
convertMsgToFeatures(oMsg) { convertMsgToFeatures(oMsg) {
return oMsg.map(oMsg => ({ return oMsg.map(oMsg => ({
@@ -453,13 +461,14 @@ export default {
}, },
panToBetweenPanels(oLngLat, iZoom, fCallback) { panToBetweenPanels(oLngLat, iZoom, fCallback) {
const iXOffset = (this.settingsPanelOpen?getOuterWidth(this.$refs.settings):0) - (this.feedPanelOpen?getOuterWidth(this.$refs.feed):0); const iXOffset = (this.settingsPanelOpen?getOuterWidth(this.$refs.settings):0) - (this.feedPanelOpen?getOuterWidth(this.$refs.feed):0);
this.map.once('moveend', fCallback);
this.map.easeTo({ this.map.easeTo({
center: oLngLat, center: oLngLat,
zoom: iZoom, zoom: iZoom,
offset: [iXOffset / 2, 0], offset: [iXOffset / 2, 0],
duration: 500 duration: 500
}); });
setTimeout(fCallback, 500);
}, },
isMarkerVisible(oLngLat){ isMarkerVisible(oLngLat){
return this.map.getBounds().contains(oLngLat); return this.map.getBounds().contains(oLngLat);
@@ -561,7 +570,7 @@ export default {
- parseFloat(getComputedStyle(this.$refs.feedSimpleBar.$el).paddingTop) - parseFloat(getComputedStyle(this.$refs.feedSimpleBar.$el).paddingTop)
); );
aoRefs[0].executeMainAction(); aoRefs[0].executeMainAction();
this.spot.flushHash(['post', 'message']); //this.spot.flushHash(['post', 'message']);
bFound = true; bFound = true;
} }