Skip to content

Commit

Permalink
view state
Browse files Browse the repository at this point in the history
  • Loading branch information
dcooley committed May 21, 2024
1 parent 949e1f2 commit a18a67e
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions inst/htmlwidgets/mapdeck_location.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,21 @@ function md_change_location( map_id, map_type, location, zoom, pitch, bearing, d
var currentMinPitch;
var currentViewState;

if( map_type == "google_map" ) {
//console.log( location );
window[map_id + 'map'].setCenter( { lat: location[1], lng: location[0] } );
window[map_id + 'map'].setZoom( zoom );
} else {
if( map_type == "google_map" ) {
//console.log( location );
window[map_id + 'map'].setCenter( { lat: location[1], lng: location[0] } );
window[map_id + 'map'].setZoom( zoom );
} else {

console.log( window[ map_id + 'map' ].viewManager.getViewState(map_id).longitude );
//console.log( window[ map_id + 'map' ].viewManager );

if( window[ map_id + 'map'].viewManager !== null ) {

currentViewState = window[ map_id + 'map'].viewManager.getViewState(map_id)
} else {
currentViewState = window[ map_id + 'map'];
}

currentViewState = window[ map_id + 'map'].viewManager.getViewState(map_id)
currentLon = (location === null || location.length == 0) ? currentViewState.longitude : location[0];
currentLat = (location === null || location.length == 0) ? currentViewState.latitude : location[1];
currentPitch = pitch === null ? currentViewState.pitch : pitch;
Expand Down Expand Up @@ -45,7 +51,6 @@ function md_change_location( map_id, map_type, location, zoom, pitch, bearing, d
controller: true
}
});

}
}

Expand Down

0 comments on commit a18a67e

Please sign in to comment.