Skip to content

Commit

Permalink
Fix "Fit to data" zooming
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Dec 12, 2019
1 parent 7733744 commit d63edbd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## development
- Fix "Fit to data" zooming (#25)


## v0.7.0
Expand Down
3 changes: 3 additions & 0 deletions src/worldmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,9 @@ export default class WorldMap {
}

panToMapCenter(options?: any) {

console.log('panToMapCenter');

// Get a bunch of metadata from settings and data which
// controls the map centering and zoom level.
const mapDimensions = this.ctrl.settings.center;
Expand Down
9 changes: 5 additions & 4 deletions src/worldmap_ctrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,15 +411,16 @@ export default class WorldmapCtrl extends MetricsPanelCtrl {

ctrl.map.resize();

if (ctrl.mapCenterMoved) {
ctrl.map.panToMapCenter();
}

if (!ctrl.map.legend && ctrl.panel.showLegend) {
ctrl.map.createLegend();
}

ctrl.map.drawCircles();

if (ctrl.mapCenterMoved) {
ctrl.map.panToMapCenter();
}

}
}

Expand Down

0 comments on commit d63edbd

Please sign in to comment.