8000 Switch to getBBox and fix zoom.event call · plotly/plotly.js@84cd037 · GitHub
[go: up one dir, main page]

Skip to content

Commit 84cd037

Browse files
committed
Switch to getBBox and fix zoom.event call
1 parent c6007a8 commit 84cd037

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/plots/geo/geo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ proto.updateFx = function(fullLayout, 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
491-
zoom.event(bgRect.transition())
491+
zoom.event(bgRect)
492492
bgRect.on('dblclick.zoom', zoomReset);
493493
if(!gd._context._scrollZoom.geo) {
494494
bgRect.on('wheel.zoom', null);

src/plots/geo/zoom.js

Lines changed: 8 additions & 8 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-
var rect = this.getBoundingClientRect()
136+
var rect = this.getBBox()
137137
mouse0 = d3.event.sourceEvent
138138
? d3.mouse(this)
139-
: [(rect.left + rect.right) / 2, (rect.bottom + rect.top) / 2];
139+
: [rect.x + rect.width / 2, rect.y + rect.height / 2];
140140
rotate0 = projection.rotate();
141141
translate0 = projection.translate();
142142
lastRotate = rotate0;
143143
zoomPoint = position(mouse0);
144144
}
145145

146146
function handleZoom() {
147-
var rect = this.getBoundingClientRect()
147+
var rect = this.getBBox()
148148
mouse1 = d3.event.sourceEvent
149149
? d3.mouse(this)
150-
: [(rect.left + rect.right) / 2, (rect.bottom + rect.top) / 2];
150+
: [rect.x + rect.width / 2, rect.y + rect.height / 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-
var rect = this.getBoundingClientRect()
219+
var rect = this.getBBox()
220220
var mouse0 = d3.event.sourceEvent
221221
? d3.mouse(this)
222-
: [(rect.left + rect.right) / 2, (rect.bottom + rect.top) / 2];
222+
: [rect.x + rect.width / 2, rect.y + rect.height / 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-
var rect = this.getBoundingClientRect()
231+
var rect = this.getBBox()
232232
var mouse1 = d3.event.sourceEvent
233233
? d3.mouse(this)
234-
: [(rect.left + rect.right) / 2, (rect.bottom + rect.top) / 2];
234+
: [rect.x + rect.width / 2, rect.y + rect.height / 2];
235235

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

0 commit comments

Comments
 (0)
0