hover on message (feed) triggers marker's popup

This commit is contained in:
2019-02-07 19:35:03 +01:00
parent 0a9188ca2a
commit 85774935c6
2 changed files with 21 additions and 14 deletions

View File

@@ -43,7 +43,8 @@ function initPage(asHash) {
self.tmp('feed_width', $('#feed').outerWidth(true)); self.tmp('feed_width', $('#feed').outerWidth(true));
self.tmp('map_offset', -1 * self.tmp('feed_width') / $('body').outerWidth(true)); self.tmp('map_offset', -1 * self.tmp('feed_width') / $('body').outerWidth(true));
self.tmp('tile_api', '?a=tile&id={id}&z={z}&x={x}&y={y}'); self.tmp('tile_api', '?a=tile&id={id}&z={z}&x={x}&y={y}');
self.tmp('markers', 'object');
//Assign Track Type Colors //Assign Track Type Colors
self.tmp('track-type-styles', 'object'); self.tmp('track-type-styles', 'object');
$('#legend').find('.line').each(function(iKey, oLegend){ $('#legend').find('.line').each(function(iKey, oLegend){
@@ -254,6 +255,8 @@ function initSpotMessages(aoMessages, aoTracks) {
closeOnClick: true, closeOnClick: true,
offset: new L.Point(0, -30) offset: new L.Point(0, -30)
}); });
oSpot.tmp(['markers', oMsg.id_message], oMarker);
}); });
//Legend //Legend
@@ -377,18 +380,23 @@ function getPost(asPost) {
{ {
case 'message': case 'message':
$Body = $('<div>') $Body = $('<div>')
.append($('<p>').addIcon('fa-message', true).append(asPost.lat_dms+' '+asPost.lon_dms)) .append($('<p>').addIcon('fa-message', true).append(asPost.lat_dms+' '+asPost.lon_dms))
.append($('<p>').addIcon('fa-time', true).append(sAbsTime+self.tmp('site_tz_notice'))) .append($('<p>').addIcon('fa-time', true).append(sAbsTime+self.tmp('site_tz_notice')))
.append( .append(
$('<img>', {'class':'staticmap', title: 'Click pour zoomer', src: getStaticMapUrl(asPost.latitude, asPost.longitude)}) $('<img>', {'class':'staticmap', title: 'Click pour zoomer', src: getStaticMapUrl(asPost.latitude, asPost.longitude)})
.data('lat', asPost.latitude) .data('lat', asPost.latitude)
.data('lng', asPost.longitude) .data('lng', asPost.longitude)
.click(function(){ .click(function(){
var $This = $(this); var $This = $(this);
var oCenter = L.latLng(parseFloat($This.data('lat')), parseFloat($This.data('lng'))); var oCenter = L.latLng(parseFloat($This.data('lat')), parseFloat($This.data('lng')));
self.tmp('map').setOffsetView(self.tmp('map_offset'), oCenter, 13); self.tmp('map').setOffsetView(self.tmp('map_offset'), oCenter, 13);
}) })
); )
.data('id', asPost.id_message)
.hover(function(){
var oMarker = oSpot.tmp(['markers', $(this).data('id')]);
if(oSpot.tmp('map').getBounds().contains(oMarker.getLatLng())) oMarker.togglePopup();
});
break; break;
case 'picture': case 'picture':
var $Image = $('<img>', {'src': asPost.thumb_path, title: 'Click pour zoomer'/*, 'style':'transform:rotate('+asPost.rotate+'deg);'*/}); var $Image = $('<img>', {'src': asPost.thumb_path, title: 'Click pour zoomer'/*, 'style':'transform:rotate('+asPost.rotate+'deg);'*/});

1
todo
View File

@@ -3,5 +3,4 @@ To Do List
- Elevation chart - Elevation chart
- Device/Spot Class - Device/Spot Class
- Replace all images with FA icons - Replace all images with FA icons
- on hover sur message : open popup on map (check zoom)
- on hover on relative time: display absolute time - on hover on relative time: display absolute time