A basic stock for a list of dice, based on flex.

Hierarchy

Constructors

Properties

dice: BgaDie[] = []
element: HTMLElement

the stock element (should be an empty HTML Element)

manager: DiceManager

the die manager

onDieClick?: ((die) => void)

Type declaration

    • (die): void
    • Called when selection change. Returns the clicked die.

      die: the clicked die (can be selected or unselected)

      Parameters

      Returns void

onSelectionChange?: ((selection, lastChange) => void)

Type declaration

    • (selection, lastChange): void
    • Called when selection change. Returns the selection.

      selection: the selected dice of the stock
      lastChange: the last change on selection die (can be selected or unselected)

      Parameters

      Returns void

selectedDice: BgaDie[] = []
selectionMode: DiceSelectionMode = 'none'

Methods

  • Add an array of dice to the stock.

    Parameters

    • dice: BgaDie[]

      the dice to add

    • Optional animation: DieAnimation

      a DieAnimation object

    • Optional settings: AddDieSettings

      a AddDiceettings object

    • shift: number | boolean = false

      if number, the number of milliseconds between each die. if true, chain animations

    Returns Promise<boolean>

  • Add a die to the stock.

    Parameters

    Returns Promise<boolean>

    the promise when the animation is done (true if it was animated, false if it wasn't)

  • Checks if the die can be added. By default, only if it isn't already present in the stock.

    Parameters

    Returns boolean

    if the die can be added

  • Set the selectable class for each die.

    Parameters

    • Optional selectableDice: BgaDie[]

      the selectable dice. If unset, all dice are marked selectable. Default unset.

    Returns void

  • Set if the stock is selectable, and if yes if it can be multiple. If set to 'none', it will unselect all selected dice.

    Parameters

    • selectionMode: DiceSelectionMode

      the selection mode

    • Optional selectableDice: BgaDie[]

      the selectable dice (all if unset). Calls setSelectableDice method

    Returns void

Generated using TypeDoc