Generate media popup on the fly
This commit is contained in:
@@ -313,32 +313,16 @@ export default {
|
|||||||
//TODO Use same way of displaying markers (so that openMarkerPopup works on all markers)
|
//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, {mainClasses: 'media', iconMain: 'marker', iconSub: msg.subtype});
|
createApp(SpotIconStack, {mainClasses: 'media', iconMain: 'marker', iconSub: msg.subtype}).mount($Marker);
|
||||||
app.mount($Marker);
|
|
||||||
|
|
||||||
const $Popup = document.createElement('div');
|
const marker = new Marker({element: $Marker, anchor: 'bottom'})
|
||||||
const popupElement = new Popup({
|
|
||||||
anchor: 'bottom',
|
|
||||||
offset: [0, this.markerSize.height * -1],
|
|
||||||
closeButton: false
|
|
||||||
})
|
|
||||||
.setDOMContent($Popup)
|
|
||||||
.setLngLat([msg.longitude, msg.latitude])
|
.setLngLat([msg.longitude, msg.latitude])
|
||||||
.setMaxWidth(300)
|
|
||||||
.addTo(this.map)
|
.addTo(this.map)
|
||||||
;
|
.getElement().addEventListener('click', (oEvent) => {
|
||||||
const popupContent = createApp(ProjectPopup, {
|
oEvent.preventDefault();
|
||||||
type: 'media',
|
oEvent.stopPropagation();
|
||||||
options: msg,
|
this.openMediaPopup(msg);
|
||||||
medias: [msg],
|
|
||||||
project: this.currProject
|
|
||||||
});
|
});
|
||||||
popupContent.provide('spot', this.spot).mount($Popup);
|
|
||||||
|
|
||||||
new Marker({element: $Marker, anchor: 'bottom'})
|
|
||||||
.setLngLat([msg.longitude, msg.latitude])
|
|
||||||
.setPopup(popupElement)
|
|
||||||
.addTo(this.map);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async positionMap(oTrack) {
|
async positionMap(oTrack) {
|
||||||
@@ -397,6 +381,28 @@ export default {
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
openMediaPopup(oMedia) {
|
||||||
|
this.closeMarkerPopup();
|
||||||
|
|
||||||
|
const $Popup = document.createElement('div');
|
||||||
|
this.popup.element = new Popup({
|
||||||
|
anchor: 'bottom',
|
||||||
|
offset: [0, this.markerSize.height * -1],
|
||||||
|
closeButton: false
|
||||||
|
})
|
||||||
|
.setDOMContent($Popup)
|
||||||
|
.setLngLat([oMedia.longitude, oMedia.latitude])
|
||||||
|
.setMaxWidth(300)
|
||||||
|
.addTo(this.map);
|
||||||
|
|
||||||
|
this.popup.content = createApp(ProjectPopup, {
|
||||||
|
type: 'media',
|
||||||
|
options: oMedia,
|
||||||
|
medias: [oMedia],
|
||||||
|
project: this.currProject
|
||||||
|
});
|
||||||
|
this.popup.content.provide('spot', this.spot).mount($Popup);
|
||||||
|
},
|
||||||
openMarkerPopup(oFeature) {
|
openMarkerPopup(oFeature) {
|
||||||
this.closeMarkerPopup();
|
this.closeMarkerPopup();
|
||||||
|
|
||||||
|
|||||||
@@ -52,12 +52,18 @@
|
|||||||
.#{variables.$fa-css-prefix}-stack-2x {
|
.#{variables.$fa-css-prefix}-stack-2x {
|
||||||
color: color.$message-flashy;
|
color: color.$message-flashy;
|
||||||
}
|
}
|
||||||
|
.#{variables.$fa-css-prefix}-stack-1x {
|
||||||
|
color: color.$message;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.media {
|
&.media {
|
||||||
.#{variables.$fa-css-prefix}-stack-2x {
|
.#{variables.$fa-css-prefix}-stack-2x {
|
||||||
color: color.$media-flashy;
|
color: color.$media-flashy;
|
||||||
}
|
}
|
||||||
|
.#{variables.$fa-css-prefix}-stack-1x {
|
||||||
|
color: color.$media;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.track {
|
&.track {
|
||||||
|
|||||||
Reference in New Issue
Block a user