File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 196196 var idx = CONFIG . rotations . indexOf ( currentRotation ) ;
197197 var nextIdx = ( idx + 1 ) % CONFIG . rotations . length ;
198198 var nextRot = CONFIG . rotations [ nextIdx ] ;
199+
200+ // Current timepoint's CRS dimensions (not global max)
201+ var tp = CONFIG . timePoints [ currentIdx ] ;
202+ var tpZ = tp . maxZoom !== undefined ? tp . maxZoom : maxZoom ;
203+ var tpS = Math . pow ( 2 , tpZ ) ;
204+ var tpW = ( tp . imageWidth !== undefined ? tp . imageWidth : CONFIG . imageWidth ) / tpS ;
205+ var tpH = ( tp . imageHeight !== undefined ? tp . imageHeight : CONFIG . imageHeight ) / tpS ;
206+
207+ // Transform view center for isometric 90° rotation
208+ var center = map . getCenter ( ) ;
209+ var fx = center . lng / tpW ; // 0..1 across width
210+ var fy = - center . lat / tpH ; // 0..1 down height
211+ var newFx = 1 - fy ;
212+ var newFy = fx ;
213+
199214 map . removeLayer ( tileLayers [ currentRotation ] ) ;
200215 currentRotation = nextRot ;
201216 tileLayers = getLayersForTimestamp ( currentTimestamp ) ;
202217 tileLayers [ currentRotation ] . addTo ( map ) ;
218+ map . setView ( L . latLng ( - newFy * tpH , newFx * tpW ) , map . getZoom ( ) ) ;
203219 updateHash ( ) ;
204220 }
205221 if ( initLat !== undefined && initLng !== undefined && initZoom !== undefined && ! isNaN ( initLat ) && ! isNaN ( initLng ) && ! isNaN ( initZoom ) ) {
Original file line number Diff line number Diff line change @@ -925,10 +925,26 @@ function generateHtml(manifest: TimelineManifest, domain?: string): string {
925925 var idx = CONFIG.rotations.indexOf(currentRotation);
926926 var nextIdx = (idx + 1) % CONFIG.rotations.length;
927927 var nextRot = CONFIG.rotations[nextIdx];
928+
929+ // Current timepoint's CRS dimensions (not global max)
930+ var tp = CONFIG.timePoints[currentIdx];
931+ var tpZ = tp.maxZoom !== undefined ? tp.maxZoom : maxZoom;
932+ var tpS = Math.pow(2, tpZ);
933+ var tpW = (tp.imageWidth !== undefined ? tp.imageWidth : CONFIG.imageWidth) / tpS;
934+ var tpH = (tp.imageHeight !== undefined ? tp.imageHeight : CONFIG.imageHeight) / tpS;
935+
936+ // Transform view center for isometric 90° rotation
937+ var center = map.getCenter();
938+ var fx = center.lng / tpW; // 0..1 across width
939+ var fy = -center.lat / tpH; // 0..1 down height
940+ var newFx = 1 - fy;
941+ var newFy = fx;
942+
928943 map.removeLayer(tileLayers[currentRotation]);
929944 currentRotation = nextRot;
930945 tileLayers = getLayersForTimestamp(currentTimestamp);
931946 tileLayers[currentRotation].addTo(map);
947+ map.setView(L.latLng(-newFy * tpH, newFx * tpW), map.getZoom());
932948 updateHash();
933949 }
934950 if (initLat !== undefined && initLng !== undefined && initZoom !== undefined && !isNaN(initLat) && !isNaN(initLng) && !isNaN(initZoom)) {
You can’t perform that action at this time.
0 commit comments