cstefanache / angular2-img-cropper

Angular 2 Image Cropper
MIT License
364 stars 135 forks source link

How to reset the canvas? #237

Open vistajess opened 6 years ago

vistajess commented 6 years ago

I experimented on the plunker , I made clear function to reset to initial state: clear() { this.data1 = {}; }

the image cropper data resets but the canvas content is still there.

image

hankehly commented 6 years ago

The cropper object has a reset function available

venkatasairamu commented 6 years ago

cropper object has not reset by using this function clear() { this.data1 = {}; }

venkatasairamu commented 6 years ago

plz help me to Reset canvas in anotherway

savita-turner commented 6 years ago

I found an answer to this (to reset the canvas. you already know how to clear the cropped data):

In the component.html use #cropper like this:
<img-cropper #cropper [image]="data1" [settings]="cropperSettings" (onCrop)="cropped($event)">

In component.ts include these lines: export class myComponent implements OnInit { @ViewChild('cropper', undefined) cropper:ImageCropperComponent; constructor () {} clear () { this.cropper.reset(); } } @

josephserrano15 commented 6 years ago

I am using the reset function as well as the resizeCanvas function, but the cropper size isn't changing. Anyone find how to do this?

venkatasairamu commented 6 years ago

thanks @savita-turner