Skip to content

Commit d63edbd

Browse files
committed
Fix "Fit to data" zooming
1 parent 7733744 commit d63edbd

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Changelog
22

33
## development
4+
- Fix "Fit to data" zooming (#25)
45

56

67
## v0.7.0

src/worldmap.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,9 @@ export default class WorldMap {
337337
}
338338

339339
panToMapCenter(options?: any) {
340+
341+
console.log('panToMapCenter');
342+
340343
// Get a bunch of metadata from settings and data which
341344
// controls the map centering and zoom level.
342345
const mapDimensions = this.ctrl.settings.center;

src/worldmap_ctrl.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,15 +411,16 @@ export default class WorldmapCtrl extends MetricsPanelCtrl {
411411

412412
ctrl.map.resize();
413413

414-
if (ctrl.mapCenterMoved) {
415-
ctrl.map.panToMapCenter();
416-
}
417-
418414
if (!ctrl.map.legend && ctrl.panel.showLegend) {
419415
ctrl.map.createLegend();
420416
}
421417

422418
ctrl.map.drawCircles();
419+
420+
if (ctrl.mapCenterMoved) {
421+
ctrl.map.panToMapCenter();
422+
}
423+
423424
}
424425
}
425426

0 commit comments

Comments
 (0)