+ [task127424] add image onload of think3c widget.
This commit is contained in:
@@ -6,6 +6,19 @@ $(document).ready(function()
|
||||
const maxWidth = $('.think-model-content').width() || 500;
|
||||
const maxHeight = maxWidth;
|
||||
|
||||
image.onload = function()
|
||||
{
|
||||
let width = image.width;
|
||||
let height = image.height;
|
||||
|
||||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
ctx.drawImage(image, 0, 0, width, height);
|
||||
|
||||
const imageData = ctx.getImageData(0, 0, width, height);
|
||||
const pixels = binarizeImage(imageData);
|
||||
ctx.putImageData(pixels, 0, 0);
|
||||
};
|
||||
image.src = modelImg;
|
||||
|
||||
/* 检查图片是否已加载完成,如未完成,手动触发处理逻辑。*/
|
||||
|
||||
Reference in New Issue
Block a user