mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
fix(street-level): re-check after every await; close the old photo; fresh panel views
Address samehkhamis's review on #1113: - show_street_level checks the turn, the camera's owner (navigation stamp, re-taken where its own flight lands, or a press/wheel on the globe) and the hiding modes after the flight, the map switch, the layer switch-on and the lookup; a photo that opened after either is closed again. The hidden panel is also refused before the flight. - An open photo closes before a new request arms or looks up, so a place with no imagery shows its own error. - The panel posts every view with `fresh`; the inline app opens a billed photo only for a fresh one. - A passed-through view's street_level point moves with a new camera position; revealPanel does nothing above 720px, scrolling included. - Document that the app's own links do not carry `sl`.
This commit is contained in:
1 parent
14f7326dbf
commit
30e6cd39c7
15 files changed
+486
-57
No files matched your search
@@ -4,7 +4,11 @@ import { ShellFacade } from './shellFacade.js';
|
||||
import { AircraftDisplay } from './aircraftDisplay.js';
|
||||
import { LayerBindings } from './layerBindings.js';
|
||||
import { PanelChrome } from './panelChrome.js';
|
||||
import { initMobileShell, sheetForPanelId } from './mobileShell.js';
|
||||
import {
|
||||
initMobileShell,
|
||||
MOBILE_SHELL_MEDIA_QUERY,
|
||||
sheetForPanelId,
|
||||
} from './mobileShell.js';
|
||||
import { VisualSettings } from './visualSettings.js';
|
||||
import { NavigationController } from './navigationController.js';
|
||||
import { ShareRestoration } from './shareRestoration.js';
|
||||
@@ -1221,6 +1225,7 @@ export class StyleManager extends ShellFacade {
|
||||
*/
|
||||
revealPanel(panelId) {
|
||||
const sheet = sheetForPanelId(panelId);
|
||||
if (!globalThis.matchMedia?.(MOBILE_SHELL_MEDIA_QUERY)?.matches) return;
|
||||
if (sheet) this._mobileShell?.setSheet(sheet);
|
||||
// The sheet opens at its top; a panel lower in the rail is scrolled to.
|
||||
document.getElementById(panelId)?.scrollIntoView?.({ block: 'nearest' });
|
||||
|
||||
@@ -2,14 +2,18 @@ import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { StyleManager } from './applicationShell.js';
|
||||
|
||||
test('revealing a panel opens its phone sheet and scrolls the panel into view', () => {
|
||||
function reveal({ phone }) {
|
||||
const sheets = [];
|
||||
const scrolls = [];
|
||||
const panel = { scrollIntoView: (options) => scrolls.push(options) };
|
||||
const saved = globalThis.document;
|
||||
const savedMatchMedia = globalThis.matchMedia;
|
||||
globalThis.document = {
|
||||
getElementById: (id) => (id === 'street-level-panel' ? panel : null),
|
||||
};
|
||||
globalThis.matchMedia = (query) => ({
|
||||
matches: phone && query === '(max-width: 720px)',
|
||||
});
|
||||
try {
|
||||
StyleManager.prototype.revealPanel.call(
|
||||
{ _mobileShell: { setSheet: (sheet) => sheets.push(sheet) } },
|
||||
@@ -17,8 +21,18 @@ test('revealing a panel opens its phone sheet and scrolls the panel into view',
|
||||
);
|
||||
} finally {
|
||||
globalThis.document = saved;
|
||||
globalThis.matchMedia = savedMatchMedia;
|
||||
}
|
||||
return { sheets, scrolls };
|
||||
}
|
||||
|
||||
test('revealing a panel opens its phone sheet and scrolls the panel into view', () => {
|
||||
const { sheets, scrolls } = reveal({ phone: true });
|
||||
assert.deepEqual(sheets, ['cameras']);
|
||||
// The panel sits below the sheet's first screen at 375×812.
|
||||
assert.deepEqual(scrolls, [{ block: 'nearest' }]);
|
||||
});
|
||||
|
||||
test('revealing a panel above 720px neither opens a sheet nor scrolls the rail', () => {
|
||||
assert.deepEqual(reveal({ phone: false }), { sheets: [], scrolls: [] });
|
||||
});
|
||||
Reference in new issue
Block a user