提交 950de475 编写于 作者: H hdx

canvas: 调整 pixelRatio 获取方式

上级 479d0778
......@@ -47,7 +47,7 @@
<script>
function hidpi(canvas : UniCanvasElement) {
const context = canvas.getContext("2d")!;
const dpr = uni.getDeviceInfo().devicePixelRatio ?? 1;
const dpr = uni.getWindowInfo().pixelRatio ?? 1;
canvas.width = canvas.offsetWidth * dpr;
canvas.height = canvas.offsetHeight * dpr;
context.scale(dpr, dpr);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册