Skip to content

Commit

Permalink
Adjusting the vanishing route line tolerance for smaller differneces …
Browse files Browse the repository at this point in the history
…in the distance traveled values.
  • Loading branch information
Seth Bourget authored and cafesilencio committed Jul 10, 2020
1 parent 835ed58 commit 6c52c50
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class RouteConstants {
public static final String ORIGIN_MARKER_NAME = "originMarker";
public static final String DESTINATION_MARKER_NAME = "destinationMarker";
public static final String MAPBOX_LOCATION_ID = "mapbox-location";
public static final double MINIMUM_ROUTE_LINE_OFFSET = .001;
public static final double MINIMUM_ROUTE_LINE_OFFSET = .000001;
public static final long ROUTE_LINE_VANISH_ANIMATION_DURATION = 1000;
public static final long ROUTE_LINE_VANISH_ANIMATION_DELAY = 350;
public static final String LAYER_ABOVE_UPCOMING_MANEUVER_ARROW = "com.mapbox.annotations.points";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ internal class MapRouteLine(
}
}.map {
Expression.stop(
it.offset.toBigDecimal().setScale(5, BigDecimal.ROUND_DOWN),
it.offset.toBigDecimal().setScale(6, BigDecimal.ROUND_DOWN),
Expression.color(it.segmentColor)
)
}
Expand Down Expand Up @@ -827,7 +827,7 @@ internal class MapRouteLine(
Expression.lineProgress(),
Expression.color(routeLineShieldTraveledColor),
Expression.stop(
offset.toBigDecimal().setScale(5, BigDecimal.ROUND_DOWN),
offset.toBigDecimal().setScale(6, BigDecimal.ROUND_DOWN),
Expression.color(routeShieldColor)
)
)
Expand All @@ -847,7 +847,7 @@ internal class MapRouteLine(
Expression.lineProgress(),
Expression.color(routeLineTraveledColor),
Expression.stop(
offset.toBigDecimal().setScale(5, BigDecimal.ROUND_DOWN),
offset.toBigDecimal().setScale(6, BigDecimal.ROUND_DOWN),
Expression.color(routeDefaultColor)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ class MapRouteLineTest {
fun buildRouteLineExpression() {
every { style.layers } returns listOf(primaryRouteLayer)
val expectedExpression =
"[\"step\", [\"line-progress\"], [\"rgba\", 0.0, 0.0, 0.0, 0.0], 0.2, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.31436, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.92972, [\"rgba\", 233.0, 51.0, 64.0, 1.0], 1.00032, [\"rgba\", 86.0, 168.0, 251.0, 1.0]]"
"[\"step\", [\"line-progress\"], [\"rgba\", 0.0, 0.0, 0.0, 0.0], 0.2, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.314361, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.929727, [\"rgba\", 233.0, 51.0, 64.0, 1.0], 1.000321, [\"rgba\", 86.0, 168.0, 251.0, 1.0]]"
val route = getDirectionsRoute(true)
val mapRouteLine = MapRouteLine(
ctx,
Expand All @@ -661,7 +661,7 @@ class MapRouteLineTest {
fun buildRouteLineExpressionMultileg() {
every { style.layers } returns listOf(primaryRouteLayer)
val expectedExpression =
"[\"step\", [\"line-progress\"], [\"rgba\", 0.0, 0.0, 0.0, 0.0], 0.0, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.02134, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.06847, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.09496, [\"rgba\", 243.0, 166.0, 79.0, 1.0], 0.1054, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.31133, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.31479, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.38133, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.38438, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.41593, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.45903, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.75335, [\"rgba\", 243.0, 166.0, 79.0, 1.0], 0.76137, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.79933, [\"rgba\", 243.0, 166.0, 79.0, 1.0], 0.84675, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.8662, [\"rgba\", 243.0, 166.0, 79.0, 1.0], 0.86933, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.90698, [\"rgba\", 233.0, 51.0, 64.0, 1.0], 0.92247, [\"rgba\", 233.0, 51.0, 64.0, 1.0], 0.93385, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.99504, [\"rgba\", 86.0, 168.0, 251.0, 1.0]]"
"[\"step\", [\"line-progress\"], [\"rgba\", 0.0, 0.0, 0.0, 0.0], 0.0, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.021346, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.068476, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.094961, [\"rgba\", 243.0, 166.0, 79.0, 1.0], 0.105403, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.311333, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.314792, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.381331, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.384388, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.415931, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.459031, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.753354, [\"rgba\", 243.0, 166.0, 79.0, 1.0], 0.761379, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.799339, [\"rgba\", 243.0, 166.0, 79.0, 1.0], 0.846752, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.866202, [\"rgba\", 243.0, 166.0, 79.0, 1.0], 0.869338, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.906985, [\"rgba\", 233.0, 51.0, 64.0, 1.0], 0.922473, [\"rgba\", 233.0, 51.0, 64.0, 1.0], 0.933859, [\"rgba\", 86.0, 168.0, 251.0, 1.0], 0.995047, [\"rgba\", 86.0, 168.0, 251.0, 1.0]]"
val route = getMultilegRoute()
val mapRouteLine = MapRouteLine(
ctx,
Expand Down

0 comments on commit 6c52c50

Please sign in to comment.