Skip to content

Commit 1254e73

Browse files
authored
Merge pull request #4419 from plotly/locationmode-geojson-id
Geo improvements: fitbounds, 'geojson-id' locationmode and 'featureidkey'
2 parents 239a837 + b5b9484 commit 1254e73

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+3156
-626
lines changed

package-lock.json

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"@plotly/d3-sankey": "0.7.2",
6060
"@plotly/d3-sankey-circular": "0.33.1",
6161
"@turf/area": "^6.0.1",
62+
"@turf/bbox": "^6.0.1",
6263
"@turf/centroid": "^6.0.2",
6364
"alpha-shape": "^1.0.0",
6465
"canvas-fit": "^1.5.0",

src/components/modebar/buttons.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ function handleDrag3d(gd, ev) {
303303
var button = ev.currentTarget;
304304
var attr = button.getAttribute('data-attr');
305305
var val = button.getAttribute('data-val') || true;
306-
var sceneIds = gd._fullLayout._subplots.gl3d;
306+
var sceneIds = gd._fullLayout._subplots.gl3d || [];
307307
var layoutUpdate = {};
308308

309309
var parts = attr.split('.');
@@ -468,7 +468,7 @@ function handleGeo(gd, ev) {
468468
var attr = button.getAttribute('data-attr');
469469
var val = button.getAttribute('data-val') || true;
470470
var fullLayout = gd._fullLayout;
471-
var geoIds = fullLayout._subplots.geo;
471+
var geoIds = fullLayout._subplots.geo || [];
472472

473473
for(var i = 0; i < geoIds.length; i++) {
474474
var id = geoIds[i];
@@ -479,10 +479,12 @@ function handleGeo(gd, ev) {
479479
var newScale = (val === 'in') ? 2 * scale : 0.5 * scale;
480480

481481
Registry.call('_guiRelayout', gd, id + '.projection.scale', newScale);
482-
} else if(attr === 'reset') {
483-
resetView(gd, 'geo');
484482
}
485483
}
484+
485+
if(attr === 'reset') {
486+
resetView(gd, 'geo');
487+
}
486488
}
487489

488490
modeBarButtons.hoverClosestGl2d = {

0 commit comments

Comments
 (0)