Skip to content

GalaxyMap

github-actions[bot] edited this page Sep 23, 2026 · 4 revisions

Interface: GalaxyMap

Imported from @elite-dangerous-almanac/galaxy-map.

What createGalaxyMap gives back.

Properties

hud

readonly hud: HudHandle | null

The HUD handle, or null when the options do not ask for the HUD. The HUD loads by dynamic import, so the member is null until ready settles.


ready

readonly ready: Promise<void>

Settles when the map draws its first frame, or fails.

Methods

addCategories()

addCategories(categories): CategoryReport

Reads categories into the table and returns the report.

Parameters

categories

readonly CategoryInput[]

Returns

CategoryReport


addLines()

addLines(lines): ShapeReport

Reads lines into the shape set and returns the report.

Parameters

lines

readonly LineInput[]

Returns

ShapeReport


addSpheres()

addSpheres(spheres): ShapeReport

Reads spheres into the shape set and returns the report.

Parameters

spheres

readonly SphereInput[]

Returns

ShapeReport


addSystems()

addSystems(records): AddReport

Reads records into the set and returns the report.

Parameters

records

readonly SystemRecordInput[]

Returns

AddReport


areNebulaeVisible()

areNebulaeVisible(): boolean

True while the nebulae draw. A map that holds no source reads false.

Turning them off leaves the records and the art loaded, so turning them on again draws in the next frame and fetches nothing.

Returns

boolean


areRegionsVisible()

areRegionsVisible(): boolean

True while the region overlay draws its boundary lines and places its labels.

Returns

boolean


areShapesVisible()

areShapesVisible(): boolean

True while the spheres and the lines draw.

Returns

boolean


areSystemIconsVisible()

areSystemIconsVisible(): boolean

True while the system icon stacks draw.

Returns

boolean


areSystemNamesVisible()

areSystemNamesVisible(): boolean

True while the marker name labels draw.

Returns

boolean


categoryCount()

categoryCount(): number

How many categories the table holds.

Returns

number


clearShapes()

clearShapes(): void

Empties the shape set.

Returns

void


clearSystems()

clearSystems(): void

Empties the system set.

Returns

void


clearSystemsAndCategories()

clearSystemsAndCategories(): void

Empties the system set and the category table together.

Returns

void


dispose()

dispose(): void

Stops the map and releases what it holds. A second call does nothing.

Returns

void


flyTo()

flyTo(target, options?): Promise<FlightOutcome>

Flies the camera to a target, on the path a selection flight takes. It does not change the selection: a system in the target names a place and nothing more.

The promise settles with 'landed' where the flight reached the target and with 'interrupted' where anything ended it early, which is a second flyTo, a selection, the user's own input, a setView or dispose. It never rejects.

A target outside the browsable bounds is clamped, and the promise still settles with 'landed': the flight reached the target it was allowed to reach. A target that is already the view, and a system the set does not hold, settle with 'landed' and run no flight. The call works with every interaction switch off.

Parameters

target

FlyToTarget

options?

FlyToOptions

Returns

Promise<FlightOutcome>


getBounds()

getBounds(): BrowseBounds

Reads the browsable bounds back as the host gave them, and not the shape the map works out from them.

Returns

BrowseBounds


getCategory()

getCategory(index): Category | null

Reads one category of the table as a copy, or null outside it.

Parameters

index

number

Returns

Category | null


getDatasets()

getDatasets(): DatasetInfo[]

The dataset catalog the options named, without the load functions.

Returns

DatasetInfo[]


getHover()

getHover(): RealSystem | null

Reads the hovered system, or null.

Returns

RealSystem | null


getInteraction()

getInteraction(): InteractionSwitches

Reads every interaction switch.

Returns

InteractionSwitches


getLine()

getLine(index): Line | null

Reads one line as a copy, or null outside the set.

Parameters

index

number

Returns

Line | null


getLoadedDataset()

getLoadedDataset(): DatasetInfo | null

The dataset now on the map, or null.

Returns

DatasetInfo | null


getNameFilter()

getNameFilter(): string

Reads the filter text.

Returns

string


getSelection()

getSelection(): RealSystem | null

Reads the selected system, or null.

Returns

RealSystem | null


getShapeInfo()

getShapeInfo(kind, index): ShapeInfo | null

Reads one shape without its geometry, or null outside the set. A caller that lists the set reads it, so listing 4,096 lines costs no copy of their points.

Parameters

kind

ShapeKind

index

number

Returns

ShapeInfo | null


getShapeNameFilter()

getShapeNameFilter(): string

Reads the shape filter text.

Returns

string


getSphere()

getSphere(index): Sphere | null

Reads one sphere as a copy, or null outside the set.

Parameters

index

number

Returns

Sphere | null


getSystem()

getSystem(index): RealSystem | null

Reads one system of the set as a copy, or null outside the set.

Parameters

index

number

Returns

RealSystem | null


getView()

getView(): MapView

Reads the current view.

Returns

MapView


hasNebulae()

hasNebulae(): boolean

True where the map was built with a nebula source it can read.

Returns

boolean


hasSystemIcons()

hasSystemIcons(): boolean

True while at least one record on the map named at least one icon. The HUD reads it to decide whether a System icons switch would move anything.

The reading rises when a record that names an icon is added, and it falls only when the system set is cleared. A record that is replaced by one with no icon leaves the reading true, because a correction would need a sweep of the set. The call costs one read of a count and walks nothing.

Returns

boolean


isCategoryVisible()

isCategoryVisible(name): boolean

True when the markers of a category draw. False for a name the table lacks.

Parameters

name

string

Returns

boolean


isCursorMarkerVisible()

isCursorMarkerVisible(): boolean

True while the cursor marker draws.

Returns

boolean


isFlying()

isFlying(): boolean

True while a flight runs, whether a selection or a flyTo started it.

Returns

boolean


isGridVisible()

isGridVisible(): boolean

True while the coordinate grid draws.

Returns

boolean


isShapeCategoryVisible()

isShapeCategoryVisible(name): boolean

True when the shapes of a category draw. False for a name the table lacks.

Parameters

name

string

Returns

boolean


lineCount()

lineCount(): number

How many lines the shape set holds.

Returns

number


loadDataset()

loadDataset(id): Promise<DatasetLoadResult>

Loads one dataset of the catalog: it calls the entry's load(), empties the set and the table, and reads the two arrays that came back. A failed load leaves the map with the set it already had. A second call while a first one runs wins: the map aborts the signal it gave the first load(), and the first rejects as cancelled.

Parameters

id

string

Returns

Promise<DatasetLoadResult>


onDatasetChange()

onDatasetChange(listener): () => void

Calls listener after the loaded dataset changes. Returns an unsubscribe.

Parameters

listener

(dataset) => void

Returns

() => void


onFlightEnd()

onFlightEnd(listener): () => void

Calls listener each time a flight ends, with how it ended. It does not fire where no flight ran. Returns an unsubscribe.

Parameters

listener

(how) => void

Returns

() => void


onGridChange()

onGridChange(listener): () => void

Calls listener after the coordinate grid switch moves, whatever moved it: a setGridVisible call, or the HUD switch, which calls that same member. The grid is not part of the view state, so onViewChange does not carry it and a page that keeps the switch reads it here. Returns an unsubscribe.

Parameters

listener

(on) => void

Returns

() => void


onSelectionChange()

onSelectionChange(listener): () => void

Calls listener after the selection changes. Returns an unsubscribe.

Parameters

listener

(system) => void

Returns

() => void


onViewChange()

onViewChange(listener): () => void

Calls listener after the view changes. Returns an unsubscribe.

Parameters

listener

(view) => void

Returns

() => void


regionNameAt()

regionNameAt(point): string | null

The name of the codex region that holds a point on the galactic plane, or null. The lookup reads the x and the z of the point and ignores its y, because the region grid is a map of the plane and a region has no upper or lower bound. It gives null before the scene data loads.

Parameters

point

readonly [number, number, number]

Returns

string | null


regionNameAtExact()

regionNameAtExact(point): Promise<string | null>

The name of the codex region that holds a point, resolved on the game's own region grid of 49.3494 light years, or null. It reads the x and the z of the point and ignores its y, as regionNameAt does.

regionNameAt reads the coarse grid, whose cells are 197.3976 light years, and it answers in the same tick. It is the reading for something that follows the cursor every frame, such as the HUD's top bar. This call is the reading for something that names one place once, such as the information panel of a selected system, where a wrong region is stated as a fact.

The call gives a promise because the region cell table is about 199 KiB and loads on the first call. The table then stays, so every call after the first answers from it. A second call while a first load runs waits on the same load. A failed load rejects the promise rather than throwing out of the call.

Parameters

point

readonly [number, number, number]

Returns

Promise<string | null>


setBounds()

setBounds(bounds): void

Replaces the browsable bounds. The view is re-clamped in this frame, and the view change listeners fire where the clamp moved it. A setting the map cannot read leaves the one it holds in place, which getBounds then reports.

Parameters

bounds

BrowseBounds

Returns

void


setCategoryVisible()

setCategoryVisible(name, visible): void

Turns the markers of a category on or off. An unknown name changes nothing.

Parameters

name

string

visible

boolean

Returns

void


setCursorMarkerVisible()

setCursorMarkerVisible(on): void

Turns the cursor marker on or off.

Parameters

on

boolean

Returns

void


setGridVisible()

setGridVisible(on): void

Turns the coordinate grid on or off.

Parameters

on

boolean

Returns

void


setInteraction()

setInteraction(next): void

Replaces part of the interaction setting. A switch the setting does not name, and a switch that is not a boolean, keeps the value it had. The change takes effect in the frame it happens, so a drag in progress stops moving the view.

Parameters

next

Partial<InteractionSwitches>

Returns

void


setNameFilter()

setNameFilter(text): void

Keeps the markers whose name holds the text, compared without case.

Parameters

text

string

Returns

void


setNebulaeVisible()

setNebulaeVisible(on): void

Turns the nebulae on or off, from the next frame on. On a map that holds no source it does nothing and throws nothing. A value that is not a boolean leaves the state as it was.

Parameters

on

boolean

Returns

void


setRegionsVisible()

setRegionsVisible(on): void

Turns the region overlay on or off, from the next frame on. It rebuilds no scene data: the worker already built the boundary set and the renderer holds it. A value that is not a boolean leaves the state as it was.

Parameters

on

boolean

Returns

void


setSelection()

setSelection(identity): void

Selects a system by its identity, which is the id64 when the record carries one and the name when it does not. null, and an identity the set does not hold, clear the selection.

Parameters

identity

string | null

Returns

void


setShapeCategoryVisible()

setShapeCategoryVisible(name, visible): void

Turns the shapes of a category on or off. It reaches no marker: a category holds one flag for its markers and one for its shapes. An unknown name changes nothing.

Parameters

name

string

visible

boolean

Returns

void


setShapeNameFilter()

setShapeNameFilter(text): void

Keeps the shapes whose name holds the text, compared without case.

Parameters

text

string

Returns

void


setShapesVisible()

setShapesVisible(on): void

Turns the spheres and the lines on or off, from the next frame on. It rebuilds no scene data. A value that is not a boolean leaves the state as it was.

Parameters

on

boolean

Returns

void


setSystemIconsVisible()

setSystemIconsVisible(on): void

Turns the system icon stacks on or off. They are on when the map starts.

Parameters

on

boolean

Returns

void


setSystemNamesVisible()

setSystemNamesVisible(on): void

Turns the marker name labels on or off. They are off when the map starts.

Parameters

on

boolean

Returns

void


setView()

setView(view): void

Replaces part or all of the current view.

Parameters

view

Partial<MapView>

Returns

void


sphereCount()

sphereCount(): number

How many spheres the shape set holds.

Returns

number


systemAt()

systemAt(x, y): RealSystem | null

The system under a canvas pixel in CSS coordinates, or null.

Parameters

x

number

y

number

Returns

RealSystem | null


systemCount()

systemCount(): number

How many systems the set holds.

Returns

number

Clone this wiki locally