Skip to content

Commit

Permalink
[Maps] tighten default map zoom (#56069)
Browse files Browse the repository at this point in the history
* [Maps] tighten default map zoom

* rework using bounds to work on multiple screen resolutions

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
nreese and elasticmachine authored Jan 29, 2020
1 parent 759663c commit 59c90f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ export class MBMapContainer extends React.Component {
}

async _createMbMapInstance() {
const initialView = this.props.goto ? this.props.goto.center : null;
return new Promise(resolve => {
const mbStyle = {
version: 8,
Expand All @@ -127,12 +126,15 @@ export class MBMapContainer extends React.Component {
preserveDrawingBuffer: chrome.getInjected('preserveDrawingBuffer', false),
interactive: !this.props.disableInteractive,
};
const initialView = _.get(this.props.goto, 'center');
if (initialView) {
options.zoom = initialView.zoom;
options.center = {
lng: initialView.lon,
lat: initialView.lat,
};
} else {
options.bounds = [-170, -60, 170, 75];
}
const mbMap = new mapboxgl.Map(options);
mbMap.dragRotate.disable();
Expand Down
7 changes: 2 additions & 5 deletions x-pack/legacy/plugins/maps/public/reducers/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,8 @@ const INITIAL_STATE = {
goto: null,
tooltipState: null,
mapState: {
zoom: 4,
center: {
lon: -100.41,
lat: 32.82,
},
zoom: null, // setting this value does not adjust map zoom, read only value used to store current map zoom for persisting between sessions
center: null, // setting this value does not adjust map view, read only value used to store current map center for persisting between sessions
scrollZoom: true,
extent: null,
mouseCoordinates: null,
Expand Down

0 comments on commit 59c90f1

Please sign in to comment.