diff options
author | Gali Nelle <galinelle.mapbox@gmail.com> | 2020-04-06 10:12:56 +0300 |
---|---|---|
committer | galinelle <paolo.angelelli@mapbox.com> | 2020-04-08 14:00:26 +0300 |
commit | 8e581c88ea855998a2746e57f1a5fc46ee62faee (patch) | |
tree | 9a158b1a4281a6c894025cc6758a0c9c59dfd5b0 /platform | |
parent | 9a55c282fecfdd76b1acdf64cef0ce2ed99472ef (diff) | |
download | qtlocation-mapboxgl-8e581c88ea855998a2746e57f1a5fc46ee62faee.tar.gz |
Make location indicator bearing a paint property
This change introduces a new property type, Rotation, that uses
a custom interpolator, and that is currently applied to
all style properties named "bearing", with a period attribute.
Diffstat (limited to 'platform')
-rw-r--r-- | platform/glfw/glfw_view.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/platform/glfw/glfw_view.cpp b/platform/glfw/glfw_view.cpp index e538d934a3..c65df4d1cb 100644 --- a/platform/glfw/glfw_view.cpp +++ b/platform/glfw/glfw_view.cpp @@ -988,7 +988,8 @@ void GLFWView::toggleLocationIndicatorLayer() { puckLayer->setAccuracyRadiusColor( premultiply(mbgl::Color{0.0, 1.0, 0.0, 0.2})); // Note: these must be fed premultiplied - puckLayer->setBearing(0); + puckLayer->setBearingTransition(mbgl::style::TransitionOptions(mbgl::Duration::zero(), mbgl::Duration::zero())); + puckLayer->setBearing(mbgl::style::Rotation(0.0)); puckLayer->setAccuracyRadiusBorderColor(premultiply(mbgl::Color{0.0, 1.0, 0.2, 0.4})); puckLayer->setTopImageSize(24); puckLayer->setBearingImageSize(72); @@ -1038,8 +1039,8 @@ void GLFWView::onWillStartRenderingFrame() { puck = static_cast<mbgl::style::LocationIndicatorLayer *>(map->getStyle().getLayer("puck")); if (puck) { uint64_t ns = mbgl::Clock::now().time_since_epoch().count(); - const float bearing = float(ns % 2000000000) / 2000000000.0 * 360.0; - puck->setBearing(bearing); + const double bearing = double(ns % 2000000000) / 2000000000.0 * 360.0; + puck->setBearing(mbgl::style::Rotation(bearing)); } #endif } |