Closed Emaxoso closed 3 weeks ago
@Emaxoso, hello!
First of all, why do you need to get the current zoom? To get the selected area you need coordinates only, they represent that area.
const { coordinates } = this.$refs.cropper.getResult();
If you really need to get the current zoom, you should know that there is not concept of absolute zoom. There is the visibleArea
property that represents the current visible area of an image.
First of all, why do you need to get the current zoom? To get the selected area you need coordinates only, they represent that area.
I use the zoom to resize the image. First I do the cropping with the coordinates then I use the zoom to enlarge the image.
I was able to track the zoom by extending the Cropper component.
export default defineComponent({
extends: Cropper,
emits: ['scale'],
watch: {
src() {
this.scale = 1.0;
},
scale() {
this.$emit("scale", Math.round(this.scale * 1000) / 1000);
}
},
data: () => ({
scale: 1.0
}),
methods: {
onManipulateImage(event, params = {}) {
if (event && event.scale) {
this.scale = Math.max(1, this.scale + 1 - event.scale.factor);
}
Cropper.methods.onManipulateImage.call(this, event, params);
},
},
});
First I do the cropping with the coordinates then I use the zoom to enlarge the image.
@Emaxoso, I still don't get why? Should the following cases give the different result size?
It's pretty strange, because the cropped part is the same in both cases.
I also want to get current zoom level. Because zoom level is specified by other indicator UI on our app. Or I want to 'specify' zoom level of cropper.
Oh, yes!
@dala00, @Emaxoso is this issue still actual?
I changed library (needed for job then)
I don't know if this is a bug or a missing feature. I am trying to get the current zoom of the cropper, since for security reasons I need to crop on the server side, I was trying to find the image scale size.
I'm using the next branch