-
-
Notifications
You must be signed in to change notification settings - Fork 421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: New contain option for both inside/outside #598
Comments
Hi, Are there any updates planned for this feature? We are currently using this library and I believe the problem this issue describes is the only thing stopping us from fully adopting it. Essentially there doesn't seem to be a way to stop the user from dragging the image out of view while maintaining the ability to pan and zoom at all times. As described (in possibly another issue here) contain: "outside" comes close but the inability to pan or zoom out in the initial state is a non-starter. |
Sorry I haven't been able to get to it. I'll see if I can make some time this week. |
Thank you! Appreciate it. Let us know if it's something we can help with. |
does it work, if does, how? please tell me. |
@timmywil any chance of seeing this feature included in a new version in the near future? I would really like to have this without having to resort to using one of the forks which have included it (but also look like they haven't been updated further with any of the latest changes to this original library). I am facing an issue similar to this, where the container to my panzoom instance can be vertically resized and have it's height become higher than the image / element to be panned. Currently I am stuck between either not setting the |
Loving this library, except that lack of this feature is making it hard to use for our purposes. I'm not sure if everyone is after the same thing, but I think it might help to think of this as a problem that should be solved for each axis separately. As has been pointed out before, sometimes you want 'inside' on one axis and 'outside' on the other. I'd argue that
Those rules wouldn't place any limits on zooming, but could cooperate with some zoom settings:
I think these rules and config settings combined could potentially replicate the existing containment modes, which could be retained for backwards compatibility:
Not sure if I'm thinking straight anymore 🤪 so apologies if this doesn't make sense. Anyway, here is a codepen and video below that illustrates my use case ( Screen.Recording.2023-02-10.at.4.43.42.PM.movp.s. alternately scale keywords could match css conventions: |
This feature would fit my use-case of a mobile phone pan/zoom image nicely. At the moment, the viewport is smaller than the image. I'd like to make the min zoom level the same as the viewport width (and/or height) so it can't be scrolled off-screen. |
Are there any updates for when this issue could be resolved? |
What problem does this feature solve?
At the moment, when choosing the
contain:inside
option, it is not possible to zoom the element outside the parent element. Conversely, thecontain:outside
option doesn't allow to zoom the element to become smaller than the parent element in both dimensions.Describe the solution you'd like
The new option would allow the element to be contained, with the current functionality of the
contain:outside
when either of the dimensions of the element is larger than the parent element, and with the functionality ofcontain:inside
otherwise. This would provide a way for the element to never be able to be zoomed or panned outside of the parent element.This new option could probably be called
true
orcontained
. I'd steer away fromboth
, as that would be invalidated if any future contain option is added (see #476).Describe alternatives you've considered
None, really. At the moment the inside/outside options are too limiting and mutually exclusive, and not setting a
contain
option allows the user to pan/zoom the element outside of the parent element, which is not really desirable.Additional context
The patch to the code would look like this (note this was a patch vs the dist/panzoom.js file and not the src/panzoom.js):
The text was updated successfully, but these errors were encountered: