turbodombuilder - v0.9.5
    Preparing search index...

    Class TurboEventManager<ToolType>

    Class that manages default mouse, trackpad, and touch events, and accordingly fires custom events for easier management of input.

    Type Parameters

    • ToolType extends string = string

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    managers: TurboEventManager<string>[] = []
    keyController: TurboEventManagerKeyController
    wheelController: TurboEventManagerWheelController
    pointerController: TurboEventManagerPointerController
    dispatchController: TurboEventManagerDispatchController
    selected: boolean

    Whether the element is selected or not.

    initialized: boolean
    view: any

    The view (if any) of the element. Only when initializing MVC.

    model: TurboEventManagerModel

    The model (if any) of the element. Only when initializing MVC.

    data: any

    The main data block (if any) attached to the element, taken from its model (if any). Only when initializing MVC.

    dataId: string

    The ID of the main data block (if any) of the element, taken from its model (if any). Only when initializing MVC.

    dataIndex: number

    The numerical index of the main data block (if any) of the element, taken from its model (if any). Only when initializing MVC.

    dataSize: number

    The size (number) of the main data block (if any) of the element, taken from its model (if any). Only when initializing MVC.

    config: any = {}

    Static configuration object.

    mvc: Mvc<
        TurboEventManager<ToolType>,
        any,
        any,
        TurboEventManagerModel,
        TurboEmitter<any>,
    >

    The MVC handler of the element. If initialized, turns the element into an MVC structure.

    Accessors

    • get allManagers(): TurboEventManager<string>[]

      Returns TurboEventManager<string>[]

    • set allManagers(managers: TurboEventManager<string>[]): void

      Parameters

      Returns void

    • get inputDevice(): InputDevice

      Returns InputDevice

      The currently identified input device. It is not 100% accurate, especially when differentiating between mouse and trackpad.

    • get currentClick(): ClickMode

      Returns ClickMode

    • get currentKeys(): string[]

      Returns string[]

    • get onToolChange(): Delegate<
          (oldTool: Node, newTool: Node, type: ClickMode) => void,
      >

      Returns Delegate<(oldTool: Node, newTool: Node, type: ClickMode) => void>

      Delegate fired when a tool is changed on a certain click button/mode

    • get authorizeEventScaling(): boolean | (() => boolean)

      Returns boolean | (() => boolean)

    • set authorizeEventScaling(value: boolean | (() => boolean)): void

      Parameters

      • value: boolean | (() => boolean)

      Returns void

    • get scaleEventPosition(): (position: Point) => Point

      Returns (position: Point) => Point

    • set scaleEventPosition(value: (position: Point) => Point): void

      Parameters

      Returns void

    • get moveThreshold(): number

      Returns number

    • set moveThreshold(value: number): void

      Parameters

      • value: number

      Returns void

    • get longPressDuration(): number

      Returns number

    • set longPressDuration(value: number): void

      Parameters

      • value: number

      Returns void

    • set keyEventsEnabled(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • set wheelEventsEnabled(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • set moveEventsEnabled(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • set mouseEventsEnabled(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • set touchEventsEnabled(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • set clickEventEnabled(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • set dragEventEnabled(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get enabled(): boolean

      Returns boolean

    • set enabled(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get preventDefaultWheel(): boolean

      Returns boolean

    • set preventDefaultWheel(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get preventDefaultMouse(): boolean

      Returns boolean

    • set preventDefaultMouse(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get preventDefaultTouch(): boolean

      Returns boolean

    • set preventDefaultTouch(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get toolsArray(): Node[]

      Returns Node[]

      All attached tools in an array

    Methods

    • Returns void

      Resets the lock state to the default values.

    • Parameters

      Returns Node

    • Parameters

      Returns Node[]

      Returns the instances of the tool currently held by the provided click mode

    • Parameters

      Returns ToolType

      Returns the name of the tool currently held by the provided click mode

    • Parameters

      Returns ToolType

    • Parameters

      Returns Node[]

    • Parameters

      Returns Node[]

      Returns the tool with the given name (or undefined)

    • Parameters

      Returns Node

      Returns the first tool with the given name (or undefined)

    • Parameters

      • key: string

      Returns Node[]

      Returns the tools associated with the given key

    • Parameters

      • key: string
      • Optionalpredicate: (tool: Element) => boolean

      Returns Node

      Returns the first tool associated with the given key

    • Parameters

      Returns void

      Adds a tool to the tools map, identified by its name. Optionally, provide a key to bind the tool to.

    • Parameters

      Returns void

      Sets the provided tool as a current tool associated with the provided type

    • Parameters

      • key: string

      Returns boolean

      Sets tool associated with the provided key as the current tool for the key mode

    • Parameters

      • type: string

      Returns void

    • Parameters

      • turboEventNames: Record<string, string>
      • defaultEventNames: Record<string, string>
      • applyTurboEvents: boolean

      Returns void

    • Returns void

    • Protected

      getPropertiesValue

      Type Parameters

      • Type

      Parameters

      • propertiesValue: Type

        The actual value; could be null.

      • OptionalconfigFieldName: string

        The field name of the associated value in the static config. Will be returned if the actual value is null.

      • OptionaldefaultValue: Type

        The default fallback value. Will be returned if both the actual and config values are null.

      Returns Type

      Returns the value with some fallback mechanisms on the static config field and a default value.

    • initialize

      Returns void

      Initializes the element.

    • Parameters

      • value: any

        The object containing the new configurations.

      Returns void

      Update the class's static configurations. Will only overwrite the set properties.