Customize media markers
This commit is contained in:
@@ -299,6 +299,7 @@ export default {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//Medias
|
//Medias
|
||||||
|
//TODO Use same way of displaying markers (so that openMarkerPopup works on all markers)
|
||||||
this.markers.medias.forEach(msg => {
|
this.markers.medias.forEach(msg => {
|
||||||
const $Marker = document.createElement('div');
|
const $Marker = document.createElement('div');
|
||||||
const app = createApp(SpotIconStack, {iconMain: 'message', iconSub:'image'});
|
const app = createApp(SpotIconStack, {iconMain: 'message', iconSub:'image'});
|
||||||
@@ -315,8 +316,8 @@ export default {
|
|||||||
.setMaxWidth(300)
|
.setMaxWidth(300)
|
||||||
.addTo(this.map)
|
.addTo(this.map)
|
||||||
;
|
;
|
||||||
console.log(msg);
|
|
||||||
const popupContent = createApp(ProjectPopup, {
|
const popupContent = createApp(ProjectPopup, {
|
||||||
|
type: 'media',
|
||||||
options: msg,
|
options: msg,
|
||||||
medias: [msg],
|
medias: [msg],
|
||||||
project: this.currProject
|
project: this.currProject
|
||||||
@@ -416,6 +417,7 @@ export default {
|
|||||||
.addTo(this.map);
|
.addTo(this.map);
|
||||||
|
|
||||||
this.popup.content = createApp(ProjectPopup, {
|
this.popup.content = createApp(ProjectPopup, {
|
||||||
|
type: 'message',
|
||||||
options: oFeature.properties,
|
options: oFeature.properties,
|
||||||
medias: JSON.parse(oFeature.properties.medias || '[]'),
|
medias: JSON.parse(oFeature.properties.medias || '[]'),
|
||||||
project: this.currProject
|
project: this.currProject
|
||||||
@@ -585,8 +587,9 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async findPost(oPost) {
|
async findPost(oPost) {
|
||||||
if(this.goToPost(oPost)) {
|
let oRef = this.goToPost(oPost);
|
||||||
//if(oPost.type=='media' || oPost.type=='message') $Post.find('a.drill').click();
|
if(oRef) {
|
||||||
|
oRef.executeMainAction();
|
||||||
}
|
}
|
||||||
else if(!this.feed.outOfData) {
|
else if(!this.feed.outOfData) {
|
||||||
await this.getNextFeed();
|
await this.getNextFeed();
|
||||||
@@ -598,17 +601,17 @@ export default {
|
|||||||
let bFound = false;
|
let bFound = false;
|
||||||
let aoRefs = this.$refs.posts.filter((post) => {return post.postId == oPost.type+'-'+oPost.id;});
|
let aoRefs = this.$refs.posts.filter((post) => {return post.postId == oPost.type+'-'+oPost.id;});
|
||||||
if(aoRefs.length == 1) {
|
if(aoRefs.length == 1) {
|
||||||
|
let oRef = aoRefs[0];
|
||||||
this.$refs.feedSimpleBar.scrollElement.scrollTop += Math.round(
|
this.$refs.feedSimpleBar.scrollElement.scrollTop += Math.round(
|
||||||
aoRefs[0].$el.getBoundingClientRect().top
|
oRef.$el.getBoundingClientRect().top
|
||||||
+ window.pageYOffset
|
+ window.pageYOffset
|
||||||
- parseFloat(getComputedStyle(this.$refs.feedSimpleBar.$el).paddingTop)
|
- parseFloat(getComputedStyle(this.$refs.feedSimpleBar.$el).paddingTop)
|
||||||
);
|
);
|
||||||
aoRefs[0].executeMainAction();
|
|
||||||
//this.spot.flushHash(['post', 'message']);
|
|
||||||
bFound = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return bFound;
|
//this.spot.flushHash(['post', 'message']);
|
||||||
|
|
||||||
|
return oRef;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,35 +13,45 @@ export default {
|
|||||||
projectRelTime
|
projectRelTime
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
type: String,
|
||||||
options: Object,
|
options: Object,
|
||||||
medias: Array,
|
medias: Array,
|
||||||
project: Object
|
project: Object
|
||||||
},
|
},
|
||||||
inject: ['spot']
|
inject: ['spot'],
|
||||||
|
computed: {
|
||||||
|
timeIcon() {
|
||||||
|
return (this.type == 'media')?'image-shot':'time';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="info-window">
|
<div :class="'info-window '+type">
|
||||||
|
<div class="header" v-if="type=='message'">
|
||||||
<h1>
|
<h1>
|
||||||
<spotIcon :icon="'message'" :classes="'fa-lg'" :text="spot.lang('post_message')+' '+spot.lang('counter', options.displayed_id)" />
|
<spotIcon :icon="'message'" :classes="'fa-lg'" :text="spot.lang('post_message')+' '+spot.lang('counter', options.displayed_id)" />
|
||||||
<span class="message-type">({{ options.type }})</span>
|
<span class="message-type">({{ options.type }})</span>
|
||||||
</h1>
|
</h1>
|
||||||
<div class="separator"></div>
|
<div class="separator"></div>
|
||||||
|
</div>
|
||||||
<p class="coordinates">
|
<p class="coordinates">
|
||||||
<spotIcon :icon="'coords'" :classes="'fa-fw fa-lg'" :margin="true" />
|
<spotIcon :icon="'coords'" :classes="'fa-fw fa-lg'" :margin="true" />
|
||||||
<projectMapLink :options="options" />
|
<projectMapLink :options="options" />
|
||||||
</p>
|
</p>
|
||||||
<p class="time">
|
<p class="time">
|
||||||
<projectRelTime :icon="'time'" :localTime="options.formatted_time_local" :siteTime="options.formatted_time" :offset="options.day_offset" />
|
<projectRelTime :icon="timeIcon" :localTime="options.formatted_time_local" :siteTime="options.formatted_time" :offset="options.day_offset" />
|
||||||
<span v-if="project.mode==spot.consts.modes.blog"> ({{ options.relative_time }})</span>
|
<span v-if="project.mode==spot.consts.modes.blog"> ({{ options.relative_time }})</span>
|
||||||
</p>
|
</p>
|
||||||
<p class="weather" v-if="options.weather_icon && options.weather_icon!='unknown'" :title="options.weather_cond==''?'':spot.lang(options.weather_cond)">
|
<p class="weather" v-if="options.weather_icon && options.weather_icon!='unknown'" :title="options.weather_cond==''?'':spot.lang(options.weather_cond)">
|
||||||
<spotIcon :icon="options.weather_icon" :classes="'fa-fw fa-lg'" :text="options.weather_temp+'°C'" />
|
<spotIcon :icon="options.weather_icon" :classes="'fa-fw fa-lg'" :text="options.weather_temp+'°C'" />
|
||||||
</p>
|
</p>
|
||||||
<div v-if="medias" class="separator"></div>
|
<div v-if="medias.length > 0">
|
||||||
<div v-if="medias" class="medias">
|
<div class="separator"></div>
|
||||||
|
<div class="medias">
|
||||||
<projectMediaLink v-for="media in medias" :options="media" :type="'marker'" />
|
<projectMediaLink v-for="media in medias" :options="media" :type="'marker'" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -32,7 +32,8 @@
|
|||||||
anchorIcon: 'link',
|
anchorIcon: 'link',
|
||||||
popupRequested: false,
|
popupRequested: false,
|
||||||
postMessage: '',
|
postMessage: '',
|
||||||
sending: false
|
sending: false,
|
||||||
|
focusZoomLevel: 15
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -60,7 +61,11 @@
|
|||||||
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() {
|
lngLat() {
|
||||||
return (this.options.type == 'message')?(new LngLat(this.options.longitude, this.options.latitude)):null;
|
return (
|
||||||
|
['message', 'media'].includes(this.options.type)
|
||||||
|
&& this.options.longitude
|
||||||
|
&& this.options.latitude
|
||||||
|
)?(new LngLat(this.options.longitude, this.options.latitude)):null;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
@@ -80,7 +85,7 @@
|
|||||||
if(this.spot.isMobile()) this.project.toggleFeedPanel(false, 'panToInstant');
|
if(this.spot.isMobile()) this.project.toggleFeedPanel(false, 'panToInstant');
|
||||||
this.map.panToBetweenPanels(
|
this.map.panToBetweenPanels(
|
||||||
this.lngLat,
|
this.lngLat,
|
||||||
15,
|
this.focusZoomLevel,
|
||||||
() => {this.map.openMarkerPopup(this.options.id_message);}
|
() => {this.map.openMarkerPopup(this.options.id_message);}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -119,6 +124,7 @@
|
|||||||
break;
|
break;
|
||||||
case 'media':
|
case 'media':
|
||||||
this.$refs.medialink.openMedia();
|
this.$refs.medialink.openMedia();
|
||||||
|
if(this.lngLat) this.map.panToBetweenPanels(this.lngLat, this.focusZoomLevel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ $thumbnail-max-size: 60px;
|
|||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-size: calc(1em / 1.4);
|
font-size: calc(1em / 1.4);
|
||||||
margin-left: 0.5em;
|
margin-left: 0.5em;
|
||||||
vertical-align: text-bottom;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
@@ -50,16 +50,13 @@ $thumbnail-max-size: 60px;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.medias {
|
a.media-link {
|
||||||
line-height: 0;
|
img {
|
||||||
display: grid;
|
width: auto;
|
||||||
gap: var.$elem-spacing;
|
height: auto;
|
||||||
grid-template-columns: repeat(auto-fill, minmax($thumbnail-max-size, 1fr));
|
image-orientation: from-image;
|
||||||
place-items: center;
|
transition: All 0.2s;
|
||||||
|
border-radius: var.$block-radius;
|
||||||
a {
|
|
||||||
&:last-child {
|
|
||||||
margin-right: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&.drill {
|
&.drill {
|
||||||
@@ -78,15 +75,37 @@ $thumbnail-max-size: 60px;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.message {
|
||||||
|
.medias {
|
||||||
|
line-height: 0;
|
||||||
|
display: grid;
|
||||||
|
gap: var.$elem-spacing;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax($thumbnail-max-size, 1fr));
|
||||||
|
place-items: center;
|
||||||
|
|
||||||
|
a.media-link {
|
||||||
|
&:last-child {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
img {
|
img {
|
||||||
width: auto;
|
|
||||||
height: auto;
|
|
||||||
max-width: $thumbnail-max-size;
|
max-width: $thumbnail-max-size;
|
||||||
max-height: calc($thumbnail-max-size * 2/3);
|
max-height: calc($thumbnail-max-size * 2/3);
|
||||||
border-radius: var.$block-radius;
|
}
|
||||||
image-orientation: from-image;
|
}
|
||||||
transition: All 0.2s;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.media {
|
||||||
|
.coordinates {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.medias {
|
||||||
|
a.media-link img {
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user