From 56108465df590755107c43c157edd5de2bce66ec Mon Sep 17 00:00:00 2001 From: itorr Date: Sun, 14 Aug 2022 17:53:19 +0800 Subject: [PATCH] =?UTF-8?q?iOS=20Safari=20=E5=88=9D=E6=AC=A1=E5=BC=80?= =?UTF-8?q?=E5=90=AF=E9=A1=B5=E9=9D=A2=E8=BE=93=E5=87=BA=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E7=99=BD=E5=9B=BE=E7=9A=84=E8=80=81=20bug=20#9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- html/document.js | 6 ++---- html/louvre.js | 5 +++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/html/document.js b/html/document.js index 2639b05..f9134e5 100644 --- a/html/document.js +++ b/html/document.js @@ -156,7 +156,7 @@ const style = { // hueGroup: 255, // lightGroup: 1, lightCut: 128, - darkCut: 120, + darkCut: 118, }; @@ -264,8 +264,6 @@ app = new Vue({ }); louvreInit( _=>{ const { img } = app.$refs; - img.onload = async _=>{ - await app.setImageAndDraw(); - }; + img.onload = app.setImageAndDraw; if(img.complete) img.onload(); }); \ No newline at end of file diff --git a/html/louvre.js b/html/louvre.js index cd8b201..97a069e 100644 --- a/html/louvre.js +++ b/html/louvre.js @@ -21,6 +21,7 @@ let scale = width / height; let lastConfigString = null; const canvas = document.createElement('canvas'); +const ctx = canvas.getContext('2d'); const canvasShade = document.createElement('canvas'); const canvasShadeMin = document.createElement('canvas'); const canvasMin = document.createElement('canvas'); @@ -92,7 +93,6 @@ const louvre = async ({img, outputCanvas, config, callback}) => { canvas.height = _height; - const ctx = canvas.getContext('2d'); ctx.drawImage( img, @@ -102,7 +102,8 @@ const louvre = async ({img, outputCanvas, config, callback}) => { setLeft, setTop, setWidth, setHeight ); - + // ctx.font = '200px sans-serif' + // ctx.fillText('123233',50,200); let pixel = ctx.getImageData(0, 0, _width, _height);