Commit 8bd1072c by 姜雷

画图前清空画布

parent c75b50cd
...@@ -96,6 +96,7 @@ class ImagePicker extends Component { ...@@ -96,6 +96,7 @@ class ImagePicker extends Component {
const { aspectRatio } = this.state; const { aspectRatio } = this.state;
const ctx = this.canvas.getContext('2d'); const ctx = this.canvas.getContext('2d');
const fileUrl = this.createObjectURL(file); const fileUrl = this.createObjectURL(file);
ctx.clearRect(0, 0, 590, 334);
const img = new Image(); const img = new Image();
img.onload = () => { img.onload = () => {
console.log(img.width, img.height); console.log(img.width, img.height);
......
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 to comment