diff --git a/touchscreen/__init__.py b/touchscreen/__init__.py index 41bdb11..d727ec2 100644 --- a/touchscreen/__init__.py +++ b/touchscreen/__init__.py @@ -314,6 +314,19 @@ def ts_onload(): canvas.style.height = ctx.canvas.height + 'px'; wrapper.style.width = ctx.canvas.width + 'px'; + + /* Get DPR with 1 as fallback */ + var dpr = window.devicePixelRatio || 1; + + /* CSS size is the same */ + canvas.style.height = ctx.canvas.height + 'px'; + wrapper.style.width = ctx.canvas.width + 'px'; + + /* Increase DOM size and scale */ + ctx.canvas.width *= dpr; + ctx.canvas.height *= dpr; + ctx.scale(dpr, dpr); + update_pen_settings() }