Skip to content

Commit 3830216

Browse files
teromansimonbrunel
authored andcommitted
Event handling to use target instead currentTarget (#5575)
If you attach event handlers to a container rather than directly to the canvas then the currentTarget is the container, event.target is the canvas that triggers the event. It's useful to do this if you have many charts or are creating them dynamically.
1 parent ab41173 commit 3830216

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/core/core.helpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ module.exports = function() {
383383
helpers.getRelativePosition = function(evt, chart) {
384384
var mouseX, mouseY;
385385
var e = evt.originalEvent || evt;
386-
var canvas = evt.currentTarget || evt.srcElement;
386+
var canvas = evt.target || evt.srcElement;
387387
var boundingRect = canvas.getBoundingClientRect();
388388

389389
var touches = e.touches;

0 commit comments

Comments
 (0)