Compare commits

...
4 changed files with 52 additions and 2 deletions

No files matched your search

@@ -0,0 +1,4 @@
- `F` now collapses and reopens the Data Layers panel the way the panel's own
button does, and its rail entry stays. Before, `F` hid the panel together
with its rail entry, so only another `F` brought it back (asturksever,
#1598).
+1
View File
@@ -621,6 +621,7 @@ export class StyleManager extends ShellFacade {
_toggleOrbit: (...args) => this._toggleOrbit(...args),
toggleCleanView: (...args) => this.toggleCleanView(...args),
_toggleCctvEnabled: (...args) => this._toggleCctvEnabled(...args),
_togglePanel: (panelId) => this._panelChrome._togglePanel(panelId),
_setBloomEnabled: (...args) => this._setBloomEnabled(...args),
_setBloomIntensity: (...args) => this._setBloomIntensity(...args),
_setSharpenEnabled: (...args) => this._setSharpenEnabled(...args),
+2 -2
View File
@@ -64,8 +64,8 @@ export class DisplayBindings {
},
toggleOrbit: () => this._toggleOrbit(),
toggleCleanView: () => this.toggleCleanView(),
toggleLayers: () =>
document.getElementById('data-panel').classList.toggle('active'),
// Same collapse as the panel's own button, so its rail entry stays.
toggleLayers: () => this._togglePanel('data-panel'),
cycleDetection: () => {
this.shareLinkManager?.claimRestoreLane?.('visual');
this.claimDetection();
+45
View File
@@ -14,6 +14,8 @@ import PanelCollapseButton from './rail/PanelCollapseButton.vue';
import RailPanel from './rail/RailPanel.vue';
import UiPanel from './kit/UiPanel.vue';
import { usePanelChromeStore } from './stores/panelChrome.js';
import { useDisplayStore } from './stores/display.js';
import { DisplayBindings } from './displayBindings.js';
import CommandDockView from './views/CommandDockView.vue';
function mount(t, component) {
@@ -462,3 +464,46 @@ test('the accordion closes peers through the real store, and opens them again',
assert.equal(panels[0].className, '');
chrome.destroy();
});
test('F collapses Data Layers like its button and keeps its rail entry', (t) => {
document.body.innerHTML = `
<div id="data-panel" class="active"><button class="panel-collapse-btn" data-collapse-target="data-panel"></button></div>`;
const panel = document.getElementById('data-panel');
const store = usePanelChromeStore(createPinia());
const chrome = panelChrome(store);
followPanelState(store, 'data-panel', panel);
chrome._disclosurePanelIds = new Set(['data-panel']);
const bindings = new DisplayBindings({
viewer: null,
services: { isScopeMaskEnabled: () => false, cycleDetectionMode() {} },
elements: { _locationSearch: document.createElement('input') },
operations: {
_setScope() {},
_togglePanel: (panelId) => chrome._togglePanel(panelId),
},
readState: () => ({}),
claimDetection() {},
displayStore: useDisplayStore(createPinia()),
});
bindings._initUI();
t.after(() => {
bindings.destroy();
chrome.destroy();
});
const press = (init = {}) =>
document.body.dispatchEvent(
new KeyboardEvent('keydown', { key: 'f', bubbles: true, ...init }),
);
press();
assert.equal(store.panels['data-panel']?.collapsed, true);
assert.ok(panel.classList.contains('collapsed'));
// `active` is what keeps Data Layers in the rail.
assert.ok(panel.classList.contains('active'));
press({ metaKey: true });
assert.equal(store.panels['data-panel'].collapsed, true, 'Cmd+F is not ours');
press();
assert.equal(store.panels['data-panel'].collapsed, false);
assert.ok(!panel.classList.contains('collapsed'));
assert.ok(panel.classList.contains('active'));
});