Skip to content

Commit

Permalink
Merge pull request #342 from EarthJournalismNetwork/bugfix/remove-foc…
Browse files Browse the repository at this point in the history
…us-animation

Replace flyto to setCenter and setZoom
  • Loading branch information
pamelars86 authored Mar 4, 2021
2 parents d93893d + 4a4014a commit 46515d8
Showing 1 changed file with 5 additions and 25 deletions.
30 changes: 5 additions & 25 deletions src/js/src/jeo-map/class-jeo-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,31 +34,11 @@ export default class JeoMap {
this.initMap()
.then( () => {
if ( this.getArg( 'layers' ) && this.getArg( 'layers' ).length > 0 ) {
// console.log( );
map.on( 'load', () => {
if ( this.isEmbed ) {
map.flyTo( {
center: [
this.getArg( 'center_lon' ),
this.getArg( 'center_lat' ),
],
zoom: this.getArg( 'initial_zoom' ),
} );
} else {
// map.setZoom( this.getArg( 'initial_zoom' ) );
// map.setCenter( [
// this.getArg( 'center_lon' ),
// this.getArg( 'center_lat' ),
// ] );
map.flyTo( {
center: [
this.getArg( 'center_lon' ),
this.getArg( 'center_lat' ),
],
zoom: this.getArg( 'initial_zoom' ),
} );
}
} );
map.setZoom( this.getArg( 'initial_zoom' ) );
map.setCenter( [
this.getArg( 'center_lon' ),
this.getArg( 'center_lat' ),
] );

map.addControl(
new mapboxgl.NavigationControl( { showCompass: false } ),
Expand Down

0 comments on commit 46515d8

Please sign in to comment.