Closed ehernandezColegium closed 2 years ago
@ehernandezColegium, could you create the codesandbox that reproduces your issue? It will be very helpful.
Yeah, sure! Here we go: https://codesandbox.io/s/vuetify-slider-vue-advanced-cropper-hrh9u
In Nuxt, for ex, cropper
doesn't want to detect change from v-slider
.
Thanks in advances for any help here.
@ehernandezColegium check this out.
Just for curiosity: how do you determine which are the correct units to validate and calculating zoom input and zoom value? It's brilliant, and tricky for me at moment until I understand why.
Thanks in advances.
@ehernandezColegium, I need to clarify what do you mean by "units" here and by "validation" alike?
Sorry, I was not clear at all.
Units = sizes and coordinates Validations = The correct way to calculate zoom value and zoom input.
@ehernandezColegium, I've rewrote the example above, because I forgot that the stencil doesn't have the fixed size as in my twitter-like example. Also I've commented everything.
But I will try to explain the logic additionally here.
The problem is that there is not absolute zoom value in this cropper. Perhaps, in the future I will think out something universal and beautiful, but there is only relative zoom now. It's the sad fact.
Therefore the code in my example should solve two tasks:
The first task is accomplished by getAbsoluteZoom
function that gets the current absolute zoom for the current cropper state. It's needed to set the correct value of the slider input on a manual resize of an image (by mouse wheel or touch).
The second task is accomplished by getVisibleAreaSize
function that transforms the absolute zoom to the corresponding visible area size. The ratio getVisibleAreaSize(previousAbsoluteZoom, cropper) / getVisibleAreaSize(currentAbsoluteZoom, cropper)
give the sought relative zoom value. It's needed to relatively zoom a cropper image on slider value change.
It's "magical" and understandeable your explanation. Thanks a lot for your kindly help.
Last question: ready
event works? Need to know when image is loaded correctly to enable slider for manipulation, but always return undefined
. Am I missing something? I have demostrated this in the example.
@ehernandezColegium, ready
event should work. But it hasn't any payload. I've added the event processing in the last example.
@Norserium Very grateful for all the help. It would be nice document this code as an example for those who want to use Vuetify or similar components in the package docs. Greetings!
Hey @Norserium!!
This is my top of components for personal projects, thanks a lot and congrats for this!
I'm currently trying to implement zoom for profile avatar using Slider component from Vuetify. I have set step for slider in 1 to go from 0 to 10 and viceversa to handle zoom factor, and works pressing append and prepend icons. I was trying this example but it doesn't works for me.
The idea is, when user drag slider, avatar pic zooms dynamically according to, using change emit on setZoom method. I was trying another thing with no success:
Any hints that put me in the right direction? Thanks in advances, awesome work!