Region

westures-core. Region

Allows the user to specify the control region which will listen for user input events.

Constructor

new Region(elementopt, optionsopt)

Source:
Parameters:
Name Type Attributes Default Description
element Element <optional>
null The element which should listen to input events. If not provided, will be set to the window unless operating in "headless" mode.
options object <optional>
Properties
Name Type Attributes Default Description
capture boolean <optional>
false Whether the region uses the capture phase of input events. If false, uses the bubbling phase.
preferPointer boolean <optional>
true If false, the region listens to mouse/touch events instead of pointer events.
preventDefault boolean <optional>
true Whether the default browser functionality should be disabled. This option should most likely be ignored. Here there by dragons if set to false.
touchAction string <optional>
'none' Value to set the CSS 'touch-action' property to on elements added to the region.
headless boolean <optional>
false Set to true to turn on "headless" mode. This mode is intended for use outside of a browser environment. It does not listen to window events, so instead you will have to send events directly into the region. Pointer down/move/up events should be sent to Region.arbitrate(event), cancel events should be sent to Region.cancel(event), and keyboard events should be sent to Region.handleKeyboardEvent(event). You do not need to supply an element to the Region constructor in this mode, but you will still need to attach elements to Gestures, and the events you pass in should specify event.target appropriately, in order to select which gestures to run.

Members

activeGestures :Set.<westures-core.Gesture>

Description:
  • The list of active gestures for the current input session.
Source:
The list of active gestures for the current input session.
Type:

element :Element

Description:
  • The element being bound to.
Source:
The element being bound to.
Type:
  • Element

gestures :Set.<westures-core.Gesture>

Description:
  • The list of relations between elements, their gestures, and the handlers.
Source:
The list of relations between elements, their gestures, and the handlers.
Type:

options :object

Description:
  • The user-supplied options for the Region.
Source:
The user-supplied options for the Region.
Type:
  • object

potentialGestures :Set.<westures-core.Gesture>

Description:
  • The base list of potentially active gestures for the current input session.
Source:
The base list of potentially active gestures for the current input session.
Type:

state :westures-core.State

Description:
  • The internal state object for a Region. Keeps track of inputs.
Source:
The internal state object for a Region. Keeps track of inputs.
Type:

Methods

addGesture(gesture)

Description:
  • Adds the given gesture to the region.
Source:
Parameters:
Name Type Description
gesture westures-core.Gesture Instantiated gesture to add.

getGesturesByElement(element) → {Array.<westures-core.Gesture>}

Description:
  • Retrieves Gestures by their associated element.
Source:
Parameters:
Name Type Description
element Element The element for which to find gestures.
Returns:
Gestures to which the element is bound.
Type
Array.<westures-core.Gesture>

removeGesture(gesture)

Description:
  • Removes the given gesture from the region.
Source:
Parameters:
Name Type Description
gesture westures-core.Gesture Instantiated gesture to add.

removeGesturesByElement(element)

Description:
  • Remove all gestures bound to the given element.
Source:
Parameters:
Name Type Description
element Element The element to unbind.