File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -423,7 +423,8 @@ var App = (function ($, publ) {
423
423
publ . setView = function ( ) {
424
424
425
425
var view = new ol . View ( {
426
- center : ol . proj . fromLonLat ( [ defaults . lon , defaults . lat ] ) ,
426
+ // Avoid flicker (map move)
427
+ //center: ol.proj.fromLonLat([defaults.lon, defaults.lat]),
427
428
zoom : defaults . zoom ,
428
429
maxZoom : defaults . maxzoom // applies for Mierune Tiles
429
430
} ) ;
@@ -469,12 +470,19 @@ var App = (function ($, publ) {
469
470
} ) ;
470
471
} ) ;
471
472
}
472
- else if ( geolocation ) {
473
- geolocation . once ( 'change:position' , function ( error ) {
474
- maps . forEach ( function ( m ) {
475
- m . getView ( ) . setCenter ( geolocation . getPosition ( ) ) ;
476
- } ) ;
473
+ else {
474
+ // Set default center, once
475
+ maps . forEach ( function ( m ) {
476
+ m . getView ( ) . setCenter ( ol . proj . transform ( [ defaults . lon , defaults . lat ] ,
477
+ 'EPSG:4326' , 'EPSG:3857' ) ) ;
477
478
} ) ;
479
+ if ( geolocation ) {
480
+ geolocation . once ( 'change:position' , function ( error ) {
481
+ maps . forEach ( function ( m ) {
482
+ m . getView ( ) . setCenter ( geolocation . getPosition ( ) ) ;
483
+ } ) ;
484
+ } ) ;
485
+ }
478
486
}
479
487
} ;
480
488
You can’t perform that action at this time.
0 commit comments