iOS Safari 初次开启页面输出为空白图的老 bug #9

This commit is contained in:
itorr
2022-08-14 17:53:19 +08:00
parent d9eeb1e387
commit 56108465df
2 changed files with 5 additions and 6 deletions

View File

@@ -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();
});

View File

@@ -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);