Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface UIButtonPicture

Type requirement for Pictures of Buttons.

Implemented by

Index

Properties

Readonly scale

scale : ScaleXY

Positioning scale

Readonly theme

theme : Theme

Methods

dispose

  • dispose(): this
  • Dispose object, ceasing its operation while keeping the object intact until call of 'restore'.

    Returns this

    Object itself for fluent interface

fitTo

  • fitTo(bounds: Point): this
  • Fit object to bounding box.

    Parameters

    • bounds: Point

      Bounds in pixels

    Returns this

    Object itself

getDraggingMode

  • Get dragging mode of object. Defines how the object can be dragged by mouse.

    Returns UIDraggingModes

    Object itself

getFillStyle

  • Get fill style of Picture

    Returns FillStyle

getFillStyleHighlight

  • getFillStyleHighlight(): FillStyle | undefined
  • Returns FillStyle | undefined

    Highlight FillStyle of the object or undefined for auto assignment

getHighlighted

  • getHighlighted(): boolean
  • Returns boolean

    True for highlighted state of object and false for basic

getIsUnderMouse

  • getIsUnderMouse(): boolean
  • Get boolean flag for whether object is currently under mouse or not

    Returns boolean

    Boolean for is object under mouse currently

getMargin

  • Get margin around object in pixels.

    Returns Margin

    Margin datastructure

getMouseInteractions

  • getMouseInteractions(): boolean
  • Returns boolean

    Mouse interactions state

getMouseStyle

  • Get mouse style.

    Returns UIMouseStyle

    Interface for defining how mouse should look when hovering over UI object

getOrigin

  • Get the position origin of this UiElement. Affects how the "position" of UIElement is interpreted.

    Returns Point

    Vec2 with each plane in range [-1, 1], where 0 is middle

getPosition

  • Returns the position of this UiElement at given location relative to elements size.

    Parameters

    • relativePosition: Point

      Relative position vector (-1 to 1 which specifies position of origin, 0 is center of the object)

    • spaceOfInterest: UISpace

      Parameter to disregard parts of object when calculating the asked position. Defaults to Margin, which includes everything. Should only ever be necessary for other UiElements

    Returns Point

    Object itself for fluent itself

getSize

  • Returns the size of the UiElements in pixels including any Margins or Paddings

    Parameters

    • spaceOfInterest: UISpace

      Parameter to disregard parts of object when calculating the position. Defaults to Margin, which includes everything. Should only ever be necessary for sub-classes

    Returns Point

    Object size in pixels

getStrokeStyle

  • getStrokeStyle(): LineStyle
  • Get stroke style of Picture

    Returns LineStyle

getStrokeStyleHighlight

  • getStrokeStyleHighlight(): LineStyle | undefined
  • Returns LineStyle | undefined

    Highlight LineStyle of the object or undefined for auto assignment

isDisposed

  • isDisposed(): boolean
  • Returns boolean

    True if all sub elements are disposed, false if not.

offHighlight

  • offHighlight(token: Token): boolean
  • Unsubscribe from Highlight object event. This is called whenever an object is highlighted

    Parameters

    • token: Token

      Token that was received when subscribing to the event.

    Returns boolean

    True if the unsubscription was successful.

offMouseClick

  • offMouseClick(token: Token): boolean
  • Remove event listener from Mouse Click Event

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

    True if the listener is successfully removed and false if it is not found

offMouseDoubleClick

  • offMouseDoubleClick(token: Token): boolean
  • Remove event listener from Mouse Double Click Event

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

    True if the listener is successfully removed and false if it is not found

offMouseDown

  • offMouseDown(token: Token): boolean
  • Remove event listener from Mouse Down Event

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

    True if the listener is successfully removed and false if it is not found

offMouseDrag

  • offMouseDrag(token: Token): boolean
  • Remove event listener from Mouse Drag Event

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

    True if the listener is successfully removed and false if it is not found

offMouseDragStart

  • offMouseDragStart(token: Token): boolean
  • Remove event listener from Mouse Drag Start Event

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

    True if the listener is successfully removed and false if it is not found

offMouseDragStop

  • offMouseDragStop(token: Token): boolean
  • Remove event listener from Mouse Drag Stop Event

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

    True if the listener is successfully removed and false if it is not found

offMouseEnter

  • offMouseEnter(token: Token): boolean
  • Remove event listener from Mouse Enter Event

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

    True if the listener is successfully removed and false if it is not found

offMouseLeave

  • offMouseLeave(token: Token): boolean
  • Remove event listener from Mouse Leave Event

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

    True if the listener is successfully removed and false if it is not found

offMouseMove

  • offMouseMove(token: Token): boolean
  • Remove event listener from Mouse Move Event

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

    True if the listener is successfully removed and false if it is not found

offMouseUp

  • offMouseUp(token: Token): boolean
  • Remove event listener from Mouse Up Event

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

    True if the listener is successfully removed and false if it is not found

offMouseWheel

  • offMouseWheel(token: Token): boolean
  • Remove event listener from Mouse Wheel Event

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

    True if the listener is successfully removed and false if it is not found

offTouchEnd

  • offTouchEnd(token: Token): boolean
  • Remove event listener from Touch End Event

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

    True if the listener is successfully removed and false if it is not found

offTouchMove

  • offTouchMove(token: Token): boolean
  • Remove event listener from Touch Move Event

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

    True if the listener is successfully removed and false if it is not found

offTouchStart

  • offTouchStart(token: Token): boolean
  • Remove event listener from Touch Start Event

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

    True if the listener is successfully removed and false if it is not found

onHighlight

  • onHighlight(handler: function): Token
  • Subscribe to highlight object event. This is called whenever an object is highlighted.

    Parameters

    • handler: function

      Function that is called when event is triggered.

        • Parameters

          • isHighlighted: boolean

          Returns void

    Returns Token

    Token that can be used to unsubscribe from the event.

onMouseClick

  • Subscribe to Mouse Click event

    Parameters

    • listener: MouseEventHandler<this>

      Function that will be called when mouse clicks the bounds of UiObject.

    Returns Token

    Token-object that is a reference ID to the listener created.

onMouseDoubleClick

  • Subscribe to Mouse Double Click event

    Parameters

    Returns Token

onMouseDown

  • Subscribe to Mouse Down event

    Parameters

    Returns Token

onMouseDrag

onMouseDragStart

onMouseDragStop

onMouseEnter

  • Subscribe to Mouse Enter event

    Parameters

    • listener: MouseEventHandler<this>

      Function that will be called when mouse enters the bounds of UiObject.

    Returns Token

    Token-object that is a reference ID to the listener created.

onMouseLeave

  • Subscribe to Mouse Leave event

    Parameters

    Returns Token

    Token-object that is a reference ID to the listener created.

onMouseMove

  • Subscribe to Mouse Move event

    Parameters

    Returns Token

    Token of subscription

onMouseUp

  • Subscribe to Mouse Up event

    Parameters

    Returns Token

onMouseWheel

  • Subscribe to Mouse Wheel event

    Parameters

    Returns Token

    Token of subscription

onTouchEnd

  • Subscribe to Touch End event

    Parameters

    Returns Token

    Token of subscription

onTouchMove

  • Subscribe to Touch Move event

    Parameters

    Returns Token

    Token of subscription

onTouchStart

  • Subscribe to Touch Start event

    Parameters

    Returns Token

    Token of subscription

restore

  • restore(): this
  • Restore object if it was previously disposed.

    Returns this

    Object itself itself for fluent interface

setDraggingMode

  • Set dragging mode of object. Defines how the object can be dragged by mouse.

    See UIDraggingModescollection for options.

    Parameters

    • draggingMode: UIDraggingModes

      DraggingMode or undefined to disable dragging

    Returns this

    Object itself

setFillStyle

  • Set fill style of Picture

    Parameters

    Returns this

    Object itself for fluent interface

setFillStyleHighlight

  • Set highlight fill style of object filling

    Parameters

    Returns this

    Object itself for fluent interface

setHighlighted

  • setHighlighted(isHighlighted: boolean): this
  • Set highlighted state of the Object

    Parameters

    • isHighlighted: boolean

      Highlight state of the object

    Returns this

    Object itself for fluent interface

setMargin

  • setMargin(margin: Partial<MMargin> | number): this
  • Set margin around object in pixels.

    Parameters

    • margin: Partial<MMargin> | number

      Number with pixel margins for all sides or datastructure with individual pixel margins for each side. Any side can be omitted, only passed values will be overridden.

    Returns this

    Object itself

setMouseInteractions

  • setMouseInteractions(state: boolean): this
  • Set mouse interactions enabled or disabled

    Parameters

    • state: boolean

      Specifies state of mouse interactions

    Returns this

    Object itself for fluent interface

setMouseStyle

  • Set mouse style when hovering over UI object.

    Parameters

    • mouseStyle: UIMouseStyle

      Interface for defining how mouse should look when hovering over UI object

    Returns this

    Object itself

setOrigin

  • setOrigin(origin: Point): this
  • Sets the position origin of this UiElement. Affects how the "position" of UIElement is interpreted.

    See UIOrigins for a collection of common arguments in an easy-to-read format.

    Parameters

    Returns this

    Object itself

setPosition

  • setPosition(position: Point): this
  • Sets the position of this UiElement relative to its origin.

    NOTE: UIElements scale can't be changed apart from when it is created.

    Parameters

    • position: Point

      Location on the UIElements scale, where its origin should be positioned

    Returns this

    Object itself

setStrokeStyle

  • Set stoke style of Picture

    Parameters

    • value: LineStyle | ImmutableMutator<LineStyle>

      LineStyle object or function which modifies it

    Returns this

    Object itself for fluent interface

setStrokeStyleHighlight

  • setStrokeStyleHighlight(value: LineStyle | ImmutableMutator<LineStyle> | undefined): this
  • Set stroke style of object when it is highlighted

    Parameters

    • value: LineStyle | ImmutableMutator<LineStyle> | undefined

      LineStyle for highlighted object or mutator to modify existing one or undefined for auto assignment

    Returns this

    Object itself for fluent interface