Introduce a --viewer-container-height
CSS variable to simplify the code
#14880
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This new CSS variable will allow us to simplify a couple of different viewer components, since we no longer need to use JavaScript-based hacks and can directly set the CSS rules instead. In particular:
The
BaseViewer
-handling, used as part of the code that will center pages vertically in PresentationMode, can be simplified.By using CSS to control the height of the "dummy"-page we avoid unnecessarily invalidating the scale-value, which can reduce some unneeded re-rendering while PresentationMode is active.
The
SecondaryToolbar.#setMaxHeight
-method, and its associated parameters, are no longer necessary and can be completely removed.Note that in order for things to work correctly in general, the new
--viewer-container-height
CSS variable must potentially be updated on any window-based "resize"-event (even when there's no zooming). While this is currently only done in the default viewer, that shouldn't be an issue since neither PresentationMode nor Toolbar-functionality is included in the "viewer components".