Skip to content

Commit 341fb82

Browse files
committed
Fixes set attribute
Signed-off-by: Daniel Kastl <[email protected]>
1 parent 182e4f2 commit 341fb82

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/components/gtt-client.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -319,13 +319,16 @@ export class GttClient {
319319
this.toolbar.addControl(maximizeCtrl)
320320

321321
// Map rotation
322-
this.map.getView().on('change:rotation', (evt) => {
323-
const degrees = evt.target.getRotation() * 180 / Math.PI
324-
document.querySelector('#settings_project_map_rotation').setAttribute(
325-
'value',
326-
String(Math.round(degrees % 360))
327-
)
328-
})
322+
const rotation_field = document.querySelector('#settings_project_map_rotation')
323+
if (rotation_field !== null) {
324+
this.map.getView().on('change:rotation', (evt) => {
325+
const degrees = evt.target.getRotation() * 180 / Math.PI
326+
rotation_field.setAttribute(
327+
'value',
328+
String(Math.round(degrees % 360))
329+
)
330+
})
331+
}
329332

330333
if (this.contents.edit) {
331334
this.setControls(this.contents.edit.split(' '))

0 commit comments

Comments
 (0)