cstefanache / angular2-img-cropper

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

cropperSettings width and height settings have no effect?! #125

Open kwalski opened 7 years ago

kwalski commented 7 years ago

I have tested it on sample plunker on readme, as well as on my local machine, there is no effect of width and height settings this.cropperSettings.width = 100; this.cropperSettings.height = 100;

screen shot 2017-01-22 at 7 00 09 pm

From my experience they are defaulting to the largest possible square you can fit in the middle. If rounded=true, then the draggable corners do not concide with the overlay.

cstefanache commented 7 years ago

I have created a confusion using the width/height naming and for backwards compatibility reasons I won't be able to change them. The width / height relates to the cropping context. Setting: this.cropperSettings1.width = 200; this.cropperSettings1.height = 100;

this.cropperSettings1.croppedWidth = 200; this.cropperSettings1.croppedHeight = 100; Will have the following effect: will take the cropped context (200x100) and render on the cropping output canvas of size (200x100) - usually those two should match

Sorry for the inconvenience - please let me know if the issue can be closed

image

kwalski commented 7 years ago

Can you please confirm which setting sets the default size of the rectangle (in to be cropped image)? I assumed if this.cropperSettings1.width = 10; this.cropperSettings1.height = 10; Then my rectangle size will be 10x10 at the initialization, which then can be enlarged to a different size, restricted by minWidth,minHeight settings. However when I opened this issue I found that the initial rectangle (square in my case) was the largest that fit in the image, and not 10x10?

On a side note, this is a great library.

trimedia commented 7 years ago

Is there a way to set the default sizing of the cropper like kwalski asked?