Home Reference Source
import {HUDLayerPreview} from 'shapez.io/js/game/hud/parts/layer_preview.js'
public class | source

HUDLayerPreview

Extends:

BaseHUDPart → HUDLayerPreview

Helper class which allows peaking through to the wires layer

Member Summary

Public Members
public

canvas: *

public

context: *

public
public

Method Summary

Public Methods
public
public

(re) initializes the canvas

public

prepareCanvasForPreview(worldPos: Vector, scale: number): *

Prepares the canvas to render at the given worldPos and the given camera scale

public

renderPreview(parameters: import("../../../core/draw_utils").DrawParameters, worldPos: Vector, scale: number)

Renders the preview at the given position

Inherited Summary

From class BaseHUDPart
public
public

root: *

public

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

Should draw any overlays (screen space)

public

Forwards the game speed keybindings so you can toggle pause / Fastforward in the building tooltip and such

public

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 canvas: * source

public context: * source

public previewOverlay: * source

public previewSize: * source

Public Methods

public initialize() source

Should initialize the element, called after the elements have been created

Override:

BaseHUDPart#initialize

public initializeCanvas() source

(re) initializes the canvas

public prepareCanvasForPreview(worldPos: Vector, scale: number): * source

Prepares the canvas to render at the given worldPos and the given camera scale

Params:

NameTypeAttributeDescription
worldPos Vector
scale number

1 / zoomLevel

Return:

*

public renderPreview(parameters: import("../../../core/draw_utils").DrawParameters, worldPos: Vector, scale: number) source

Renders the preview at the given position

Params:

NameTypeAttributeDescription
parameters import("../../../core/draw_utils").DrawParameters
worldPos Vector
scale number

1 / zoomLevel