Skip to content

Commit

Permalink
Center location maker in bottom half of screen in routing mode
Browse files Browse the repository at this point in the history
Re-center map to point ahead of location marker in routing mode.

Closes #105
  • Loading branch information
ecgreb committed Dec 8, 2015
1 parent c315b91 commit d868fc1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/src/main/kotlin/com/mapzen/erasermap/view/RouteModeView.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package com.mapzen.erasermap.view

import android.content.Context
import android.graphics.Point
import android.location.Location
import android.support.v4.view.PagerAdapter
import android.support.v4.view.ViewPager
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View
import android.view.WindowManager
import android.widget.Button
import android.widget.ImageView
import android.widget.LinearLayout
Expand Down Expand Up @@ -313,6 +315,19 @@ public class RouteModeView : LinearLayout, RouteViewController, ViewPager.OnPage
mapController?.mapRotation = getBearingInRadians(location)
mapController?.mapZoom = MainPresenter.ROUTING_ZOOM
mapController?.mapTilt = MainPresenter.ROUTING_TILT
adjustMapPosition()
}

private fun adjustMapPosition() {
val windowManager = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
val display = windowManager.defaultDisplay
val point = Point()
display.getSize(point)

val x = point.x/2
val y = point.y/4
val position = mapController?.coordinatesAtScreenPosition(x.toDouble(), y.toDouble())
mapController?.mapPosition = position
}

override fun updateSnapLocation(location: Location) {
Expand Down

0 comments on commit d868fc1

Please sign in to comment.