-
Notifications
You must be signed in to change notification settings - Fork 0
GalaxyMap
Imported from @elite-dangerous-almanac/galaxy-map.
What createGalaxyMap gives back.
readonlyhud: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.
readonlyready:Promise<void>
Settles when the map draws its first frame, or fails.
addCategories(
categories):CategoryReport
Reads categories into the table and returns the report.
readonly CategoryInput[]
addLines(
lines):ShapeReport
Reads lines into the shape set and returns the report.
readonly LineInput[]
addSpheres(
spheres):ShapeReport
Reads spheres into the shape set and returns the report.
readonly SphereInput[]
addSystems(
records):AddReport
Reads records into the set and returns the report.
readonly SystemRecordInput[]
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.
boolean
areRegionsVisible():
boolean
True while the region overlay draws its boundary lines and places its labels.
boolean
areShapesVisible():
boolean
True while the spheres and the lines draw.
boolean
areSystemIconsVisible():
boolean
True while the system icon stacks draw.
boolean
areSystemNamesVisible():
boolean
True while the marker name labels draw.
boolean
categoryCount():
number
How many categories the table holds.
number
clearShapes():
void
Empties the shape set.
void
clearSystems():
void
Empties the system set.
void
clearSystemsAndCategories():
void
Empties the system set and the category table together.
void
dispose():
void
Stops the map and releases what it holds. A second call does nothing.
void
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.
Promise<FlightOutcome>
getBounds():
BrowseBounds
Reads the browsable bounds back as the host gave them, and not the shape the map works out from them.
getCategory(
index):Category|null
Reads one category of the table as a copy, or null outside it.
number
Category | null
getDatasets():
DatasetInfo[]
The dataset catalog the options named, without the load functions.
getHover():
RealSystem|null
Reads the hovered system, or null.
RealSystem | null
getInteraction():
InteractionSwitches
Reads every interaction switch.
getLine(
index):Line|null
Reads one line as a copy, or null outside the set.
number
Line | null
getLoadedDataset():
DatasetInfo|null
The dataset now on the map, or null.
DatasetInfo | null
getNameFilter():
string
Reads the filter text.
string
getSelection():
RealSystem|null
Reads the selected system, or null.
RealSystem | null
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.
number
ShapeInfo | null
getShapeNameFilter():
string
Reads the shape filter text.
string
getSphere(
index):Sphere|null
Reads one sphere as a copy, or null outside the set.
number
Sphere | null
getSystem(
index):RealSystem|null
Reads one system of the set as a copy, or null outside the set.
number
RealSystem | null
getView():
MapView
Reads the current view.
hasNebulae():
boolean
True where the map was built with a nebula source it can read.
boolean
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.
boolean
isCategoryVisible(
name):boolean
True when the markers of a category draw. False for a name the table lacks.
string
boolean
isCursorMarkerVisible():
boolean
True while the cursor marker draws.
boolean
isFlying():
boolean
True while a flight runs, whether a selection or a flyTo started it.
boolean
isGridVisible():
boolean
True while the coordinate grid draws.
boolean
isShapeCategoryVisible(
name):boolean
True when the shapes of a category draw. False for a name the table lacks.
string
boolean
lineCount():
number
How many lines the shape set holds.
number
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.
string
Promise<DatasetLoadResult>
onDatasetChange(
listener): () =>void
Calls listener after the loaded dataset changes. Returns an unsubscribe.
(dataset) => void
() => void
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.
(how) => void
() => void
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.
(on) => void
() => void
onSelectionChange(
listener): () =>void
Calls listener after the selection changes. Returns an unsubscribe.
(system) => void
() => void
onViewChange(
listener): () =>void
Calls listener after the view changes. Returns an unsubscribe.
(view) => void
() => void
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.
readonly [number, number, number]
string | null
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.
readonly [number, number, number]
Promise<string | null>
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.
void
setCategoryVisible(
name,visible):void
Turns the markers of a category on or off. An unknown name changes nothing.
string
boolean
void
setCursorMarkerVisible(
on):void
Turns the cursor marker on or off.
boolean
void
setGridVisible(
on):void
Turns the coordinate grid on or off.
boolean
void
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.
Partial<InteractionSwitches>
void
setNameFilter(
text):void
Keeps the markers whose name holds the text, compared without case.
string
void
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.
boolean
void
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.
boolean
void
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.
string | null
void
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.
string
boolean
void
setShapeNameFilter(
text):void
Keeps the shapes whose name holds the text, compared without case.
string
void
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.
boolean
void
setSystemIconsVisible(
on):void
Turns the system icon stacks on or off. They are on when the map starts.
boolean
void
setSystemNamesVisible(
on):void
Turns the marker name labels on or off. They are off when the map starts.
boolean
void
setView(
view):void
Replaces part or all of the current view.
Partial<MapView>
void
sphereCount():
number
How many spheres the shape set holds.
number
systemAt(
x,y):RealSystem|null
The system under a canvas pixel in CSS coordinates, or null.
number
number
RealSystem | null
systemCount():
number
How many systems the set holds.
number
Examples
Interfaces
- AddReport
- Category
- CategoryInput
- CategoryReject
- CategoryReport
- DatasetContent
- DatasetEntry
- DatasetInfo
- DatasetLoadResult
- FlyToOptions
- FlyToTarget
- FragmentWriter
- FragmentWriterOptions
- GalaxyMap
- GalaxyMapOptions
- HudAction
- HudHandle
- HudInfoFields
- HudOptions
- InteractionSwitches
- Line
- LineInput
- MapView
- NebulaSource
- RealSystem
- Reject
- ResolvedIcon
- ShapeInfo
- ShapeReject
- ShapeReport
- Sphere
- SphereInput
- StartView
- SystemDetailValue
- SystemDetails
- SystemImage
- SystemRecordInput