fix offset on mobile devices
This commit is contained in:
@@ -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: '<i class="fa fa-message fa-stack-2x"></i><i class="fa fa-message-in fa-stack-1x fa-rotate-270"></i>',
|
||||
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(
|
||||
|
||||
Reference in New Issue
Block a user