Skip to content

Commit f2478f9

Browse files
authored
Merge pull request #2709 from plotly/mapbox-scroll
plotly_relayout on mapbox scroll
2 parents 95c88e6 + 6903320 commit f2478f9

14 files changed

+62
-284
lines changed

package-lock.json

Lines changed: 35 additions & 271 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
"glslify": "^6.1.1",
8787
"has-hover": "^1.0.1",
8888
"has-passive-events": "^1.0.0",
89-
"mapbox-gl": "0.44.1",
89+
"mapbox-gl": "0.45.0",
9090
"matrix-camera-controller": "^2.1.3",
9191
"mouse-change": "^1.4.0",
9292
"mouse-event-offset": "^3.0.2",

src/plots/mapbox/constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
'use strict';
1010

11-
var requiredVersion = '0.44.1';
11+
var requiredVersion = '0.45.0';
1212

1313
module.exports = {
1414
requiredVersion: requiredVersion,

src/plots/mapbox/mapbox.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ proto.createMap = function(calcData, fullLayout, resolve, reject) {
130130

131131
if(self.isStatic) return;
132132

133+
var wheeling = false;
134+
133135
// keep track of pan / zoom in user layout and emit relayout event
134136
map.on('moveend', function(eventData) {
135137
if(!self.map) return;
@@ -149,11 +151,16 @@ proto.createMap = function(calcData, fullLayout, resolve, reject) {
149151
// mouse target (filtering out API calls) to not
150152
// duplicate 'plotly_relayout' events.
151153

152-
if(eventData.originalEvent) {
154+
if(eventData.originalEvent || wheeling) {
153155
var update = {};
154156
update[self.id] = Lib.extendFlat({}, view);
155157
gd.emit('plotly_relayout', update);
156158
}
159+
wheeling = false;
160+
});
161+
162+
map.on('wheel', function() {
163+
wheeling = true;
157164
});
158165

159166
map.on('mousemove', function(evt) {

test/image/baselines/mapbox_0.png

89 Bytes
Loading
7 KB
Loading
709 Bytes
Loading
71 Bytes
Loading
-48 Bytes
Loading
-15.1 KB
Loading

0 commit comments

Comments
 (0)