From 2b170d525570218af97065bb2eba95c7c95551af Mon Sep 17 00:00:00 2001 From: franzz Date: Mon, 11 Mar 2019 22:07:38 +0100 Subject: [PATCH] fix offset on mobile devices --- masks/project.html | 12 +++++++----- todo | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/masks/project.html b/masks/project.html index 060b5c2..7d1b862 100755 --- a/masks/project.html +++ b/masks/project.html @@ -46,11 +46,12 @@ function initPage(asHash) { self.tmp('updatable', true); self.tmp('out-of-data', false); self.tmp('mobile', $('#mobile').is(':visible')); - self.tmp('feed_width', $('#feed').outerWidth(true)); + self.tmp('feed_width', self.tmp('mobile')?0:$('#feed').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('markers', 'object'); - + self.tmp('marker_size', {width: 32, height: 32}); + //Assign Track Type Colors self.tmp('track-type-styles', 'object'); $('#legend').find('.line').each(function(iKey, oLegend){ @@ -273,7 +274,7 @@ function initSpotMessages(aoMessages, aoTracks) { //Recenter map to be at the center of 70% (map_offset) of the page, 30% being used by posts oMap.setOffsetView(self.tmp('map_offset')); } - else oMap.fitBounds(oTracks.getBounds(), {paddingTopLeft: L.point(5, 42), paddingBottomRight: L.point(self.tmp('feed_width')+5, 5)}); + else oMap.fitBounds(oTracks.getBounds(), {paddingTopLeft: L.point(5, self.tmp('marker_size').height + 5), paddingBottomRight: L.point(self.tmp('feed_width') + 5, 5)}); //Spot Messages $.each(aoMessages, function(iKey, oMsg){ @@ -285,8 +286,8 @@ function initSpotMessages(aoMessages, aoTracks) { icon: L.divIcon({ className: '', html: '', - iconSize: [32, 32], - iconAnchor: [16, 32] + iconSize: [self.tmp('marker_size').width, self.tmp('marker_size').height], + iconAnchor: [self.tmp('marker_size').width / 2, self.tmp('marker_size').height] //position from icon's top left corner (iconAnchor = marker's position) }) }).addTo(oMap); @@ -438,6 +439,7 @@ function getPost(asPost) { var oMarker = oSpot.tmp(['markers', $(this).parent().data('id')]); self.tmp('map').setOffsetView(self.tmp('map_offset'), oMarker.getLatLng(), 13); if(!oMarker.isPopupOpen()) oMarker.openPopup(); + if(self.tmp('mobile')) toggleFeedPanel(false); }) ) .hover( diff --git a/todo b/todo index 597e065..799ed02 100644 --- a/todo +++ b/todo @@ -1,3 +1,4 @@ To Do List ---------- - Check that update feed works +- admin page #admin \ No newline at end of file