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

Scale viewer to its container. #185

Closed
wants to merge 1 commit into from
Closed

Conversation

tpendragon
Copy link
Contributor

@tpendragon tpendragon commented Mar 13, 2024

Work towards #179

I'm very new to this project, so I don't know what kind of tests y'all do, but this is my attempt at getting the CSS to adjust to its parent container. It looks like it works to me, if I shove the demo page into a tiny container.

Old (main branch):
Screen Shot 2024-03-13 at 2 30 37 PM

This branch:

Screen Shot 2024-03-13 at 2 30 47 PM

@tpendragon
Copy link
Contributor Author

@eliotjordan did some testing for our use case and says this didn't make it any better, so I'm closing.

@tpendragon tpendragon closed this Mar 14, 2024
@mathewjordan
Copy link
Member

@tpendragon Can we chat to talk it through? The goal is to have Clover extend to the width of its wrapping container on the client side, correct? Similar to how Mirador behaves?

So, in this example, Clover's canvas would extend it's height and width automatically to fit. The thumbnails for canvases would take a certain amount of that height, but the canvas height would grow accordingly (using flexbox).

<div style="height: 1000px; width: 100%">
  <CloverIIIFViewer />
</div>

@tpendragon
Copy link
Contributor Author

So, in this example, Clover's canvas would extend it's height and width automatically to fit. The thumbnails for canvases would take a certain amount of that height, but the canvas height would grow accordingly (using flexbox).

Right. That's what I thought this PR accomplished, but Eliot's gonna show me some problems with it a little later. I think maybe I messed up the thumbnails in the preview ribbon.

@mathewjordan
Copy link
Member

mathewjordan commented Mar 14, 2024

Sweet, so here is the issue I authored... My approach was going to be this....


Description

There is a use case where Clover needs to expand to the height of its wrapping container rather than have it be set by a fixed height in the config. As a side note, auto height expansion is how Mirador works.

Update type of canvasHeight to be more specific.
https://developer.mozilla.org/en-US/docs/Web/CSS/height

canvasHeight?: React.CSSProperties["height"];

If canvasHeight === "auto", then we set a class at a high level within Clover and use flexbox to grow the canvasHeight to its bounds. We then also need to set Clover to absolutely position itself and expand to the bounds of the consuming apps wrapping container.

Done Looks Like

  • Clover has auto height expansion from the settable config
  • Clover can also be set by a fixed height (backwards compatibility for current implementations)

@tpendragon
Copy link
Contributor Author

@mathewjordan Looks great!

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

Successfully merging this pull request may close these issues.

None yet

2 participants