Synchroniser l'animation de zoom du fond et du relief, dater les tuiles à l'horloge précise

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Antoine Jacquin
2026-09-27 11:52:13 +02:00
parent 147a469ddc
commit 453530ec3a
3 changed files with 47 additions and 3 deletions

View File

@ -405,7 +405,7 @@ def test_ui_reorder_shows_destination():
def test_ui_uses_standard_tilelayer():
"""L'interface s'appuie sur le LOD natif de Leaflet, pas sur un palier maison."""
from lidar_pipeline.mapui import _MAP_JS, render_html, ui_version
assert "L.tileLayer(" in _MAP_JS
assert "L.TileLayer.extend(" in _MAP_JS # TileLayer Leaflet, LOD natif
assert "tileSize: META.tile_size" in _MAP_JS
assert "zoomOffset: META.zoom_offset" in _MAP_JS
assert "maxNativeZoom: META.max_native_zoom" in _MAP_JS
@ -1169,3 +1169,21 @@ def test_background_tiles_before_sources(tmp_path, monkeypatch):
assert fetched == [] and mapserve._bg["stats"]["telechargees"] == 1
assert mapserve._bg_process_one() is True
assert fetched == [1]
def test_zoom_animation_transforms_only_on_all_tile_layers():
"""Pendant l'animation de zoom, AUCUNE couche ne crée de niveau : un
niveau neuf n'est pas composé par Chrome (animé sur le thread principal,
gelé ~90 ms par le chargement) — le fond sautait quand le relief orienté,
qui garde son niveau pair, glissait normalement : désynchronisés."""
import re
from lidar_pipeline.mapui import _MAP_JS
assert "_animateZoom(e) { this._setView(e.center, e.zoom, true, true); }" in _MAP_JS
# « zoom » part aussi au début de l'animation (Leaflet 1.9) : même garde
assert "if (this._map && this._map._animatingZoom) {" in _MAP_JS
# Sans quoi _setView recrée un niveau malgré noUpdate (tileZoomChanged)
assert _MAP_JS.count("updateWhenZooming: false") >= 2
# Le fond OSM ET les couches LiDAR héritent du comportement
assert re.search(r"const base = new ZoomAnimTileLayer\(", _MAP_JS)
assert "const EvenLevelTileLayer = ZoomAnimTileLayer.extend(" in _MAP_JS
assert "L.tileLayer(" not in _MAP_JS.replace("L.tileLayer` standard", "")