HUDWaypoints
Extends:
Member Summary
| Public Members | ||
| public |
Stores a cache from a shape short key to its canvas representation |
|
| public |
Store cached text widths |
|
| public |
compassBuffer: {"canvas": *, "context": *} |
|
| public |
|
|
| public |
Stores at how much opacity the markers should be rendered on the map. |
|
| public |
|
|
| public |
domAttach: * |
|
| public |
dummyBuffer: * |
|
| public |
hintElement: * |
|
| public |
waypointSprites: {"regular": *, "wires": *} |
|
| public |
waypoints: * |
|
| public |
|
|
Method Summary
| Public Methods | ||
| public |
addWaypoint(label: string, position: Vector) Adds a new waypoint at the given location with the given label |
|
| public |
createElements(parent: HTMLElement) Creates the overview of waypoints |
|
| public |
deleteWaypoint(waypoint: Waypoint) Deletes a waypoint from the list |
|
| public |
deserialize(data: {waypoints: Array<Waypoint>}): string Deserializes the waypoints |
|
| public |
drawOverlays(parameters: DrawParameters) Draws the waypoints on the map |
|
| public |
findCurrentIntersectedWaypoint(): Waypoint | null Finds the currently intersected waypoint on the map overview under the cursor. |
|
| public |
getTextScale(): * Returns how big the text should be rendered |
|
| public |
getTextWidth(text: string): number Returns how long a text will be rendered |
|
| public |
getWaypointCanvas(waypoint: Waypoint): HTMLCanvasElement Gets the canvas for a given waypoint |
|
| public |
getWaypointLabel(waypoint: Waypoint): string Returns the label for a given waypoint |
|
| public |
getWaypointScreenParams(waypoint: Waypoint): { screenBounds: Rectangle item: BaseItem|null, text: string } Returns the screen space bounds of the given waypoint or null if it couldn't be determined. Also returns wheter its a shape or not |
|
| public |
getWaypointUiScale(): * Returns the scale for rendering waypoints |
|
| public |
Initializes everything |
|
| public |
isWaypointDeletable(waypoint: Waypoint): boolean Returns if a waypoint is deletable |
|
| public |
moveToWaypoint(waypoint: Waypoint) Moves the camera to a given waypoint |
|
| public |
onMouseDown(pos: Vector, button: enumMouseButton): * Mouse-Down handler |
|
| public |
renameWaypoint(waypoint: Waypoint, label: string) Renames a waypoint with the given label |
|
| public |
requestSaveMarker(param0: object) Requests to save a marker at the current camera position. |
|
| public |
Re-renders the waypoint list to account for changes |
|
| public |
Rerenders the compass |
|
| public |
serialize(): {"waypoints": *} Serializes the waypoints |
|
| public |
Sort waypoints by name |
|
| public |
update() Called every frame to update stuff |
|
Inherited Summary
| From class BaseHUDPart | ||
| public |
|
|
| public |
root: * |
|
| public |
cleanup() Cleans up the hud element, if overridden make sure to call super.cleanup |
|
| public |
Cleans up all click detectors |
|
| public |
close() Should close the element, in case its supported |
|
| public |
closeOnBackgroundClick(element: HTMLElement, closeMethod: function) Closes this element when its background is clicked |
|
| public |
createElements(parent: HTMLElement) Should create all require elements |
|
| public |
draw(parameters: DrawParameters) Should draw the hud |
|
| public |
drawOverlays(parameters: DrawParameters) Should draw any overlays (screen space) |
|
| public |
forwardGameSpeedKeybindings(sourceMapper: KeyActionMapper) Forwards the game speed keybindings so you can toggle pause / Fastforward in the building tooltip and such |
|
| public |
forwardMapMovementKeybindings(sourceMapper: KeyActionMapper) Forwards the map movement keybindings so you can move the map with the arrow keys |
|
| public |
Should initialize the element, called after the elements have been created |
|
| public |
Should return true if this overlay is open and currently blocking any user interaction |
|
| public |
Registers a new click detector |
|
| public |
Should return false if the game should be paused |
|
| public |
Should return true if the widget has a modal dialog opened and thus the game does not need to update / redraw |
|
| public |
trackClicks(element: Element, handler: function, args: import("../../core/click_detector").ClickDetectorConstructorArgs=) Helper method to construct a new click detector |
|
| public |
update() Should update any required logic |
|
Public Members
public cachedKeyToCanvas: {} source
Stores a cache from a shape short key to its canvas representation
public compassBuffer: {"canvas": *, "context": *} source
public currentMarkerOpacity: number source
Stores at how much opacity the markers should be rendered on the map. This is interpolated over multiple frames so we have some sort of fade effect
public directionIndicatorSprite: * source
public domAttach: * source
public dummyBuffer: * source
public hintElement: * source
public waypointSprites: {"regular": *, "wires": *} source
public waypoints: * source
public waypointsListElement: * source
Public Methods
public addWaypoint(label: string, position: Vector) source
Adds a new waypoint at the given location with the given label
public createElements(parent: HTMLElement) source
Creates the overview of waypoints
Override:
BaseHUDPart#createElementsParams:
| Name | Type | Attribute | Description |
| parent | HTMLElement |
public deleteWaypoint(waypoint: Waypoint) source
Deletes a waypoint from the list
Params:
| Name | Type | Attribute | Description |
| waypoint | Waypoint |
public drawOverlays(parameters: DrawParameters) source
Draws the waypoints on the map
Override:
BaseHUDPart#drawOverlaysParams:
| Name | Type | Attribute | Description |
| parameters | DrawParameters |
public findCurrentIntersectedWaypoint(): Waypoint | null source
Finds the currently intersected waypoint on the map overview under the cursor.
Return:
| Waypoint | null |
public getTextWidth(text: string): number source
Returns how long a text will be rendered
Params:
| Name | Type | Attribute | Description |
| text | string |
public getWaypointCanvas(waypoint: Waypoint): HTMLCanvasElement source
Gets the canvas for a given waypoint
Params:
| Name | Type | Attribute | Description |
| waypoint | Waypoint |
Return:
| HTMLCanvasElement |
public getWaypointLabel(waypoint: Waypoint): string source
Returns the label for a given waypoint
Params:
| Name | Type | Attribute | Description |
| waypoint | Waypoint |
public getWaypointScreenParams(waypoint: Waypoint): { screenBounds: Rectangle item: BaseItem|null, text: string } source
Returns the screen space bounds of the given waypoint or null if it couldn't be determined. Also returns wheter its a shape or not
Params:
| Name | Type | Attribute | Description |
| waypoint | Waypoint |
Return:
| { screenBounds: Rectangle item: BaseItem|null, text: string } |
public isWaypointDeletable(waypoint: Waypoint): boolean source
Returns if a waypoint is deletable
Params:
| Name | Type | Attribute | Description |
| waypoint | Waypoint |
public moveToWaypoint(waypoint: Waypoint) source
Moves the camera to a given waypoint
Params:
| Name | Type | Attribute | Description |
| waypoint | Waypoint |
public onMouseDown(pos: Vector, button: enumMouseButton): * source
Mouse-Down handler
Params:
| Name | Type | Attribute | Description |
| pos | Vector | ||
| button | enumMouseButton |
Return:
| * |
public renameWaypoint(waypoint: Waypoint, label: string) source
Renames a waypoint with the given label
public requestSaveMarker(param0: object) source
Requests to save a marker at the current camera position. If worldPos is set, uses that position instead.
Params:
| Name | Type | Attribute | Description |
| param0 | object | ||
| param0.worldPos | Vector= | Override the world pos, otherwise it is the camera position |
|
| param0.waypoint | Waypoint= | Waypoint to be edited. If omitted, create new |
