Skip to content

Commit a21d29c

Browse files
committed
(fixup) use geo.midPt in zoom.js
1 parent 152a396 commit a21d29c

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/plots/geo/zoom.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,7 @@ function zoomScoped(geo, projection) {
8484

8585
function syncCb(set) {
8686
var bounds = geo.bounds;
87-
var center = projection.invert([
88-
bounds[0][0] + (bounds[1][0] - bounds[0][0]) / 2,
89-
bounds[0][1] + (bounds[1][1] - bounds[0][1]) / 2
90-
]);
87+
var center = projection.invert(geo.midPt);
9188

9289
set('center.lon', center[0]);
9390
set('center.lat', center[1]);
@@ -167,10 +164,7 @@ function zoomNonClipped(geo, projection) {
167164
function syncCb(set) {
168165
var rotate = projection.rotate();
169166
var bounds = geo.bounds;
170-
var center = projection.invert([
171-
bounds[0][0] + (bounds[1][0] - bounds[0][0]) / 2,
172-
bounds[0][1] + (bounds[1][1] - bounds[0][1]) / 2
173-
]);
167+
var center = projection.invert(geo.midPt);
174168

175169
set('projection.rotation.lon', -rotate[0]);
176170
set('center.lon', center[0]);

0 commit comments

Comments
 (0)