mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 12:19:08 +02:00
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.
This commit is contained in:
parent
ab41173d9b
commit
3830216420
@ -383,7 +383,7 @@ module.exports = function() {
|
||||
helpers.getRelativePosition = function(evt, chart) {
|
||||
var mouseX, mouseY;
|
||||
var e = evt.originalEvent || evt;
|
||||
var canvas = evt.currentTarget || evt.srcElement;
|
||||
var canvas = evt.target || evt.srcElement;
|
||||
var boundingRect = canvas.getBoundingClientRect();
|
||||
|
||||
var touches = e.touches;
|
||||
|
Loading…
Reference in New Issue
Block a user