angular2-img-cropper icon indicating copy to clipboard operation
angular2-img-cropper copied to clipboard

How to reset the canvas?

Open vistajess opened this issue 8 years ago • 6 comments

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

vistajess avatar Sep 07 '17 09:09 vistajess

The cropper object has a reset function available

hankehly avatar Sep 08 '17 04:09 hankehly

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

venkatasairamu avatar Sep 14 '17 10:09 venkatasairamu

plz help me to Reset canvas in anotherway

venkatasairamu avatar Sep 14 '17 11:09 venkatasairamu

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(); } } @

savita-turner avatar Oct 19 '17 21:10 savita-turner

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?

josephserrano15 avatar Oct 29 '17 19:10 josephserrano15

thanks @savita-turner

venkatasairamu avatar Nov 03 '17 08:11 venkatasairamu