ctessier / nova-advanced-image-field

🌄 📐 A Laravel Nova advanced image field with cropping and resizing using Vue Advanced Cropper and Intervention Image
https://novapackages.com/packages/ctessier/nova-advanced-image-field
MIT License
99 stars 25 forks source link

Is there a way to turn off the zoom / size change in cropping? #75

Open dan-lutd opened 2 years ago

dan-lutd commented 2 years ago

When cropping an image the scroll will enlarge or shrink the image. Is it possible to turn this off? It looks like it may be the zoomable = false or maybe :zoomable = "false" ?? perhaps in FormField.vue

<vue-cropper
     v-if="field.croppable"
         v-show="imgSrc"
         class="mb-4"
         ref='cropper'
         :view-mode="1"
         :aspect-ratio="field.aspectRatio || NaN"
         :src="imgSrc"
       >
</vue-cropper>
ctessier commented 2 years ago

Hi @dan-lutd,

I think you are right. By default, Cropper.js allows to zoom in or out the image using the mouse wheel or touchpad. Check it out here and tell me if the zoomable option is what you are looking for: https://fengyuanchen.github.io/cropperjs/

If so, I guess we could make it possible to pass an array of options to the Cropper.js component. Feel free to open a pull request. Or I will look at this when I have some time.

Thank you for your feedback.

dan-lutd commented 2 years ago

Hi @ctessier , yes that is the option. I made a fork and added :zoomable="false" for the moment, but passings options is a better solution. I don't know vue to even start a PR, sorry.

Thanks for this clean and friendly Nova field!