Skip to content

Commit 6d01e1d

Browse files
committed
Changed logic to look at #toolcontroller_sep_content instead and measure its top to calc the bottom. Changed the dynamic max height to every seperated tool, as a result every panel doesn't need a static inline cap anymore. This should be a generalized solution any seperated tool can use.
1 parent f079e33 commit 6d01e1d

3 files changed

Lines changed: 24 additions & 17 deletions

File tree

src/essence/Basics/UserInterface_/components/BottomElementPositioner/BottomElementPositioner.jsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -144,19 +144,20 @@ function BottomElementPositioner() {
144144
sepContent.style.left = (12 + tpShift + (tpShift > 0 ? 12 : 0)) + 'px'
145145
}
146146

147-
// Cap the Legend panel's height so it never overlaps the bottom-left
148-
// compass + scale bar. That stack's top sits ~70px above the bottom
149-
// bar (mapToolBar bottom = totalOffset), so the legend's bottom must
150-
// clear totalOffset + 70 + a 12px gap. totalOffset already grows with
151-
// the expanded timeline, so the legend shrinks exactly as needed.
152-
const legendEl = document.getElementById('LegendTool')
153-
if (legendEl) {
147+
// Cap every separated tool panel (Legend, etc.) so none overlaps the
148+
// bottom-left compass + scale bar. All panels share the container's top,
149+
// so a single reserve covers them all. That stack's top sits ~70px above
150+
// the bottom bar (mapToolBar bottom = totalOffset), so a panel's bottom
151+
// must clear totalOffset + 70 + a 12px gap. totalOffset already grows with
152+
// the expanded timeline, so the panels shrink exactly as needed.
153+
const sepContainer = document.getElementById('toolcontroller_sep_content')
154+
if (sepContainer) {
154155
const compassStack = 70 // compass + scale bar height above the bar
155156
const gap = 12
156-
const legendTop = legendEl.getBoundingClientRect().top
157-
const reserve = legendTop + totalOffset + compassStack + gap
157+
const containerTop = sepContainer.getBoundingClientRect().top
158+
const reserve = containerTop + totalOffset + compassStack + gap
158159
document.documentElement.style.setProperty(
159-
'--mmgis-legend-bottom-reserve',
160+
'--mmgis-sep-tools-bottom-reserve',
160161
reserve + 'px'
161162
)
162163
}

src/essence/Basics/UserInterface_/components/Panels/SeparatedTools.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ function SeparatedTools() {
6666
? undefined
6767
: {
6868
width: toolWidth + 'px',
69-
maxHeight: 'calc(100vh - 120px)',
7069
}
7170
}
7271
>

src/essence/Basics/UserInterface_/components/Panels/SeparatedTools.module.css

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,25 @@
8484
min-height: 0;
8585
}
8686

87+
/* Cap every separated tool panel so none overlaps the bottom-left compass +
88+
scale bar. The reserve is dynamic — BottomElementPositioner sets
89+
--mmgis-sep-tools-bottom-reserve from the live layout (it grows when the
90+
timeline is expanded) so panels shrink instead of clipping. The panel's
91+
overflow:hidden + .content overflow:auto makes the content scroll. Falls
92+
back to 120px before the positioner first runs. */
93+
.panel {
94+
max-height: calc(100vh - var(--mmgis-sep-tools-bottom-reserve, 120px));
95+
}
96+
8797
/* Legend-specific overrides */
8898
.panel :global(#toolContentSeparated_Legend) > div:first-child {
8999
display: none !important;
90100
}
91101

102+
/* Let the Legend's inner #LegendTool fill the panel and scroll within the
103+
shared cap above instead of imposing its own inline height/max-height. */
92104
.panel :global(#toolContentSeparated_Legend #LegendTool) {
93105
height: auto !important;
94-
/* Reserve space at the bottom so the legend never overlaps the bottom-left
95-
compass + scale bar. The reserve is dynamic — BottomElementPositioner sets
96-
--mmgis-legend-bottom-reserve from the live layout (it grows when the
97-
timeline is expanded) so the legend shrinks/scrolls instead of clipping.
98-
Falls back to 240px before the positioner first runs. */
99-
max-height: calc(100vh - var(--mmgis-legend-bottom-reserve, 240px)) !important;
106+
max-height: none !important;
100107
}
101108

0 commit comments

Comments
 (0)