Doc and cache improvement.

This commit is contained in:
Eric van der Vlist 2022-11-01 14:16:36 +01:00
parent 352cb0d870
commit 50114598b2
3 changed files with 12 additions and 5 deletions

View File

@ -7,10 +7,11 @@ import { Transformation } from './LiveMap';
/**
*
* See also {@link components/map/Map!relativeCoordinateSystemAtom}.
*
*
*/
export interface HandlersProperties {
/** The transformation to apply on the `<LiveMap>` parent */
transformMap: (t: Transformation) => void;
}
/**
@ -24,7 +25,7 @@ export interface HandlersProperties {
* * touchStart, touchEnd and touchCancel to track touch state
* * touchMove to shift the map (single finger) or shift and zoom (two fingers).
*
* Communication with the parent `<Map>` is done through {@link components/map/Map!relativeCoordinateSystemAtom}.
* Communication with the parent `<LiveMap>` is done through the transformMap {@link components/map/LiveMap!Transformation} property.
*/
export const Handlers: react.FC<HandlersProperties> = (
props: HandlersProperties

View File

@ -17,7 +17,7 @@ export interface LayerStackProperties {
*/
numberOfTiledLayers?: number;
/**
* The current coordinates system
* The coordinates system
*/
coordinateSystem: CoordinateSystem;
}
@ -27,10 +27,13 @@ export interface LayerStackProperties {
* @param props
* @returns A stack of layers embedded in an SVG element
*
* This component does the conversion between the {@link components/map/Map!CoordinateSystem} stored
* in the {@link components/map/Map!coordinateSystemAtom} atom and the {@link components/map/TiledLayer!TiledLayer}
* This component does the conversion between the {@link components/map/LiveMap!CoordinateSystem} and
* the `<`{@link components/map/TiledLayer!TiledLayer}`>`
* components which units are in tiles.
*
* When more then one {@link components/map/TiledLayer!TiledLayer} is required, the tiled layer identified by the keyObject is considered active and new tiles are added
* as needed and the other layers are used as backups while the tiles are loading.
*
*/
export const LayerStack: react.FC<LayerStackProperties> = (
props: LayerStackProperties

View File

@ -102,6 +102,9 @@ export const TileSet: react.FC<TileSetProperties> = memo(
tiles.delete(tileKey);
});
}
if (globalThis.cacheForTileSet.has(key)) {
globalThis.cacheForTileSet.delete(key);
}
globalThis.cacheForTileSet.set(key, tiles);
if (globalThis.cacheForTileSet > tileSetConfig.numberOfCachedLayers) {
const oldestCachedLayerKeys = [...globalThis.cacheForTileSet.keys()];