mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
Fix charts shinking in size on certain Zoom values in Chrome (#12097)
This commit is contained in:
parent
b5ee134eff
commit
5feebdf7b7
@ -211,11 +211,11 @@ export function retinaScale(
|
||||
forceStyle?: boolean
|
||||
): boolean | void {
|
||||
const pixelRatio = forceRatio || 1;
|
||||
const deviceHeight = Math.floor(chart.height * pixelRatio);
|
||||
const deviceWidth = Math.floor(chart.width * pixelRatio);
|
||||
const deviceHeight = round1(chart.height * pixelRatio);
|
||||
const deviceWidth = round1(chart.width * pixelRatio);
|
||||
|
||||
(chart as PrivateChart).height = Math.floor(chart.height);
|
||||
(chart as PrivateChart).width = Math.floor(chart.width);
|
||||
(chart as PrivateChart).height = round1(chart.height);
|
||||
(chart as PrivateChart).width = round1(chart.width);
|
||||
|
||||
const canvas = chart.canvas;
|
||||
|
||||
|
||||
@ -268,8 +268,8 @@ describe('DOM helpers tests', function() {
|
||||
helpers.retinaScale(chart, devicePixelRatio, true);
|
||||
|
||||
var canvas = chart.canvas;
|
||||
expect(canvas.width).toBe(Math.floor(chartWidth * devicePixelRatio));
|
||||
expect(canvas.height).toBe(Math.floor(chartHeight * devicePixelRatio));
|
||||
expect(canvas.width).toBe(Math.round(chartWidth * devicePixelRatio));
|
||||
expect(canvas.height).toBe(Math.round(chartHeight * devicePixelRatio));
|
||||
|
||||
expect(chart.width).toBe(chartWidth);
|
||||
expect(chart.height).toBe(chartHeight);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user