Fix dual-map Leaflet sizing
This commit is contained in:
parent
8320ea66b9
commit
a4b150dfed
11
kort7/app.js
11
kort7/app.js
|
|
@ -410,6 +410,12 @@ function tick(now) {
|
||||||
requestAnimationFrame(tick);
|
requestAnimationFrame(tick);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function invalidateAllMaps() {
|
||||||
|
for (const view of views) {
|
||||||
|
view.map.invalidateSize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (const view of views) {
|
for (const view of views) {
|
||||||
view.indicatorsEl.addEventListener("click", (event) => {
|
view.indicatorsEl.addEventListener("click", (event) => {
|
||||||
const button = event.target.closest(".offmap-indicator");
|
const button = event.target.closest(".offmap-indicator");
|
||||||
|
|
@ -450,4 +456,9 @@ resetBtn.addEventListener("click", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
resetDemo();
|
resetDemo();
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
invalidateAllMaps();
|
||||||
|
requestAnimationFrame(invalidateAllMaps);
|
||||||
|
});
|
||||||
|
window.addEventListener("resize", invalidateAllMaps);
|
||||||
requestAnimationFrame(tick);
|
requestAnimationFrame(tick);
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,9 @@ test.describe('kort7 dual map demo', () => {
|
||||||
await waitForMaps(page);
|
await waitForMaps(page);
|
||||||
await expect(page.locator('#status')).toContainText('Simuleret tid');
|
await expect(page.locator('#status')).toContainText('Simuleret tid');
|
||||||
await expect(page.locator('#runtimeWarning')).toBeHidden();
|
await expect(page.locator('#runtimeWarning')).toBeHidden();
|
||||||
|
await expect.poll(async () => page.locator('.leaflet-tile').count(), {
|
||||||
|
timeout: 10000
|
||||||
|
}).toBeGreaterThan(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('shows different map titles for approximate and precise views', async ({ page }) => {
|
test('shows different map titles for approximate and precise views', async ({ page }) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue