diff --git a/src/FlightMap/Widgets/MapFitFunctions.qml b/src/FlightMap/Widgets/MapFitFunctions.qml index 64e360565098d16a544183e96b917e83aa2a24e5..ac8bfa8cf88227304e3b294cbe60a4f154b80670 100644 --- a/src/FlightMap/Widgets/MapFitFunctions.qml +++ b/src/FlightMap/Widgets/MapFitFunctions.qml @@ -41,7 +41,7 @@ Item { /// Normalize longitude to range: 0 to 360, W to E function normalizeLon(lon) { - return lon + 180.0 + return lon + 180.0 } /// Fits the visible region of the map to inclues all of the specified coordinates. If no coordinates @@ -69,7 +69,7 @@ Item { continue } lat = normalizeLat(lat) - lon = normalizeLon(lat) + lon = normalizeLon(lon) north = Math.max(north, lat) south = Math.min(south, lat) east = Math.max(east, lon) @@ -77,8 +77,8 @@ Item { } // Expand the coordinate bounding rect to make room for the tools around the edge of the map - var latDegreesPerPixel = (north - south) / mapFitViewport.width - var lonDegreesPerPixel = (east - west) / mapFitViewport.height + var latDegreesPerPixel = (north - south) / mapFitViewport.height + var lonDegreesPerPixel = (east - west) / mapFitViewport.width north = Math.min(north + (mapFitViewport.y * latDegreesPerPixel), 180) south = Math.max(south - ((map.height - mapFitViewport.bottom) * latDegreesPerPixel), 0) west = Math.max(west - (mapFitViewport.x * lonDegreesPerPixel), 0) @@ -94,7 +94,6 @@ Item { var topLeftCoord = QtPositioning.coordinate(north - 90.0, west - 180.0) var bottomRightCoord = QtPositioning.coordinate(south - 90.0, east - 180.0) map.setVisibleRegion(QtPositioning.rectangle(topLeftCoord, bottomRightCoord)) - } function addMissionItemCoordsForFit(coordList) {