XiongAmao / vue-easy-lightbox

A tiny lightbox component for Vue.js 3.0 :tada::tada: https://xiongamao.github.io/vue-easy-lightbox/
MIT License
420 stars 69 forks source link

Feature Request - Options for scale ratio #102

Closed Hugoobx closed 2 years ago

Hugoobx commented 2 years ago

Hi ,

Could you add an access to the scale ratio of the zoom as a props ?

Thanks in advance

XiongAmao commented 2 years ago

Hi,

The scaling is non-linear. You may want to check here.

I'm not sure what you want is to control the scale of the current image, or the scale ratio each time you click the zoom button.

I have no idea how to implement it right now, so I'd like to learn if there is a similar solution.

grunghi commented 2 years ago

Hello, I've managed to extract the defaultScale const from here https://github.com/XiongAmao/vue-easy-lightbox/blob/edad9c4af90e03ce035806694b3679f3d45d52bb/src/vue-easy-lightbox.tsx#L250 into a prop and that seems to work well enough, I've submitted a PR: https://github.com/XiongAmao/vue-easy-lightbox/pull/103

XiongAmao commented 2 years ago

Hi, @Whitlyne

103 Props zoomScale and maxZoom have been released in v1.8.0.

You can try it and see if it works for your needs.

XiongAmao commented 2 years ago

@grunghi Thank you so much!

DanWebster31 commented 2 years ago

Hello, I'm not sure if the functionality is already integrated into the component and I'm just not seeing it, but is there any way to have 2 max zoom props? One would be maxZoomIn which functions like the current maxZoom prop, and the other would be maxZoomOut which would prevent the image from being scaled really small. Nice work by the way!

XiongAmao commented 2 years ago

@DanWebster31 Hi, i added minZoom in v1.10.0. I hope this will help.

DanWebster31 commented 2 years ago

Perfect, thanks!