mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
Improved alignment of pixels in scales at low widths (#8739)
* Improved alignment of pixels in scales at low widths * Undo scale changes
This commit is contained in:
parent
b2c7baf10d
commit
0b21578a3a
@ -102,7 +102,7 @@ export function _longestText(ctx, font, arrayOfThings, cache) {
|
||||
*/
|
||||
export function _alignPixel(chart, pixel, width) {
|
||||
const devicePixelRatio = chart.currentDevicePixelRatio;
|
||||
const halfWidth = width / 2;
|
||||
const halfWidth = width !== 0 ? Math.max(width / 2, 0.5) : 0;
|
||||
return Math.round((pixel - halfWidth) * devicePixelRatio) / devicePixelRatio + halfWidth;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user