Skip to content

Commit e6618c6

Browse files
committed
move dummy scroll listener to Events.init()
1 parent 06c3e7f commit e6618c6

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/lib/events.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ var Events = {
5959
internalEv.emit(event, data);
6060
};
6161

62+
/*
63+
* Add a dummy event handler for 'wheel' event for Safari
64+
* to enable mouse wheel zoom.
65+
* https://github.com/d3/d3/issues/3035
66+
* https://github.com/plotly/plotly.js/issues/7452
67+
*/
68+
if(typeof plotObj.addEventListener === 'function') {
69+
plotObj.addEventListener("wheel", () => {});
70+
}
71+
6272
return plotObj;
6373
},
6474

src/plot_api/plot_api.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,6 @@ function _doPlot(gd, data, layout, config) {
6464
// Events.init is idempotent and bails early if gd has already been init'd
6565
Events.init(gd);
6666

67-
// Add dummy event handler for 'wheel' event for Safari
68-
// to enable mouse wheel zoom
69-
// https://github.com/d3/d3/issues/3035
70-
// https://github.com/plotly/plotly.js/issues/7452
71-
d3.select(gd).on('wheel', function() {});
72-
7367
if(Lib.isPlainObject(data)) {
7468
var obj = data;
7569
data = obj.data;

0 commit comments

Comments
 (0)