From 0512c690f864979c09712ca258c0846b8d0fc909 Mon Sep 17 00:00:00 2001 From: mike-000 <49240900+mike-000@users.noreply.github.com> Date: Fri, 10 Jan 2020 13:39:29 +0000 Subject: [PATCH] Fix for reset north when rotation is 360 degrees Animated reset north doesn't work and isn't needed if rotation is 360 degrees (or a multiple of 360) --- src/ol/control/Rotate.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ol/control/Rotate.js b/src/ol/control/Rotate.js index 5ba8a0db34..f4dd50c54d 100644 --- a/src/ol/control/Rotate.js +++ b/src/ol/control/Rotate.js @@ -131,8 +131,9 @@ class Rotate extends Control { // upon it return; } - if (view.getRotation() !== undefined) { - if (this.duration_ > 0) { + const rotation = view.getRotation(); + if (rotation !== undefined) { + if (this.duration_ > 0 && rotation % (2 * Math.PI) !== 0) { view.animate({ rotation: 0, duration: this.duration_,