Move map with media selection in feed panel
This commit is contained in:
@@ -169,9 +169,6 @@ export default {
|
|||||||
this.api.get('geojson', {id_project: this.currProject.id})
|
this.api.get('geojson', {id_project: this.currProject.id})
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//Get default basemap
|
|
||||||
this.baseMap = this.baseMaps.find((asBM) => asBM.default_map)?.codename ?? null;
|
|
||||||
|
|
||||||
//Build Map
|
//Build Map
|
||||||
if(this.map) this.map.remove();
|
if(this.map) this.map.remove();
|
||||||
this.map = new Map({
|
this.map = new Map({
|
||||||
@@ -195,6 +192,9 @@ export default {
|
|||||||
attributionControl: false
|
attributionControl: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Get default basemap
|
||||||
|
this.baseMap = this.baseMaps.find((asBM) => asBM.default_map)?.codename ?? null;
|
||||||
|
|
||||||
//Force wait for load event
|
//Force wait for load event
|
||||||
await new Promise((resolve) => {
|
await new Promise((resolve) => {
|
||||||
if(this.map.loaded()) resolve();
|
if(this.map.loaded()) resolve();
|
||||||
|
|||||||
@@ -64,14 +64,28 @@
|
|||||||
relTime() {
|
relTime() {
|
||||||
return this.modeHisto?(this.options.formatted_time || '').substr(0, 10):this.options.relative_time;
|
return this.modeHisto?(this.options.formatted_time || '').substr(0, 10):this.options.relative_time;
|
||||||
},
|
},
|
||||||
lngLat() {
|
relatedMarker() {
|
||||||
return (
|
//Find corresponding marker
|
||||||
|
if(!this.options.longitude && !this.options.latitude && this.options.type == 'media') {
|
||||||
|
return this.project.markers.find((marker) => {
|
||||||
|
return (marker.medias || []).some((media) => {
|
||||||
|
return media.id_media == this.options.id_media;
|
||||||
|
});
|
||||||
|
}) || null;
|
||||||
|
}
|
||||||
|
else if(
|
||||||
['message', 'media'].includes(this.options.type)
|
['message', 'media'].includes(this.options.type)
|
||||||
&& this.options.longitude
|
&& this.options.longitude
|
||||||
&& this.options.latitude
|
&& this.options.latitude
|
||||||
)?(new LngLat(this.options.longitude, this.options.latitude)):null;
|
) {
|
||||||
|
return this.options;
|
||||||
|
}
|
||||||
|
else return null;
|
||||||
|
},
|
||||||
|
relatedMarkerLatLng() {
|
||||||
|
let oRelatedMarker = this.relatedMarker;
|
||||||
|
return new LngLat(oRelatedMarker.longitude, oRelatedMarker.latitude);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
inject: ['api', 'lang', 'project', 'user', 'map', 'hash', 'consts', 'isMobile'],
|
inject: ['api', 'lang', 'project', 'user', 'map', 'hash', 'consts', 'isMobile'],
|
||||||
methods: {
|
methods: {
|
||||||
@@ -85,18 +99,23 @@
|
|||||||
}, 5000);
|
}, 5000);
|
||||||
},
|
},
|
||||||
panMapToMarker(iAnimDuration=500) {
|
panMapToMarker(iAnimDuration=500) {
|
||||||
|
if(typeof iAnimDuration !== 'number') iAnimDuration = 500; //panMapToMarker will provide event on direct call in vue template
|
||||||
|
|
||||||
this.popupRequested = true;
|
this.popupRequested = true;
|
||||||
|
|
||||||
if(this.isMobile()) this.project.toggleFeedPanel(false, 'panToInstant');
|
if(this.isMobile()) this.project.toggleFeedPanel(false, 'panToInstant');
|
||||||
this.hash.items = [this.hash.items[0], this.options.type, this.options.id];
|
this.hash.items = [this.hash.items[0], this.options.type, this.options.id];
|
||||||
|
|
||||||
return this.map.panToBetweenPanels(this.lngLat, this.focusZoomLevel, iAnimDuration).then(() => {
|
return this.map.panToBetweenPanels(this.relatedMarkerLatLng, this.focusZoomLevel, iAnimDuration).then(() => {
|
||||||
this.openMarkerPopup(false);
|
this.openMarkerPopup(false);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
openMarkerPopup(bMouseEvent=true) {
|
openMarkerPopup(bMouseEvent=true) {
|
||||||
|
const oRelatedMarker = this.relatedMarker;
|
||||||
this.mouseOverDrill = bMouseEvent;
|
this.mouseOverDrill = bMouseEvent;
|
||||||
if(this.map.isMarkerVisible(this.lngLat)) this.map.openMarkerPopup(this.options.id, this.options.type);
|
if(oRelatedMarker && this.map.isMarkerVisible(this.relatedMarkerLatLng)) {
|
||||||
|
this.map.openMarkerPopup(oRelatedMarker.id, oRelatedMarker.type);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
closeMarkerPopup() {
|
closeMarkerPopup() {
|
||||||
this.mouseOverDrill = false;
|
this.mouseOverDrill = false;
|
||||||
@@ -130,7 +149,7 @@
|
|||||||
return this.openMarkerPopup(false);
|
return this.openMarkerPopup(false);
|
||||||
case 'media':
|
case 'media':
|
||||||
this.$refs.medialink.openMedia();
|
this.$refs.medialink.openMedia();
|
||||||
if(this.lngLat) return this.openMarkerPopup(false);
|
if(this.relatedMarker) return this.openMarkerPopup(false);
|
||||||
default:
|
default:
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
@@ -161,7 +180,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<div v-if="options.type == 'message'" class="body-box">
|
<div v-if="options.type == 'message'" class="body-box">
|
||||||
<div class="drill" @click.prevent="() => {this.panMapToMarker();}" @mouseenter="openMarkerPopup" @mouseleave="closeMarkerPopup">
|
<div class="drill" @click.prevent="panMapToMarker" @mouseenter="openMarkerPopup" @mouseleave="closeMarkerPopup">
|
||||||
<span v-if="options.weather_icon && options.weather_icon!='unknown'" class="weather clickable" :title="lang.get('weather.'+options.weather_icon)">
|
<span v-if="options.weather_icon && options.weather_icon!='unknown'" class="weather clickable" :title="lang.get('weather.'+options.weather_icon)">
|
||||||
<spotIcon :icon="options.weather_icon" :text="Math.round(options.weather_temp)+'°C'" text-classes="temperature" />
|
<spotIcon :icon="options.weather_icon" :text="Math.round(options.weather_temp)+'°C'" text-classes="temperature" />
|
||||||
</span>
|
</span>
|
||||||
@@ -173,13 +192,13 @@
|
|||||||
<projectMapLink :options="options" />
|
<projectMapLink :options="options" />
|
||||||
</p>
|
</p>
|
||||||
<p v-if="timeDiff">
|
<p v-if="timeDiff">
|
||||||
<projectRelTime :icon="'time'" margin="right" :localTime="absTimeLocal" :siteTime="options.formatted_time" :offset="options.day_offset" />
|
<projectRelTime :icon="'time'" :localTime="absTimeLocal" :siteTime="options.formatted_time" :offset="options.day_offset" />
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="options.type == 'media'" class="body-box">
|
<div v-else-if="options.type == 'media'" class="body-box">
|
||||||
<projectMediaLink :options="options" :type="'post'" ref="medialink" @opening-lightbox="() => {if(this.lngLat) return this.panMapToMarker();}" />
|
<projectMediaLink :options="options" :type="'post'" ref="medialink" @opening-lightbox="panMapToMarker" />
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="options.type == 'post'">
|
<div v-else-if="options.type == 'post'">
|
||||||
<p class="message">{{ options.content }}</p>
|
<p class="message">{{ options.content }}</p>
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ export default {
|
|||||||
offset: String,
|
offset: String,
|
||||||
classes: String,
|
classes: String,
|
||||||
icon: String,
|
icon: String,
|
||||||
margin: String,
|
|
||||||
},
|
},
|
||||||
inject: ['lang'],
|
inject: ['lang'],
|
||||||
computed: {
|
computed: {
|
||||||
@@ -23,6 +22,6 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<spotIcon v-if="icon" :icon="icon" :margin="margin" :title="title" :text="localTime" width="fixed" size="lg" />
|
<spotIcon v-if="icon" :icon="icon" :title="title" :text="localTime" width="fixed" size="lg" />
|
||||||
<span v-else :class="classes" :title="title">{{ localTime }}</span>
|
<span v-else :class="classes" :title="title">{{ localTime }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user