mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
fix(ui): keep the removed Display and layout exports as deprecated shims
Restore shouldHideCollapsedRightPanels, syncScopeControls and the fadeSliders field, skipping sliders already bound by name. Note the API changes in the changelog.
This commit is contained in:
1 parent
a767b84486
commit
c1dd9246eb
5 files changed
+56
-1
No files matched your search
@@ -67,9 +67,27 @@ export function bindDisplayControls({ elements, actions }) {
|
||||
}
|
||||
listen(elements.fadeSlider, 'input', 'setFade', integer);
|
||||
listen(elements.outsideOpacitySlider, 'input', 'setOutsideOpacity', integer);
|
||||
// Hosts written before the two sliders were told apart pass `fadeSliders`
|
||||
// and read both values in `setFade` themselves.
|
||||
for (const el of elements.fadeSliders || []) {
|
||||
if (el === elements.fadeSlider || el === elements.outsideOpacitySlider)
|
||||
continue;
|
||||
listen(el, 'input', 'setFade');
|
||||
}
|
||||
return {
|
||||
destroy() {
|
||||
for (const remove of removers.splice(0)) remove();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Keep a native Scope checkbox and feather availability in step with the
|
||||
* mask. The Display view renders both from VisualSettings now; this stays
|
||||
* exported from `./ui/display` for hosts that imported it.
|
||||
* @deprecated
|
||||
*/
|
||||
export function syncScopeControls(toggle, featherSlider, enabled) {
|
||||
if (toggle) toggle.checked = enabled;
|
||||
if (featherSlider) featherSlider.disabled = !enabled;
|
||||
}
|
||||
@@ -159,6 +159,20 @@ test('optional controls are absent safely and subscriptions stay instance-owned'
|
||||
two.destroy();
|
||||
});
|
||||
|
||||
test('legacy fadeSliders bind once and skip sliders passed by name', () => {
|
||||
const calls = [];
|
||||
const fade = element('40');
|
||||
const legacy = element('25');
|
||||
const control = bindDisplayControls({
|
||||
elements: { fadeSlider: fade, fadeSliders: [fade, legacy] },
|
||||
actions: { setFade: (value) => calls.push(value) },
|
||||
});
|
||||
fade.dispatchEvent(new Event('input'));
|
||||
legacy.dispatchEvent(new Event('input'));
|
||||
assert.deepEqual(calls, [40, undefined]);
|
||||
control.destroy();
|
||||
});
|
||||
|
||||
test('the native Scope checkbox reads checked state on change and disposes its listener', () => {
|
||||
const scopeToggle = element();
|
||||
scopeToggle.checked = true;
|
||||
|
||||
@@ -60,3 +60,16 @@ export function resolveHudRailLayout({
|
||||
constrained: panelHeight > availableHeight,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the Tactical layout hid collapsed right panels beside an expanded
|
||||
* one. The rail now enforces one open panel per side in every layout; this
|
||||
* stays exported from `./ui/layout` for hosts that imported it.
|
||||
* @deprecated
|
||||
*/
|
||||
export function shouldHideCollapsedRightPanels({
|
||||
hudVariant,
|
||||
hasExpandedPanel,
|
||||
}) {
|
||||
return hudVariant === 'tactical' && Boolean(hasExpandedPanel);
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
export { layoutLeftPanelRail } from './leftPanelRail.js';
|
||||
export { layoutRightPanelRail } from './rightPanelRail.js';
|
||||
export { measurePanelNaturalHeight } from './panelMeasurement.js';
|
||||
export { resolveHudRailLayout } from './panelRailGeometry.js';
|
||||
export {
|
||||
resolveHudRailLayout,
|
||||
shouldHideCollapsedRightPanels,
|
||||
} from './panelRailGeometry.js';
|
||||
export {
|
||||
allocatePanelStackHeights,
|
||||
panelStackAutoCollapseIndices,
|
||||
|
||||
Reference in new issue
Block a user