Skip to content

Commit 5a2e024

Browse files
committed
WIP: fix missing fonts, guard null pattern
Signed-off-by: Taro Matsuzawa <[email protected]>
1 parent 8c18b9f commit 5a2e024

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/components/gtt-client.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ export class GttClient {
236236

237237
// Control button
238238
const maximizeCtrl = new Button({
239-
html: '<i class="icon-maximize" ></i>',
239+
html: '<i class="gtt-icon-maximize" ></i>',
240240
title: "Maximize",
241241
handleClick: () => {
242242
this.zoomToExtent(true);
@@ -304,10 +304,13 @@ export class GttClient {
304304
if (document.querySelectorAll('tr#tr_distance').length > 0) {
305305
this.filters.distance = true
306306
}
307-
document.querySelector('fieldset#location legend').addEventListener('click', (evt) => {
308-
const element = evt.currentTarget as HTMLLegendElement
309-
this.toggleAndLoadMap(element)
310-
})
307+
const legend = document.querySelector('fieldset#location legend') as HTMLLegendElement
308+
if (legend) {
309+
legend.addEventListener('click', (evt) => {
310+
const element = evt.currentTarget as HTMLLegendElement
311+
this.toggleAndLoadMap(element)
312+
})
313+
}
311314
this.zoomToExtent()
312315
this.map.on('moveend', this.updateFilter.bind(this))
313316

@@ -409,7 +412,7 @@ export class GttClient {
409412
})
410413

411414
const control = new Toggle({
412-
html: `<i class="icon-${type.toLowerCase()}" ></i>`,
415+
html: `<i class="gtt-icon-${type.toLowerCase()}" ></i>`,
413416
title: type,
414417
interaction: draw
415418
} as any)
@@ -418,7 +421,7 @@ export class GttClient {
418421

419422
// Upload button
420423
editbar.addControl(new Button({
421-
html: '<i class="icon-book" ></i>',
424+
html: '<i class="gtt-icon-book" ></i>',
422425
title: 'Upload GeoJSON',
423426
handleClick: () => {
424427
const data = prompt("Please paste a GeoJSON geometry here")
@@ -771,7 +774,9 @@ export class GttClient {
771774
center = transform(center,'EPSG:3857','EPSG:4326')
772775
// console.log("Map Center (WGS84): ", center);
773776
const fieldset = document.querySelector('fieldset#location') as HTMLFieldSetElement
774-
fieldset.dataset.center = JSON.stringify(center)
777+
if (fieldset) {
778+
fieldset.dataset.center = JSON.stringify(center)
779+
}
775780
const value_distance_3 = document.querySelector('#tr_distance #values_distance_3') as HTMLInputElement
776781
if (value_distance_3) {
777782
value_distance_3.value = center[0].toString()
@@ -889,7 +894,7 @@ export class GttClient {
889894

890895
// Control button
891896
const geolocationCtrl = new Toggle({
892-
html: '<i class="icon-compass" ></i>',
897+
html: '<i class="gtt-icon-compass" ></i>',
893898
title: "Geolocation",
894899
active: false,
895900
onToggle: (active: boolean) => {

0 commit comments

Comments
 (0)