PokéRogue
    Preparing search index...

    Handles the dragging of touch controls around the screen.

    Index

    Constructors

    Properties

    configurationEventListeners: ConfigurationEventListeners = ...

    The event listeners for the configuration mode. These are used to remove the event listeners when the configuration mode is disabled.

    draggingElement: HTMLElement | null = null

    The element that is currently being dragged

    inConfigurationMode: boolean

    Whether the user is currently configuring the touch controls. When this is true, the touch controls can be dragged around the screen and the controls of the game are disabled.

    isLandscapeMode: boolean = ...
    overlay: Container
    touchControls: TouchControl

    Methods

    • Creates an overlay that covers the screen and allows the user to drag the touch controls around. Also enables the toolbar for saving, resetting, and canceling the changes.

      Parameters

      • ui: UI

        The UI of the game.

      Returns void

    • Elements that are inside the left div are anchored to the left boundary of the screen. The x value of the positions are considered offsets to their respective boundaries.

      Parameters

      • element: HTMLElement

        Either an element in the left div or the right div.

      Returns boolean | undefined

      Whether the given element is inside the left div.

    • Sets a control element to the given position. The x values are either offsets to the left or right boundary of the screen, depending on the side of the element. E.g. For left elements, (0, 0) is the bottom left corner of the screen and for right elements, (0, 0) is the bottom right corner of the screen.

      Parameters

      • controlElement: HTMLElement
      • x: number

        Either an offset to the left or right boundary of the screen.

      • y: number

        An offset to the bottom boundary of the screen.

      Returns void