Commit 5414702
committed
Use integer canvas dimensions
As a result of chartjs#12097, the HTMLCanvasElement's `width` and `height` (which are always integers - see [MDN][1]) may be compared to fractional `deviceWidth` and `deviceHeight`, resulting in extra resize and update events being fired.
This PR rounds the dimensions for purposes of comparing to the canvas element's, which should put the behavior closer to Chart.js 4.5.0 and earlier.
I've tested this against chartjs#11224 and against my own code (which was generating errors due to an interaction between these extra events and some internal plugins), and it seems to work, but other testing and feedback is welcome.
[1]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement#instance_properties1 parent e8c58da commit 5414702
1 file changed
+6
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
| 230 | + | |
| 231 | + | |
230 | 232 | | |
231 | | - | |
232 | | - | |
| 233 | + | |
| 234 | + | |
233 | 235 | | |
234 | | - | |
235 | | - | |
| 236 | + | |
| 237 | + | |
236 | 238 | | |
237 | 239 | | |
238 | 240 | | |
| |||
0 commit comments