API Docs for: 2.7.3
Show:

MobileInputComponent Class

Extends BaseComponent2D
Module: Component
Parent Module: Wanaplan

This component is responsible for configuring the correct input mode on mobile devices. It checks the user's input method (touch or mouse). If mouse is detected nothing is done and the component is removed. Otherwise, touch screen support is enabled.

Constructor

MobileInputComponent

(
  • core
)

Parameters:

  • core Core

    The main engine.

Methods

_bindListeners

()

Binds the listeners for input events

_onInputChanged

(
  • event
)

Called when an input event is detected. It disables the input method that is not necessary (touch or mouse). Triggered on window events touchstart, mousemove, pointerdown, or MSPointerDown

Parameters:

  • event Event

    The event object.

_unbindListeners.

()

Unbinds the listeners for input events

destroy

()

Inherited from BaseComponent2D

Destroys the component and removes all listeners.

disable

()

Inherited from BaseComponent2D:

Disables the component

enable

()

Inherited from BaseComponent2D:

Enables the component

getTargeted

(
  • vector
)
Object

Inherited from BaseComponent2D:

Finds out if the given position is over an element handled by the component

Parameters:

  • vector Vector

    A position, usually the cursor's one.

Returns:

Object:

The targeted element, or null if nothing is found.

initialize

()

Inherited from BaseComponent2D:

Method called when Wanaplan is initialized. You don't need to call this method manually.

onContextChanged

(
  • context
)

Inherited from BaseComponent2D:

Method called when the context is switched (2D -> 3D or 3D -> 2D)

Parameters:

  • context String
    The new context

removeInputSupport

(
  • type
)

Removes support of an input method (touch or mouse).

Parameters:

  • type String

    The type of input method to remove (touch or mouse).

startListening

()

Inherited from BaseComponent2D:

Calls all the event listeners.

stopListening

()

Inherited from BaseComponent2D:

Removes all the event listeners.

update

()

Inherited from BaseComponent2D:

Generic update method, called on every frame

Properties

name

String

Inherited from BaseComponent2D:

Component name

priority

Number

Inherited from BaseComponent2D:

Priority of the component in the "update" and "draw" routines

structure

wnp.Structure

Inherited from BaseComponent2D:

Structure file instance (shortcut to wanaplan.structure). This is the base object where the whole plan is saved