Files
leim-maps/src/types/Map.ts
2025-06-14 18:57:13 +02:00

107 lines
2.6 KiB
TypeScript

import type { MapMarker, PlayerMarker } from "./Leaflet"
/**
* A breadcrumb item.
*/
export interface BreadcrumbItem {
/**
* The label of the breadcrumb.
*/
name: string
/**
* The URL the breadcrumb points to.
*/
url: string
}
/**
* Search configuration options for the map overlay.
* This is used to filter the markers on the map.
*/
export interface SearchConfig {
/** Whether to disable the quests in the search bar. */
disableQuests?: boolean
/** Whether to disable the capitals in the search bar. */
disableCapitals?: boolean
/** Whether to disable the landmarks in the search bar. */
disableLandmarks?: boolean
}
export interface MapProps {
title?: string
/**
* The ID of the map.
* This is used to identify the map and store custom markers in the local storage.
* @example "fr/aldys/borelis"
*/
mapKey: string
/**
* The ID of the map in the zoomify folder.
*/
zoomifyKey: string
/**
* Height of the map in pixels.
* This information is generated by the zoomify tool.
* @example 30000
*/
mapHeight: number
/**
* Width of the map in pixels.
* This information is generated by the zoomify tool.
* @example 30000
*/
mapWidth: number
/**
* List of markers to display on the map.
*/
markers?: MapMarker[]
/**
* Current player position on the map.
*/
players?: PlayerMarker
/**
* Main unit of the map.
*/
rulerMainUnit?: string
/**
* Ratio used to convert the map units to their relevant unit.
*/
rulerDistanceRatio?: number
/**
* Whether to show the walking distance in the ruler.
*/
rulerHideWalkDistance?: boolean
/**
* Default background color of the map.
* @exemple "#FFF"
*/
backgroundColor?: string
}
export interface MapOverlayProps {
/**
* The ID of the map.
* This is used to identify the map and store custom markers in the local storage.
* @example "fr/aldys/borelis"
*/
mapKey: string
/**
* List of markers to display on the map.
*/
markers?: MapMarker[]
/**
* Current player position on the map.
*/
players?: PlayerMarker
/**
* Configuration for the search bar.
* This is used to filter the markers on the map.
* @example { disableQuests: true, disableCapitals: false, disableLandmarks: false }
*/
searchConfig?: SearchConfig
/**
* List of breadcrumbs to display.
*/
breadcrumbs?: BreadcrumbItem[]
}