mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 10:24:02 +00:00
fix(street-level): record filter and provider changes in share links
The panel changed the imagery filter and provider switches by calling the
layer directly, which bypasses the data manager's params request, the only
path saved state and share links record. A link copied after picking 360°
or a SINCE window came back with the defaults.
The controls now send those changes through
dataManager.setLayerParams('street-level', ..., { origin: 'user' }), as
the CCTV panel does; the layer applies them through its own setParams.
The feature gate's 360° step now asserts the share hash carries `0.p.p`;
it times out on the previous controls.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
d7d5bec752
commit
d5da45eacb
3 files changed
+26
-4
No files matched your search
@@ -330,6 +330,15 @@ async function main() {
|
||||
const after = (await ui()).coverage.count;
|
||||
assert.ok(after <= before, `${after} ≤ ${before}`);
|
||||
assert.equal((await ui()).filter.pano, 'pano');
|
||||
// The click is a user params request, so the share link records it
|
||||
// (Street Level's share token is `0`).
|
||||
await page.waitForFunction(
|
||||
() =>
|
||||
/(^|_)0\.p\.p(_|$)/.test(
|
||||
new URLSearchParams(location.hash.slice(1)).get('lo') || '',
|
||||
),
|
||||
{ timeout: 10_000 },
|
||||
);
|
||||
await page.click('[data-sl-pano="all"]');
|
||||
await sleep(600);
|
||||
assert.equal((await ui()).coverage.count, before);
|
||||
|
||||
@@ -948,6 +948,8 @@ export class StyleManager extends ShellFacade {
|
||||
this._dataManager?.setEnabled('street-level', enabled, {
|
||||
origin: 'user',
|
||||
}),
|
||||
setParams: (params, options) =>
|
||||
this._dataManager?.setLayerParams('street-level', params, options),
|
||||
setPanelCollapsed: (collapsed, options) =>
|
||||
this.setPanelCollapsed('street-level-panel', collapsed, options),
|
||||
dockPanel: () => this._panelChrome.dockPanel('street-level-panel'),
|
||||
|
||||
@@ -80,7 +80,7 @@ export class StreetLevelControls {
|
||||
});
|
||||
for (const button of this.root.querySelectorAll('[data-sl-pano]')) {
|
||||
this.listen(button, 'click', () =>
|
||||
this.layer.setCoverageFilter?.({ pano: button.dataset.slPano }),
|
||||
this._setParams({ pano: button.dataset.slPano }),
|
||||
);
|
||||
}
|
||||
// The readout follows the thumb; coverage is rebuilt once, on release.
|
||||
@@ -92,7 +92,7 @@ export class StreetLevelControls {
|
||||
el.sinceRange.setAttribute('aria-valuetext', label);
|
||||
});
|
||||
this.listen(el.sinceRange, 'change', () =>
|
||||
this.layer.setCoverageFilter?.({ sinceDays: sinceDays() }),
|
||||
this._setParams({ sinceDays: sinceDays() }),
|
||||
);
|
||||
this.listen(el.followBtn, 'click', () => {
|
||||
this.layer.setFollow?.(!(this._state?.street?.follow === true));
|
||||
@@ -160,6 +160,17 @@ export class StreetLevelControls {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter and provider changes go through the data manager as a user params
|
||||
* request, so saved state and share links record them; the layer applies
|
||||
* them through its own `setParams`.
|
||||
*/
|
||||
_setParams(params) {
|
||||
if (this.actions.setParams)
|
||||
this.actions.setParams(params, { origin: 'user' });
|
||||
else this.layer.setParams?.(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* A provider chip is the layer's switch: lighting one turns the layer on
|
||||
* with that provider; darkening the last lit one turns the layer off (the
|
||||
@@ -169,7 +180,7 @@ export class StreetLevelControls {
|
||||
const chip = this._view?.providers.find((entry) => entry.id === providerId);
|
||||
if (!chip) return;
|
||||
if (!chip.active) {
|
||||
this.layer.setProviderEnabled?.(providerId, true);
|
||||
this._setParams({ [providerId]: true });
|
||||
await this._ensureEnabled();
|
||||
return;
|
||||
}
|
||||
@@ -177,7 +188,7 @@ export class StreetLevelControls {
|
||||
(entry) => entry.id !== providerId && entry.active,
|
||||
);
|
||||
if (othersLit) {
|
||||
this.layer.setProviderEnabled?.(providerId, false);
|
||||
this._setParams({ [providerId]: false });
|
||||
return;
|
||||
}
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user