waynegm / imgViewer2

Extensible and responsive jQuery plugin to zoom and pan images based on the Leaflet mapping library
MIT License
60 stars 34 forks source link

set max height? #37

Closed rostikrode closed 3 years ago

rostikrode commented 3 years ago

is there a way for a tall image to only display a specific height, and the rest be draggable ?

waynegm commented 3 years ago

Sounds like you want to display with a fixed zoom level. The Control Options example shows how you can use options to disable zoom and/or dragging. The setZoom method can be used to set a specific zoom level.

rostikrode commented 3 years ago

thanks for your reply, thats the workaround i have in place right now. ideally, what i am trying to do is, have the ability to have the image fill up the space, and if the width or height is taller than the parent, be able to drag to that max width and / or height. similar as how it acts now when you zoom in on the image. with current code it seems the map area always has to load at the same height and width as the image.

waynegm commented 3 years ago

There is an undocumented widget option "constraint" which can set to either "width" or "height". It was meant for situations where the aspect of the image and the html view are different and determines whether a zoom level of 1 makes the full width or height visible. Its use is described in this issue

rostikrode commented 3 years ago

thank you! i will give it a try