Skip to content

Commit 8dc1286

Browse files
committed
Fix tool box width fluctuating when switching tools in Winter theme in Enlarge UI mode
1 parent 7ae085a commit 8dc1286

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

src/$Component.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,26 @@ function $Component(title, className, orientation, $el) {
110110
const apply_scale = () => {
111111
const enabled = $("body").hasClass("enlarge-ui");
112112
const scale = 3;
113+
114+
// Temporarily disable the transform to measure the unscaled size
115+
// (Previously used scrollWidth/scrollHeight, which is naturally unaffected by the scale,
116+
// but that is affected by the advent calendar style tool button flaps in the Winter theme.)
117+
$c.css("transform", "none");
118+
119+
// Measure the untransformed size
120+
const containerBounds = $c[0].getBoundingClientRect();
121+
const containerWidth = containerBounds.width;
122+
const containerHeight = containerBounds.height;
123+
124+
// Define CSS properties for scaling
113125
const props = {
114126
transform: `scale(${scale})`,
115127
transformOrigin: "0 0",
116-
marginRight: $c[0].scrollWidth * (scale - 1),
117-
marginBottom: $c[0].scrollHeight * (scale - 1),
128+
marginRight: containerWidth * (scale - 1),
129+
marginBottom: containerHeight * (scale - 1),
118130
};
131+
132+
// Apply or remove the scaling
119133
if (enabled) {
120134
$c.css(props);
121135
} else {

0 commit comments

Comments
 (0)