Commit ccceb07f by doszhang

dos

parent ad6d8394
...@@ -462,15 +462,12 @@ function bindUpload(that, ctx, myCanvas, index, callback, imgInfo) { ...@@ -462,15 +462,12 @@ function bindUpload(that, ctx, myCanvas, index, callback, imgInfo) {
width: 640 width: 640
}, function (results) { }, function (results) {
img = new Image(); img = new Image();
console.log(imgInfo)
img.onload = function () { img.onload = function () {
drawImage(ctx, myCanvas, img, imgInfo); drawImage(ctx, myCanvas, img, imgInfo);
results = null; results = null;
imgData = null; imgData = null;
}; };
img.src = results.base64; img.src = results.base64;
console.log(img.src);
// headimg[index] = img;
callback(img); callback(img);
}); });
}); });
...@@ -480,11 +477,11 @@ function drawImage(ctx, myCanvas, img, imgInfo) { ...@@ -480,11 +477,11 @@ function drawImage(ctx, myCanvas, img, imgInfo) {
ctx.save(); ctx.save();
ctx.clearRect(0, 0, myCanvas.width, myCanvas.height); 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.translate(imgInfo.x, imgInfo.y);
ctx.rotate(Math.PI / 180 * imgInfo.rotation); ctx.rotate(Math.PI / 180 * imgInfo.rotation);
ctx.scale(imgInfo.scale, imgInfo.scale); ctx.scale(imgInfo.scale, imgInfo.scale);
ctx.drawImage(img, -img.width / 2, -img.height / 2); ctx.drawImage(img, -img.width, -img.height);
ctx.restore(); 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