Move menu icons to bottom on mobile

This commit is contained in:
2021-12-19 12:52:15 +01:00
parent cce983291e
commit 7ca66a200f
6 changed files with 33 additions and 29 deletions

View File

@@ -378,6 +378,8 @@ function setMapLayers(asLayers) {
} }
function initSpotMessages(aoMessages, aoTracks) { function initSpotMessages(aoMessages, aoTracks) {
var bIsMobile = isMobile();
//Map //Map
var oMap = L.map(self.tmp('$Map')[0], { var oMap = L.map(self.tmp('$Map')[0], {
layers: [oSpot.tmp('layers')[oSpot.lang('map_satellite')]], layers: [oSpot.tmp('layers')[oSpot.lang('map_satellite')]],
@@ -387,29 +389,38 @@ function initSpotMessages(aoMessages, aoTracks) {
self.tmp('map', oMap); self.tmp('map', oMap);
//Controls: Settings Panel //Controls: Settings Panel
var oSettingsPanel = L.control({position: 'topleft'}); var oSettingsPanel = L.control({position: bIsMobile?'bottomleft':'topleft'});
var $SettingsButton = $('#settings-button').clone(); var $SettingsButton = $('#settings-button').clone();
$SettingsButton.click(toggleSettingsPanel); $SettingsButton.click(toggleSettingsPanel);
oSettingsPanel.onAdd = function(oMap) {return $SettingsButton[0];}; oSettingsPanel.onAdd = function(oMap) {return $SettingsButton[0];};
oSettingsPanel.addTo(oMap);
//Project Title //Project Title
var oTitle = L.control({position: 'topleft'}); var oTitle = L.control({position: bIsMobile?'bottomleft':'topleft'});
var $Title = $('#title').clone(); var $Title = $('#title').clone();
oTitle.onAdd = function(oMap) {return $Title[0];}; oTitle.onAdd = function(oMap) {return $Title[0];};
oTitle.addTo(oMap);
if(bIsMobile) {
oTitle.addTo(oMap);
oSettingsPanel.addTo(oMap);
}
else {
oSettingsPanel.addTo(oMap);
oTitle.addTo(oMap);
}
//Controls: Feed Panel //Controls: Feed Panel
var oFeedPanel = L.control({position: 'topright'}); var oFeedPanel = L.control({position: bIsMobile?'bottomright':'topright'});
var $PostButton = $('#feed-button').clone(); var $PostButton = $('#feed-button').clone();
$PostButton.click(toggleFeedPanel); $PostButton.click(toggleFeedPanel);
oFeedPanel.onAdd = function(oMap) {return $PostButton[0];}; oFeedPanel.onAdd = function(oMap) {return $PostButton[0];};
oFeedPanel.addTo(oMap); oFeedPanel.addTo(oMap);
//Controls: Legend //Controls: Legend
var oLegend = L.control({position: 'bottomleft'}); if(!bIsMobile) {
oLegend.onAdd = function(oMap) {return $('#legend').clone()[0];}; var oLegend = L.control({position: 'bottomleft'});
oLegend.addTo(oMap); oLegend.onAdd = function(oMap) {return $('#legend').clone()[0];};
oLegend.addTo(oMap);
}
//Controls: Projects //Controls: Projects
var $Labels = $('<div>', {'class': 'leaflet-control-layers-base'}); var $Labels = $('<div>', {'class': 'leaflet-control-layers-base'});
@@ -431,10 +442,10 @@ function initSpotMessages(aoMessages, aoTracks) {
$('#settings-projects').empty().append($Labels); $('#settings-projects').empty().append($Labels);
//Controls: Scale //Controls: Scale
oScale = L.control.scale({imperial: false, 'position':'bottomright'}).addTo(oMap); oScale = L.control.scale({imperial: false, position: bIsMobile?'topright':'bottomright'}).addTo(oMap);
//Controls: Elevation //Controls: Elevation
if(!isMobile()) { if(!bIsMobile) {
var aoElevTracks = {type: 'FeatureCollection', features:[], properties: {summary: 'trackType'}}; var aoElevTracks = {type: 'FeatureCollection', features:[], properties: {summary: 'trackType'}};
var aoLegend = {trackType: {}}; var aoLegend = {trackType: {}};
for(var i in aoTracks.features) { for(var i in aoTracks.features) {
@@ -576,8 +587,8 @@ function initSpotMessages(aoMessages, aoTracks) {
var oLastMsg = (aoMessages.length > 0)?aoMessages[aoMessages.length-1]:{}; var oLastMsg = (aoMessages.length > 0)?aoMessages[aoMessages.length-1]:{};
//Centering map //Centering map
var bIsMobile = isMobile(); var iFeedPanelWidth = bIsMobile?0:parseInt(self.tmp('$Feed').outerWidth(true));
var iPanelWidth = bIsMobile?0:parseInt(self.tmp('$Feed').outerWidth(true)); var iTitleHeight = bIsMobile?self.tmp('$Title').outerHeight(true):0;
if( if(
self.vars(['project', 'mode']) == self.consts.modes.blog && self.vars(['project', 'mode']) == self.consts.modes.blog &&
!$.isEmptyObject(oLastMsg) && !$.isEmptyObject(oLastMsg) &&
@@ -585,14 +596,14 @@ function initSpotMessages(aoMessages, aoTracks) {
) { ) {
//Zoom on last message //Zoom on last message
oMap.setView(L.latLng(oLastMsg.latitude, oLastMsg.longitude), 15); oMap.setView(L.latLng(oLastMsg.latitude, oLastMsg.longitude), 15);
oMap.panBy([iPanelWidth/2, bIsMobile?(self.tmp('$Title').outerHeight(true) * -1/2):0]); oMap.panBy([iFeedPanelWidth/2, /*bIsMobile?(self.tmp('$Title').outerHeight(true) * -1/2):*/0]);
} }
else { else {
oMap.fitBounds( oMap.fitBounds(
self.tmp('track').getBounds(), self.tmp('track').getBounds(),
{ {
paddingTopLeft: L.point(5, 5 + self.tmp('marker_size').height + (bIsMobile?self.tmp('$Title').outerHeight(true):0)), paddingTopLeft: L.point(5, 5 + self.tmp('marker_size').height), //So that the first marker isn't off screen
paddingBottomRight: L.point(5 + iPanelWidth, 5) paddingBottomRight: L.point(5 + iFeedPanelWidth, 5 + iTitleHeight)
} }
); );
} }

View File

@@ -25,4 +25,4 @@
* Add mail frequency slider * Add mail frequency slider
* Use WMTS servers directly when not using Geo Caching Server * Use WMTS servers directly when not using Geo Caching Server
* Allow HEIF picture format * Allow HEIF picture format
* Vector tiles support (https://www.arcgis.com/home/item.html?id=7dc6cea0b1764a1f9af2e679f642f0f5) + Use of GL library. Use Mapbox GL JS / Maplibre GL JS? * Vector tiles support (https://www.arcgis.com/home/item.html?id=7dc6cea0b1764a1f9af2e679f642f0f5) + Use of GL library. Use Mapbox GL JS / Maplibre GL JS / ESRI-Leaflet-vector?

View File

@@ -24,7 +24,7 @@
left: calc(#{$panel-width}); left: calc(#{$panel-width});
} }
.leaflet-control-container .leaflet-bottom.leaflet-right { .leaflet-control-container .leaflet-top.leaflet-right {
display: none; display: none;
} }
@@ -41,13 +41,9 @@
display:none; display:none;
} }
.leaflet-control-container { .leaflet-control-container .leaflet-top.leaflet-left {
.leaflet-bottom.leaflet-left, display: none;
.leaflet-bottom.leaflet-right .leaflet-control.elevation {
display: none;
}
} }
#feed, #settings { #feed, #settings {
width: calc(#{$panel-width}); width: calc(#{$panel-width});
max-width: calc(#{$panel-width}); max-width: calc(#{$panel-width});

View File

@@ -1,4 +1,4 @@
/*! /*
* Font Awesome Pro 5.15.4 by @fontawesome - https://fontawesome.com * Font Awesome Pro 5.15.4 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license (Commercial License) * License - https://fontawesome.com/license (Commercial License)
*/ */

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long