mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
mapwidget.qml: return early instead of doing branching
The centerOn*() functions can just return early for invalid input, instead of branching the conditions. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
1d80b08a8f
commit
837ed67d86
1 changed files with 59 additions and 59 deletions
|
@ -151,7 +151,8 @@ Item {
|
|||
stopZoomAnimations()
|
||||
if (!coordIsValid(coord)) {
|
||||
console.warn("MapWidget.qml: centerOnCoordinate(): !coordIsValid()")
|
||||
} else {
|
||||
return
|
||||
}
|
||||
var newZoomOutFound = false
|
||||
var zoomStored = zoomLevel
|
||||
var centerStored = QtPositioning.coordinate(center.latitude, center.longitude)
|
||||
|
@ -174,13 +175,13 @@ Item {
|
|||
newZoom = zoomStored
|
||||
mapAnimationZoomIn.restart()
|
||||
}
|
||||
}
|
||||
|
||||
function centerOnRectangle(topLeft, bottomRight, centerRect) {
|
||||
stopZoomAnimations()
|
||||
if (newCenter.latitude === 0.0 && newCenter.longitude === 0.0) {
|
||||
// Do nothing
|
||||
} else {
|
||||
return
|
||||
}
|
||||
var centerStored = QtPositioning.coordinate(center.latitude, center.longitude)
|
||||
var zoomStored = zoomLevel
|
||||
var newZoomOutFound = false
|
||||
|
@ -218,7 +219,6 @@ Item {
|
|||
center = centerStored
|
||||
mapAnimationZoomIn.restart()
|
||||
}
|
||||
}
|
||||
|
||||
function deselectMapLocation() {
|
||||
stopZoomAnimations()
|
||||
|
|
Loading…
Add table
Reference in a new issue