Skip to content

Commit 048f178

Browse files
committed
Switch to ES5 syntax
1 parent 29b4316 commit 048f178

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

src/components/modebar/buttons.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -544,19 +544,19 @@ function handleGeo(gd, ev) {
544544
if(attr === 'zoom') {
545545
var scale = geoLayout.projection.scale;
546546
var minscale = geoLayout.projection.minscale;
547-
var maxscale = geoLayout.projection.maxscale;
548-
549-
if(maxscale === -1) maxscale = Infinity;
547+
var maxscale = geoLayout.projection.maxscale === -1 ? Infinity : geoLayout.projection.maxscale;
548+
var max = Math.max(minscale, maxscale);
549+
var min = Math.min(minscale, maxscale);
550550
var newScale = (val === 'in') ? 2 * scale : 0.5 * scale;
551551

552552
// make sure the scale is within the min/max bounds
553-
if(newScale > maxscale) {
554-
newScale = maxscale;
555-
} else if(newScale < minscale) {
556-
newScale = minscale;
553+
if (newScale > max) {
554+
newScale = max;
555+
} else if (newScale < min) {
556+
newScale = min;
557557
}
558558

559-
if(newScale !== scale) {
559+
if (newScale !== scale) {
560560
Registry.call('_guiRelayout', gd, id + '.projection.scale', newScale);
561561
}
562562
}

src/plots/geo/geo.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ proto.updateFx = function(fullLayout, geoLayout) {
484484

485485
if(dragMode === 'pan') {
486486
bgRect.node().onmousedown = null;
487-
const zoom = createGeoZoom(_this, geoLayout)
487+
var zoom = createGeoZoom(_this, geoLayout)
488488
bgRect.call(zoom);
489489
// TODO: Figure out how to restrict when this transition occurs. Or is it a no-op if nothing has changed?
490490
// Trigger transition to handle if minscale attribute isn't 0
@@ -715,10 +715,10 @@ function getProjection(geoLayout) {
715715

716716
// https://d3js.org/d3-zoom#zoom_scaleExtent
717717
projection.scaleExtent = () => {
718-
let { minscale, maxscale } = projLayout;
719-
maxscale = maxscale === -1 ? Infinity : maxscale;
720-
const max = Math.max(minscale, maxscale);
721-
const min = Math.min(minscale, maxscale);
718+
var minscale = projLayout.minscale;
719+
var maxscale = projLayout.maxscale === -1 ? Infinity : projLayout.maxscale;
720+
var max = Math.max(minscale, maxscale);
721+
var min = Math.min(minscale, maxscale);
722722
return [100 * min, 100 * max];
723723
};
724724

src/plots/geo/zoom.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -133,21 +133,21 @@ function zoomNonClipped(geo, projection) {
133133
function handleZoomstart() {
134134
d3.select(this).style(zoomstartStyle);
135135

136-
const { bottom, left, right, top } = this.getBoundingClientRect()
136+
var rect = this.getBoundingClientRect()
137137
mouse0 = d3.event.sourceEvent
138138
? d3.mouse(this)
139-
: [(left + right) / 2, (bottom + top) / 2];
139+
: [(rect.left + rect.right) / 2, (rect.bottom + rect.top) / 2];
140140
rotate0 = projection.rotate();
141141
translate0 = projection.translate();
142142
lastRotate = rotate0;
143143
zoomPoint = position(mouse0);
144144
}
145145

146146
function handleZoom() {
147-
const { bottom, left, right, top } = this.getBoundingClientRect()
147+
var rect = this.getBoundingClientRect()
148148
mouse1 = d3.event.sourceEvent
149149
? d3.mouse(this)
150-
: [(left + right) / 2, (bottom + top) / 2];
150+
: [(rect.left + rect.right) / 2, (rect.bottom + rect.top) / 2];
151151
if(outside(mouse0)) {
152152
zoom.scale(projection.scale());
153153
zoom.translate(projection.translate());
@@ -216,10 +216,10 @@ function zoomClipped(geo, projection) {
216216
zoom.on('zoomstart', function() {
217217
d3.select(this).style(zoomstartStyle);
218218

219-
const { bottom, left, right, top } = this.getBoundingClientRect()
220-
let mouse0 = d3.event.sourceEvent
219+
var rect = this.getBoundingClientRect()
220+
var mouse0 = d3.event.sourceEvent
221221
? d3.mouse(this)
222-
: [(left + right) / 2, (bottom + top) / 2];
222+
: [(rect.left + rect.right) / 2, (rect.bottom + rect.top) / 2];
223223
var rotate0 = projection.rotate();
224224
var lastRotate = rotate0;
225225
var translate0 = projection.translate();
@@ -228,10 +228,10 @@ function zoomClipped(geo, projection) {
228228
zoomPoint = position(projection, mouse0);
229229

230230
zoomOn.call(zoom, 'zoom', function() {
231-
const { bottom, left, right, top } = this.getBoundingClientRect()
232-
let mouse1 = d3.event.sourceEvent
231+
var rect = this.getBoundingClientRect()
232+
var mouse1 = d3.event.sourceEvent
233233
? d3.mouse(this)
234-
: [(left + right) / 2, (bottom + top) / 2];
234+
: [(rect.left + rect.right) / 2, (rect.bottom + rect.top) / 2];
235235

236236
projection.scale(view.k = d3.event.scale);
237237

0 commit comments

Comments
 (0)