@@ -193,7 +193,6 @@ export class GttClient {
193
193
this . vector . set ( 'displayInLayerSwitcher' , false )
194
194
this . layerArray . push ( this . vector )
195
195
this . map . addLayer ( this . vector )
196
- console . log ( this . layerArray )
197
196
198
197
// Render project boundary if bounds are available
199
198
if ( this . contents . bounds && this . contents . bounds !== null ) {
@@ -298,21 +297,23 @@ export class GttClient {
298
297
// Because Redmine filter functions are applied later, the Window onload
299
298
// event provides a workaround to have filters loaded before executing
300
299
// the following code
301
- if ( document . querySelectorAll ( 'tr#tr_bbox' ) . length > 0 ) {
302
- this . filters . location = true
303
- }
304
- if ( document . querySelectorAll ( 'tr#tr_distance' ) . length > 0 ) {
305
- this . filters . distance = true
306
- }
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
- }
314
- this . zoomToExtent ( )
315
- this . map . on ( 'moveend' , this . updateFilter . bind ( this ) )
300
+ window . addEventListener ( 'load' , ( ) => {
301
+ if ( document . querySelectorAll ( 'tr#tr_bbox' ) . length > 0 ) {
302
+ this . filters . location = true
303
+ }
304
+ if ( document . querySelectorAll ( 'tr#tr_distance' ) . length > 0 ) {
305
+ this . filters . distance = true
306
+ }
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
+ }
314
+ this . zoomToExtent ( )
315
+ this . map . on ( 'moveend' , this . updateFilter . bind ( this ) )
316
+ } )
316
317
317
318
// To fix an issue with empty map after changing the tracker type
318
319
document . querySelectorAll ( 'select#issue_tracker_id' ) . forEach ( element => {
@@ -475,7 +476,7 @@ export class GttClient {
475
476
const url = popup_contents . href . replace ( / \[ ( .+ ?) \] / g, feature . get ( 'id' ) )
476
477
content . push ( `<a href="${ url } ">Edit</a>` )
477
478
478
- popup . show ( getCenter ( feature . getGeometry ( ) . getExtent ( ) ) , content as any )
479
+ popup . show ( feature . getGeometry ( ) . getFirstCoordinate ( ) , content as any )
479
480
} )
480
481
481
482
select . getFeatures ( ) . on ( [ 'remove' ] , _ => {
@@ -1179,6 +1180,7 @@ export class GttClient {
1179
1180
this . maps . forEach ( function ( m ) {
1180
1181
m . updateSize ( )
1181
1182
} )
1183
+ this . zoomToExtent ( )
1182
1184
}
1183
1185
1184
1186
0 commit comments