File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -335,13 +335,22 @@ export class GttClient {
335
335
this . toolbar . addControl ( maximizeCtrl )
336
336
337
337
// Map rotation
338
+ function radiansToDegrees ( radians :number ) {
339
+ let degrees = radians * ( 180 / Math . PI )
340
+ degrees = ( degrees % 360 + 360 ) % 360
341
+ return degrees
342
+ }
343
+
344
+ function degreesToRadians ( degrees :number ) {
345
+ return degrees * ( Math . PI / 180 )
346
+ }
347
+
338
348
const rotation_field = document . querySelector ( '#settings_project_map_rotation' )
339
349
if ( rotation_field !== null ) {
340
350
this . map . getView ( ) . on ( 'change:rotation' , ( evt ) => {
341
- const degrees = evt . target . getRotation ( ) * 180 / Math . PI
342
351
rotation_field . setAttribute (
343
352
'value' ,
344
- String ( Math . round ( degrees % 360 ) )
353
+ String ( Math . round ( radiansToDegrees ( evt . target . getRotation ( ) ) ) )
345
354
)
346
355
} )
347
356
}
You can’t perform that action at this time.
0 commit comments