Commit ccceb07f by doszhang

dos

parent ad6d8394
......@@ -462,15 +462,12 @@ function bindUpload(that, ctx, myCanvas, index, callback, imgInfo) {
width: 640
}, function (results) {
img = new Image();
console.log(imgInfo)
img.onload = function () {
drawImage(ctx, myCanvas, img, imgInfo);
results = null;
imgData = null;
};
img.src = results.base64;
console.log(img.src);
// headimg[index] = img;
callback(img);
});
});
......@@ -480,11 +477,11 @@ function drawImage(ctx, myCanvas, img, imgInfo) {
ctx.save();
ctx.clearRect(0, 0, myCanvas.width, myCanvas.height);
ctx.translate(myCanvas.width / 2, myCanvas.height / 2);
ctx.translate(myCanvas.width, myCanvas.height);
ctx.translate(imgInfo.x, imgInfo.y);
ctx.rotate(Math.PI / 180 * imgInfo.rotation);
ctx.scale(imgInfo.scale, imgInfo.scale);
ctx.drawImage(img, -img.width / 2, -img.height / 2);
ctx.drawImage(img, -img.width, -img.height);
ctx.restore();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment