eclipsesource / eclipsesource/tabris-js
Support attaching events to canvas with addEventListener(eventType,method)
- Dominant language
- JavaScript
- Stars
- 1.4k
- Forks
- 171
- PR merge metrics
- No merged PRs in 30d
Description
chart.js tries to attach listeners to the canvas like this:
```
addEvent = helpers.addEvent = function(node,eventType,method){
if (node.addEventListener){
node.addEventListener(eventType,method);
} else if (node.attachEvent){
node.attachEvent("on"+eventType, method);
} else {
node["on"+eventType] = method;
}
```
`node` is the canvas of our CanvasContext (chartInstance.chart.canvas)
`eventType` can be passed by the configuration of the chart, so we could use "Selection"
There might be better ways to support chart.js than using addEventListeners ...
Maybe it would make sense to support an API like this for all widgets?
Contributor guide
Assessment
This issue has not been assessed yet.