Home Reference Source
import {DynamicDomAttach} from 'shapez.io/js/game/hud/dynamic_dom_attach.js'
public class | source

DynamicDomAttach

Constructor Summary

Public Constructor
public

constructor(root: GameRoot, element: HTMLElement, param2: object)

Member Summary

Public Members
public
public
public
public

element: HTMLElement

public
public
public
public
public

parent: *

public
public
public
public

Method Summary

Public Methods
public

Internal method to attach the element

public

Internal method to detach the element

public

isAttached(): *

Returns whether the element is currently attached

public

Actually sets the 'hovered' class

public

update(isVisible: boolean)

Call this every frame, and the dom attach class will take care of everything else

Public Constructors

public constructor(root: GameRoot, element: HTMLElement, param2: object) source

Params:

NameTypeAttributeDescription
root GameRoot
element HTMLElement
param2 object
param2.timeToKeepSeconds number=

How long to keep the element visible (in ms) after it should be hidden. Useful for fade-out effects

param2.attachClass string=

If set, attaches a class while the element is visible

param2.trackHover boolean=

If set, attaches the 'hovered' class if the cursor is above the element. Useful for fading out the element if its below the cursor for example.

Public Members

public attachClass: * source

public attached: boolean source

public classAttachTimeout: * source

public element: HTMLElement source

public internalIsClassAttached: boolean source

public lastComputedBounds: DOMRect source

public lastComputedBoundsTime: * source

public lastVisibleTime: number source

public parent: * source

public root: GameRoot source

public timeToKeepSeconds: * source

public trackHover: * source

public trackedIsHovered: * source

Public Methods

public internalAttach() source

Internal method to attach the element

public internalDetach() source

Internal method to detach the element

public isAttached(): * source

Returns whether the element is currently attached

Return:

*

public setIsHoveredClass(isHovered: boolean) source

Actually sets the 'hovered' class

Params:

NameTypeAttributeDescription
isHovered boolean

public update(isVisible: boolean) source

Call this every frame, and the dom attach class will take care of everything else

Params:

NameTypeAttributeDescription
isVisible boolean

Whether the element should currently be visible or not