Merge pull request #16003 from Snuffleupagus/scaleSelect-width-CSS-var

Move the `--scale-select-width` CSS variable to the relevant DOM element
This commit is contained in:
Jonas Jenwald 2023-02-04 14:23:43 +01:00 committed by GitHub
commit df71f82037
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -17,7 +17,6 @@ import {
animationStarted,
DEFAULT_SCALE,
DEFAULT_SCALE_VALUE,
docStyle,
MAX_SCALE,
MIN_SCALE,
noContextMenuHandler,
@ -342,7 +341,8 @@ class Toolbar {
maxWidth += 0.3 * scaleSelectWidth;
if (maxWidth > scaleSelectWidth) {
docStyle.setProperty("--scale-select-width", `${maxWidth}px`);
const container = items.scaleSelect.parentNode;
container.style.setProperty("--scale-select-width", `${maxWidth}px`);
}
// Zeroing the width and height cause Firefox to release graphics resources
// immediately, which can greatly reduce memory consumption.

View File

@ -20,7 +20,6 @@
--sidebar-width: 200px;
--sidebar-transition-duration: 200ms;
--sidebar-transition-timing-function: ease;
--scale-select-width: 140px;
--toolbar-icon-opacity: 0.7;
--doorhanger-icon-opacity: 0.9;
@ -799,6 +798,10 @@ body {
}
.dropdownToolbarButton {
/* Define this variable here, and not in :root, to avoid reflowing the
entire viewer when updating the width. */
--scale-select-width: 140px;
width: var(--scale-select-width);
padding: 0;
background-color: var(--dropdown-btn-bg-color);