Skip to content

Commit

Permalink
Fixes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
Corwin-Kh committed Nov 20, 2024
1 parent b11117b commit d8aa5ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import net.osmand.data.LatLon
import net.osmand.data.QuadRect
import net.osmand.plus.OsmandApplication
import net.osmand.plus.R
import net.osmand.plus.views.Zoom
import net.osmand.search.core.SearchResult
import net.osmand.util.Algorithms

Expand All @@ -20,7 +21,7 @@ abstract class BaseAndroidAutoScreen(carContext: CarContext) : Screen(carContext

protected var prevElevationAngle = 90f
protected var prevRotationAngle = 0f
protected var prevZoom = 15
protected var prevZoom: Zoom? = null
protected var prevMapLinkedToLocation = false
protected val ANIMATION_RETURN_FROM_PREVIEW_TIME = 1500

Expand Down Expand Up @@ -100,7 +101,6 @@ abstract class BaseAndroidAutoScreen(carContext: CarContext) : Screen(carContext
app.carNavigationSession?.navigationCarSurface?.let { surfaceRenderer ->
if (!mapRect.hasInitialState()) {
val mapView = app.osmandMap.mapView
mapView.elevationAngle = 90f
val tb = mapView.rotatedTileBox
tb.setCenterLocation(tb.centerPixelX.toFloat() / tb.pixWidth, 0.5f)
tb.rotate = 0f;
Expand Down Expand Up @@ -132,7 +132,7 @@ abstract class BaseAndroidAutoScreen(carContext: CarContext) : Screen(carContext
mapView.animateToState(
lastKnownLocation?.latitude ?: mapView.latitude,
lastKnownLocation?.longitude ?: mapView.longitude,
prevZoom.toFloat(),
prevZoom ?: mapView.currentZoom,
prevRotationAngle,
prevElevationAngle,
ANIMATION_RETURN_FROM_PREVIEW_TIME.toLong(),
Expand All @@ -142,7 +142,7 @@ abstract class BaseAndroidAutoScreen(carContext: CarContext) : Screen(carContext
override fun onStart(owner: LifecycleOwner) {
val mapView = app.osmandMap.mapView
prevMapLinkedToLocation = app.mapViewTrackingUtilities.isMapLinkedToLocation
prevZoom = mapView.baseZoom
prevZoom = mapView.currentZoom
prevRotationAngle = mapView.rotate
prevElevationAngle = mapView.normalizeElevationAngle(mapView.elevationAngle)
}
Expand Down
9 changes: 0 additions & 9 deletions OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java
Original file line number Diff line number Diff line change
Expand Up @@ -1744,8 +1744,6 @@ public void fitRectToMap(RotatedTileBox tb, double left, double right, double to
clat = tb.getLatFromPixel(x, y);
clon = tb.getLonFromPixel(x, y);
if (rotate) {
// animatedDraggingThread.startMoving(clat, clon, zoom.getBaseZoom(), zoom.getZoomFloatPart());
// LOG.debug("Target animation - " + zoom.getBaseZoom() + " " + zoom.getZoomFloatPart());
animateToState(clat, clon,
zoom, 0f, 90f, ANIMATION_PREVIEW_TIME, false);
} else {
Expand All @@ -1754,13 +1752,6 @@ public void fitRectToMap(RotatedTileBox tb, double left, double right, double to

}

public void animateToState(double clat, double clon, float zoom,
float finalRotation, float elevationAngle, long animationDuration, boolean notifyListener) {
Zoom z = new Zoom((int)zoom, zoom - (int)zoom, getMinZoom(), getMaxZoom());
animatedDraggingThread.animateToPreview(clat, clon,
z, finalRotation, elevationAngle, animationDuration, notifyListener);
}

public void animateToState(double clat, double clon, @NonNull Zoom zoom,
float finalRotation, float elevationAngle, long animationDuration, boolean notifyListener) {
animatedDraggingThread.animateToPreview(clat, clon,
Expand Down

0 comments on commit d8aa5ec

Please sign in to comment.