painterro icon indicating copy to clipboard operation
painterro copied to clipboard

getScale does not account for window.devicePixelRatio

Open jasonbarry opened this issue 3 years ago • 2 comments

Describe the bug html2canvas defaults to window.devicePixelRatio for the scale property (docs), but getScale does not account for it. When scale is passed to html2canvas, it overwrites the default value. This results in a blurry canvas for Retina / 2x displays.

Painterro version v1.2.57

Expected behavior I expect the arrows, text, lines, shapes, and other tools to not draw as blurry when using a Retina display.

Browser Chrome 91.0.4472.106 , Safari 14.1.1

jasonbarry avatar Jun 16 '21 20:06 jasonbarry

Thanks a lot @jasonbarry . Just in case you need it urgently feel free to change that line of code and multiply by (window.devicePixelRatio || 1). Would be glad to accept PR.

ivictbor avatar Jun 16 '21 20:06 ivictbor

Thanks for the quick response @ivictbor -- in my first tests, it looks like window.devicePixelRatio needs to be placed somewhere else so that it doesn't affect the rest of the coordinate system. I'll let you know if I find the right place to put it 👍

jasonbarry avatar Jun 16 '21 20:06 jasonbarry

Since version 1.2.64 html@canvas has been changed to dom-to-image.

IhorStorozhok avatar Apr 10 '24 09:04 IhorStorozhok