Skip to content
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

Is it possible to set custom bounds constraints? #2534

Open
oblak1 opened this issue May 16, 2024 · 1 comment
Open

Is it possible to set custom bounds constraints? #2534

oblak1 opened this issue May 16, 2024 · 1 comment

Comments

@oblak1
Copy link

oblak1 commented May 16, 2024

I have a multi image layout in OSD. What I was wondering is can I set dynamic viewport constraints? As shown on the image, let's say I want to show the user only the second image so he cannot pan over those limits - the bounds could technically also be something else, like two images at once or only parts of the image.
Screenshot 2024-05-16 at 12 49 05

Technically I could use a single image approach but would like to keep the multi layout approach for other reasons.

@iangilman
Copy link
Member

There isn't really at the moment. You might be able to make it work like so:

const newBounds = viewer.world.getItemAt(1).getBounds();
viewer.viewport._setContentBounds(newBounds, viewer.world.getContentFactor());

...But _setContentBounds is a private function, so it may change or be removed in future versions of OSD. Also there may be unintended consequences.

It seems like we need to bring setHomeBounds back to cover this scenario (and possibly also for #2527). Let me know if you'd be interested in working on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants