gradum-kit - v0.1.0
    Preparing search index...

    Class GradumTool<ElementType, ViewType, ModelType, EmitterType>

    GradumTool

    A named mode that changes what interacting with an element does. Its @behavior methods run during the capture phase of the event loop, before any interactor sees the event, so a tool can claim an interaction and stop it reaching the element underneath. Only the active tool for a given click mode receives events.

    Type Parameters

    Hierarchy (View Summary)

    Index
    element: ElementType

    The element it is bound to.

    view: ViewType

    The MVC view.

    model: ModelType

    The MVC model.

    emitter: EmitterType

    The MVC emitter.

    keyName: string

    The key of the tool. Used to retrieve it in the main component. If not set, if the element's class name is MyElement and the tool's class name is MyElementSomethingTool, the key would default to "something".

    toolName: string

    The name of the tool.

    embeddedTarget: Node

    The target of this tool. If defined, will embed the tool.

    The associated event manager. Defaults to GradumEventManager.instance.

    activationEvent: string = DefaultEventName.click

    Custom activation event to listen to. Defaults to the default click event name.

    clickMode: ClickMode = ClickMode.left

    Click mode that will hold this tool when activated. Defaults to ClickMode.left.

    key: string

    Optional keyboard key to map to this tool. When pressed, it will be set as the current key tool.

    • Protected Function

      setup

      Returns void

      Called in the constructor. Use for setup that should happen at instantiation, before this.initialize() is called.

    • Protected Function

      setupUIListeners

      Returns void

      Setup method for defining DOM and input event listeners.

    • Protected Function

      setupChangedCallbacks

      Returns void

      Setup method intended to initialize change listeners and callbacks.

    • Function

      initialize

      Returns void

      Initialization function that calls GradumSelector.makeTool on this.element, sets it up, and attaches all the defined tool behaviors.

    • Function

      customActivation

      Parameters

      • element: ElementType

        The tool element itself.

      • Optionalmanager: GradumEventManager

        The event manager instance this tool should register against. Defaults to GradumEventManager.instance.

      Returns void

      Custom activation function.

    • Function

      onActivate

      Returns void

      Function to execute when the tool is activated.

    • Function

      onDeactivate

      Returns void

      Function to execute when the tool is deactivated.