phaser - v4.0.0-rc.4
    Preparing search index...

    The Touch Manager is a helper class that belongs to the Input Manager.

    Its role is to listen for native DOM Touch Events and then pass them onto the Input Manager for further processing.

    You do not need to create this class directly, the Input Manager will create an instance of it automatically.

    Index

    Constructors

    Properties

    capture: boolean

    If true the DOM events will have event.preventDefault applied to them, if false they will propagate fully.

    enabled: boolean

    A boolean that controls if the Touch Manager is enabled or not. Can be toggled on the fly.

    isTop: boolean

    Are the event listeners hooked into window.top or window?

    This is set during the boot sequence. If the browser does not have access to window.top, such as in cross-origin iframe environments, this property gets set to false and the events are hooked into window instead.

    manager: InputManager

    A reference to the Input Manager.

    onTouchCancel: Function

    The Touch Cancel event handler function. Initially empty and bound in the startListeners method.

    onTouchCancelWindow: Function

    The Touch Cancel event handler function specifically for events on the Window. Initially empty and bound in the startListeners method.

    onTouchEnd: Function

    The Touch End event handler function. Initially empty and bound in the startListeners method.

    onTouchEndWindow: Function

    The Touch End event handler function specifically for events on the Window. Initially empty and bound in the startListeners method.

    onTouchMove: Function

    The Touch Move event handler function. Initially empty and bound in the startListeners method.

    onTouchStart: Function

    The Touch Start event handler function. Initially empty and bound in the startListeners method.

    onTouchStartWindow: Function

    The Touch Start event handler function specifically for events on the Window. Initially empty and bound in the startListeners method.

    target: any

    The Touch Event target, as defined in the Game Config. Typically the canvas to which the game is rendering, but can be any interactive DOM element.

    Methods

    • Attempts to disable the context menu from appearing if you touch-hold on the browser.

      Works by listening for the contextmenu event and prevent defaulting it.

      Use this if you need to disable the OS context menu on mobile.

      Returns this

    • Starts the Touch Event listeners running as long as an input target is set.

      This method is called automatically if Touch Input is enabled in the game config, which it is by default. However, you can call it manually should you need to delay input capturing until later in the game.

      Returns void

    • Stops the Touch Event listeners. This is called automatically and does not need to be manually invoked.

      Returns void