Merge pull request #798 from LucaGiovannesi/master

Fixed GPS map zoom issue
pull/804/head
Paweł Spychalski 5 years ago committed by GitHub
commit c277e2179b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3180,5 +3180,8 @@
},
"mc_airmode_threshold_help": {
"message": "Defines airmode THROTTLE activation threshold when mc_airmode_type THROTTLE_THRESHOLD is used"
},
"gps_map_center": {
"message": "Center"
}
}

@ -50,6 +50,24 @@
float: left;
}
.map-button {
z-index:1;
position: absolute;
background-color: #37A8DB;
color: white;
padding: 5px;
left: 10px;
bottom: 10px;
border-style: solid;
border-width: 2px;
border-color: #E4E4E4;
border-radius: 2px;
opacity: 0.8;
}
.map-button:hover {
opacity: 1;
}
.tab-gps #loadmap .controls {
width: 100%;
float: left;
@ -99,6 +117,7 @@
height: 400px;
width: 100%;
float: left;
position: relative;
}
/*noinspection ALL*/

@ -91,7 +91,9 @@
<div class="spacer_box_title" data-i18n="gpsMapHead"></div>
</div>
<div id="loadmap">
<div id="gps-map"></div>
<div id="gps-map">
<button class="map-button" id="center_button" data-i18n="gps_map_center"></button>
</div>
</div>
</div>

@ -45,6 +45,13 @@ TABS.gps.initialize = function (callback) {
mapLayer = new ol.source.OSM();
}
$("#center_button").click(function(){
let lat = GPS_DATA.lat / 10000000;
let lon = GPS_DATA.lon / 10000000;
let center = ol.proj.fromLonLat([lon, lat]);
mapView.setCenter(center);
});
mapHandler = new ol.Map({
target: document.getElementById('gps-map'),
layers: [
@ -107,6 +114,8 @@ TABS.gps.initialize = function (callback) {
//Update map
if (GPS_DATA.fix >= 2) {
let center = ol.proj.fromLonLat([lon, lat]);
if (!cursorInitialized) {
cursorInitialized = true;
@ -135,12 +144,13 @@ TABS.gps.initialize = function (callback) {
});
mapHandler.addLayer(currentPositionLayer);
mapView.setCenter(center);
mapView.setZoom(14);
}
let center = ol.proj.fromLonLat([lon, lat]);
mapView.setCenter(center);
mapView.setZoom(14);
iconGeometry.setCoordinates(center);
}
}

Loading…
Cancel
Save