From dd631b6d2c7553851545bd45dd48f7c998e29a95 Mon Sep 17 00:00:00 2001 From: handongxun Date: Tue, 23 Apr 2019 18:20:42 +0800 Subject: [PATCH] =?UTF-8?q?update:=20H5=20=E4=BB=85=E5=AF=B9=E4=BD=BF?= =?UTF-8?q?=E7=94=A8uni=E5=88=9B=E5=BB=BA=E7=9A=84canvas=E5=81=9A=E9=AB=98?= =?UTF-8?q?=E6=B8=85=E5=A4=84=E7=90=86.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/helpers/hidpi.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/core/helpers/hidpi.js b/src/core/helpers/hidpi.js index e3bb8e856..b235568d6 100644 --- a/src/core/helpers/hidpi.js +++ b/src/core/helpers/hidpi.js @@ -41,7 +41,7 @@ if (pixelRatio !== 1) { forEach(ratioArgs, function (value, key) { proto[key] = (function (_super) { return function () { - if (this.__ignore__) { + if (!this.__hidpi__) { return _super.apply(this, arguments) } @@ -63,7 +63,7 @@ if (pixelRatio !== 1) { proto.stroke = (function (_super) { return function () { - if (this.__ignore__) { + if (!this.__hidpi__) { return _super.apply(this, arguments) } this.lineWidth *= pixelRatio @@ -74,7 +74,7 @@ if (pixelRatio !== 1) { proto.fillText = (function (_super) { return function () { - if (this.__ignore__) { + if (!this.__hidpi__) { return _super.apply(this, arguments) } const args = Array.prototype.slice.call(arguments) @@ -102,7 +102,7 @@ if (pixelRatio !== 1) { proto.strokeText = (function (_super) { return function () { - if (this.__ignore__) { + if (!this.__hidpi__) { return _super.apply(this, arguments) } var args = Array.prototype.slice.call(arguments) @@ -130,7 +130,7 @@ if (pixelRatio !== 1) { proto.drawImageByCanvas = (function (_super) { return function (canvas, srcx, srcy, srcw, srch, desx, desy, desw, desh, isScale) { - if (this.__ignore__) { + if (!this.__hidpi__) { return _super.apply(this, arguments) } srcx *= pixelRatio @@ -147,7 +147,7 @@ if (pixelRatio !== 1) { proto.drawImage = (function (_super) { return function () { - if (this.__ignore__) { + if (!this.__hidpi__) { return _super.apply(this, arguments) } this.scale(pixelRatio, pixelRatio) @@ -162,6 +162,7 @@ export function wrapper (canvas) { canvas.style.width = canvas.width + 'px' canvas.width *= pixelRatio canvas.height *= pixelRatio + canvas.getContext('2d').__hidpi__ = true console.log(canvas.width) console.log(canvas.height) -- GitLab