From dc2a1534d3b904eb0150f874041a98856062d829 Mon Sep 17 00:00:00 2001 From: jonasengelmann <40031476+jonasengelmann@users.noreply.github.com> Date: Wed, 30 Mar 2022 22:59:29 +0200 Subject: [PATCH] removed modulo for degrees to avoid spining --- src/viewer.js | 16 ++++++++-------- src/viewport.js | 3 +-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index a138e2de..985ba468 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -2810,18 +2810,18 @@ function onCanvasKeyPress( event ) { break; case 114: //r - clockwise rotation if(this.viewport.flipped){ - this.viewport.setRotation($.positiveModulo(this.viewport.getRotation() - this.rotationIncrement, 360)); + this.viewport.setRotation(this.viewport.getRotation() - this.rotationIncrement); } else{ - this.viewport.setRotation($.positiveModulo(this.viewport.getRotation() + this.rotationIncrement, 360)); + this.viewport.setRotation(this.viewport.getRotation() + this.rotationIncrement); } this.viewport.applyConstraints(); event.preventDefault = true; break; case 82: //R - counterclockwise rotation if(this.viewport.flipped){ - this.viewport.setRotation($.positiveModulo(this.viewport.getRotation() + this.rotationIncrement, 360)); + this.viewport.setRotation(this.viewport.getRotation() + this.rotationIncrement); } else{ - this.viewport.setRotation($.positiveModulo(this.viewport.getRotation() - this.rotationIncrement, 360)); + this.viewport.setRotation(this.viewport.getRotation() - this.rotationIncrement); } this.viewport.applyConstraints(); event.preventDefault = true; @@ -3708,9 +3708,9 @@ function onRotateLeft() { var currRotation = this.viewport.getRotation(); if ( this.viewport.flipped ){ - currRotation = $.positiveModulo(currRotation + this.rotationIncrement, 360); + currRotation += this.rotationIncrement; } else { - currRotation = $.positiveModulo(currRotation - this.rotationIncrement, 360); + currRotation -= this.rotationIncrement; } this.viewport.setRotation(currRotation); } @@ -3721,9 +3721,9 @@ function onRotateRight() { var currRotation = this.viewport.getRotation(); if ( this.viewport.flipped ){ - currRotation = $.positiveModulo(currRotation - this.rotationIncrement, 360); + currRotation -= this.rotationIncrement; } else { - currRotation = $.positiveModulo(currRotation + this.rotationIncrement, 360); + currRotation += this.rotationIncrement; } this.viewport.setRotation(currRotation); } diff --git a/src/viewport.js b/src/viewport.js index 118f8184..d37bfbae 100644 --- a/src/viewport.js +++ b/src/viewport.js @@ -138,6 +138,7 @@ $.Viewport = function( options ) { springStiffness: this.springStiffness, animationTime: this.animationTime }); + delete options.degrees; this._oldCenterX = this.centerSpringX.current.value; this._oldCenterY = this.centerSpringY.current.value; @@ -904,8 +905,6 @@ $.Viewport.prototype = { this.degreesSpring.springTo(degrees); } - this.degrees = $.positiveModulo(this.degreesSpring.target.value, 360); - this._setContentBounds( this.viewer.world.getHomeBounds(), this.viewer.world.getContentFactor());