@@ -335,24 +335,19 @@ 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
-
348
- const rotation_field = document . querySelector ( '#gtt_configuration_map_rotation' )
338
+ const rotation_field = document . querySelector ( '#gtt_configuration_map_rotation' ) as HTMLElement
349
339
if ( rotation_field !== null ) {
350
340
this . map . getView ( ) . on ( 'change:rotation' , ( evt ) => {
351
341
rotation_field . setAttribute (
352
342
'value' ,
353
343
String ( Math . round ( radiansToDegrees ( evt . target . getRotation ( ) ) ) )
354
344
)
355
345
} )
346
+
347
+ // TODO: remove readonly flag from field and update map on input
348
+ // rotation_field.addEventListener("oninput", (evt) => {
349
+ // console.log(evt)
350
+ // })
356
351
}
357
352
358
353
if ( this . contents . edit ) {
@@ -849,7 +844,8 @@ export class GttClient {
849
844
// Avoid flicker (map move)
850
845
center : center ,
851
846
zoom : parseInt ( this . defaults . zoom ) ,
852
- maxZoom : parseInt ( this . defaults . maxzoom ) // applies for Mierune Tiles
847
+ maxZoom : parseInt ( this . defaults . maxzoom ) , // applies for Mierune Tiles
848
+ rotation : degreesToRadians ( parseInt ( this . map . getTargetElement ( ) . getAttribute ( "data-rotation" ) ) )
853
849
} )
854
850
this . map . setView ( view )
855
851
}
@@ -1382,6 +1378,16 @@ const getCookie = (cname:string):string => {
1382
1378
return ''
1383
1379
}
1384
1380
1381
+ const radiansToDegrees = ( radians : number ) => {
1382
+ let degrees = radians * ( 180 / Math . PI )
1383
+ degrees = ( degrees % 360 + 360 ) % 360
1384
+ return degrees
1385
+ }
1386
+
1387
+ const degreesToRadians = ( degrees : number ) => {
1388
+ return degrees * ( Math . PI / 180 )
1389
+ }
1390
+
1385
1391
const getMapSize = ( map : Map ) => {
1386
1392
let size = map . getSize ( )
1387
1393
if ( size . length === 2 && size [ 0 ] <= 0 && size [ 1 ] <= 0 ) {
0 commit comments