Skip to content

Commit b89ad9f

Browse files
committed
sub remove/add EventListeners for 'onmousemove' & 'onclick' properties
1 parent a0ce5e7 commit b89ad9f

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

shelly/plotlyjs/static/plotlyjs/src/graph_interact.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -176,20 +176,15 @@ fx.init = function(gd) {
176176
// but still be able to interact with everything as if it isn't there
177177
var hoverLayer = fullLayout._hoverlayer.node();
178178

179-
function mousemoveHandler(evt) {
179+
hoverLayer.onmousemove = function(evt) {
180180
evt.target = fullLayout._lasthover;
181181
fx.hover(gd, evt, fullLayout._hoversubplot);
182-
}
182+
};
183183

184-
function clickHandler(evt) {
184+
hoverLayer.onclick = function(evt) {
185185
evt.target = fullLayout._lasthover;
186186
fx.click(gd, evt);
187-
}
188-
189-
hoverLayer.removeEventListener('mousemove', mousemoveHandler);
190-
hoverLayer.removeEventListener('click', clickHandler);
191-
hoverLayer.addEventListener('mousemove', mousemoveHandler);
192-
hoverLayer.addEventListener('click', clickHandler);
187+
};
193188

194189
// also delegate mousedowns... TODO: does this actually work?
195190
hoverLayer.onmousedown = function(evt) {

0 commit comments

Comments
 (0)