advanced-cropper / vue-advanced-cropper

The advanced vue cropper library that gives you opportunity to create your own croppers suited for any website design
https://advanced-cropper.github.io/vue-advanced-cropper/
Other
930 stars 128 forks source link

How to Set the Size of the Canvas + Stencil Size #241

Closed ilrein closed 12 months ago

ilrein commented 1 year ago

For example: the current size of the image in question is 816 x 1456

I would like to use the mobile screen size to set the size of a rect stencil, which is, for example 1265 x 1700

In this case the stencil is bigger than the image, I would like to show the stencil overlaying past the image with some blank space.

In the inverse, when the image is bigger than the stencil, I would like to initialize the cropper to always to be fixed and small than the image.

What combination of props do I need to achieve these goals?

Roughly trying this:

<Cropper
              v-if="selectedWallpaper"
              :src="selectedWallpaperBase64"
              ref="cropperEl"
              :default-size="{
                width: selectedWallpaper.card.width,
                height: selectedWallpaper.card.height,
              }"
              :stencil-props="{
                resizable: false,
              }"
            />
Norserium commented 12 months ago

@ilrein, try to set image-restriction to "none".