Skip to content

Commit

Permalink
iOS Safari 初次开启页面输出为空白图的老 bug #9
Browse files Browse the repository at this point in the history
  • Loading branch information
itorr committed Aug 14, 2022
1 parent d9eeb1e commit 5610846
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 2 additions & 4 deletions html/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const style = {
// hueGroup: 255,
// lightGroup: 1,
lightCut: 128,
darkCut: 120,
darkCut: 118,
};


Expand Down Expand Up @@ -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();
});
5 changes: 3 additions & 2 deletions html/louvre.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -92,7 +93,6 @@ const louvre = async ({img, outputCanvas, config, callback}) => {
canvas.height = _height;


const ctx = canvas.getContext('2d');

ctx.drawImage(
img,
Expand All @@ -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);

Expand Down

0 comments on commit 5610846

Please sign in to comment.