removed modulo for degrees to avoid spining

This commit is contained in:
jonasengelmann 2022-03-30 22:59:29 +02:00
parent 8746e8b243
commit dc2a1534d3
2 changed files with 9 additions and 10 deletions

View File

@ -2810,18 +2810,18 @@ function onCanvasKeyPress( event ) {
break; break;
case 114: //r - clockwise rotation case 114: //r - clockwise rotation
if(this.viewport.flipped){ if(this.viewport.flipped){
this.viewport.setRotation($.positiveModulo(this.viewport.getRotation() - this.rotationIncrement, 360)); this.viewport.setRotation(this.viewport.getRotation() - this.rotationIncrement);
} else{ } else{
this.viewport.setRotation($.positiveModulo(this.viewport.getRotation() + this.rotationIncrement, 360)); this.viewport.setRotation(this.viewport.getRotation() + this.rotationIncrement);
} }
this.viewport.applyConstraints(); this.viewport.applyConstraints();
event.preventDefault = true; event.preventDefault = true;
break; break;
case 82: //R - counterclockwise rotation case 82: //R - counterclockwise rotation
if(this.viewport.flipped){ if(this.viewport.flipped){
this.viewport.setRotation($.positiveModulo(this.viewport.getRotation() + this.rotationIncrement, 360)); this.viewport.setRotation(this.viewport.getRotation() + this.rotationIncrement);
} else{ } else{
this.viewport.setRotation($.positiveModulo(this.viewport.getRotation() - this.rotationIncrement, 360)); this.viewport.setRotation(this.viewport.getRotation() - this.rotationIncrement);
} }
this.viewport.applyConstraints(); this.viewport.applyConstraints();
event.preventDefault = true; event.preventDefault = true;
@ -3708,9 +3708,9 @@ function onRotateLeft() {
var currRotation = this.viewport.getRotation(); var currRotation = this.viewport.getRotation();
if ( this.viewport.flipped ){ if ( this.viewport.flipped ){
currRotation = $.positiveModulo(currRotation + this.rotationIncrement, 360); currRotation += this.rotationIncrement;
} else { } else {
currRotation = $.positiveModulo(currRotation - this.rotationIncrement, 360); currRotation -= this.rotationIncrement;
} }
this.viewport.setRotation(currRotation); this.viewport.setRotation(currRotation);
} }
@ -3721,9 +3721,9 @@ function onRotateRight() {
var currRotation = this.viewport.getRotation(); var currRotation = this.viewport.getRotation();
if ( this.viewport.flipped ){ if ( this.viewport.flipped ){
currRotation = $.positiveModulo(currRotation - this.rotationIncrement, 360); currRotation -= this.rotationIncrement;
} else { } else {
currRotation = $.positiveModulo(currRotation + this.rotationIncrement, 360); currRotation += this.rotationIncrement;
} }
this.viewport.setRotation(currRotation); this.viewport.setRotation(currRotation);
} }

View File

@ -138,6 +138,7 @@ $.Viewport = function( options ) {
springStiffness: this.springStiffness, springStiffness: this.springStiffness,
animationTime: this.animationTime animationTime: this.animationTime
}); });
delete options.degrees;
this._oldCenterX = this.centerSpringX.current.value; this._oldCenterX = this.centerSpringX.current.value;
this._oldCenterY = this.centerSpringY.current.value; this._oldCenterY = this.centerSpringY.current.value;
@ -904,8 +905,6 @@ $.Viewport.prototype = {
this.degreesSpring.springTo(degrees); this.degreesSpring.springTo(degrees);
} }
this.degrees = $.positiveModulo(this.degreesSpring.target.value, 360);
this._setContentBounds( this._setContentBounds(
this.viewer.world.getHomeBounds(), this.viewer.world.getHomeBounds(),
this.viewer.world.getContentFactor()); this.viewer.world.getContentFactor());