This namespace contains definitions for interaction objects. These objects act as generic controls, but with the difference that interactions are not visual elements in DOM. Interactions can be attached to a DOM element, listening to DOM events and translating those events to more understandable events for the API, specially for touch or pen events.
This namespace uses Hammer API internally for make it easy to support touch and pen events and complex gestures.
Take notice that OpenLayers has it own interactions objects in the ol.interaction
namespace. Unfortunately, this objects are tied to the ol.Map object and execute
specific actions for an ol.Map object. On the contrary, the objects in this
namespace do not execute any action, the same way as controls
work.
For now viewers that show 2D data as bu.ortho.Viewer
or
bu.oblique.Viewer
internally uses the objects from OpenLayers
and the interactions from this namespace are only used in the bu.street.Viewer
.
In a future the API could evolve to a unified interaction system for all the viewers
in order to have only one interaction system and to support more complex gestures or devices.
- Source:
- bu/interaction/interaction.jsdoc
Classes
- AxisInteraction
- Collection
- CollectionEvent
- Drag
- Draw
- Dynamics
- HammerGestures
- HammerGesturesHandle
- Interaction
- InteractionEvent
- KeyAxis
- KeyTrigger
- MouseClick
- MouseHover
- PinchZoom
- Qtvr
- ScrollZoom
- Tap
- TriggerInteraction
- WheelListener
Methods
-
<static> defaults(element)
-
Return an object with names of default interactions as keys and
bu.interaction.Interaction
as properties. The object contains this interaction keys:- mouseHover
- mouseClick
- mouseDrag
- touchView
- pinch
- scrollZoom
Parameters:
Name Type Description element
Element Element to listen for events.
- Source:
- bu/interaction/defaults.js
Returns:
- Type
- Object.<string, bu.interaction.Interaction>
Type Definitions
-
CollectionEventType
-
Types of events for a
bu.interaction.Collection
.STARTED: 'started' // Triggered when any interaction has started. ENDED: 'ended' // Triggered when any interaction has ended. PARAMETERCHANGED: 'parameterchanged' // Triggered when any interaction paramater //has changed. // A static parameter is the one that do not change over time. // A dynamics parameter is one that can change or not in time due to velocity // and friction once it is started at an initial value. ACTIVECHANGED: 'change:active' //Triggered when the active state of any //interaction changes
Type:
- string
- Source:
- bu/enums.js
-
ComposedInteraction
-
AxisInteraction with extra properties to work as composed.
Type:
- Object
- Source:
- bu/typedefs.js
Properties:
Name Type Description instance
bu.interaction.AxisInteraction Interaction instance.
dynamics
bu.interaction.Dynamics Dynamics parameters.
parameterDynamicsHandler
function Handler for the ParameterChanged event.
-
ComposedReturn
-
ComposedReturn is an object with the result of data of composing AxisInteraction parameters.
Type:
- Object
- Source:
- bu/typedefs.js
Properties:
Name Type Description parameters
Object.<string, number> an object with the parameters.
changing
boolean if the values are changing.
-
DragOptions
-
Options for a
bu.interaction.Drag
.Type:
- Object
- Source:
- bu/typedefs.js
Properties:
Name Type Description element
Element | undefined The DOM element where the events are listened to.
active
boolean | undefined If the interaction must be set to active or not.
pointerType
bu.interaction.PointerType | undefined Type of pointer.
friction
number | undefined Friction.
maxFrictionTime
number | undefined Max friction time.
-
DrawOptions
-
Options for a
bu.interaction.Draw
.Type:
- Object
- Source:
- bu/typedefs.js
Properties:
Name Type Description element
Element | undefined The DOM element where the events are listened to.
active
boolean | undefined If the interaction must be set to active or not.
maxPoints
bu.interaction.PointerType | undefined The number of points that will trigger a DrawEnd event.
-
InteractionEventType
-
Types of events for a
bu.interaction.Interaction
.STARTED: 'started' // Triggered when the interaction has started. ENDED: 'ended' // Triggered when the interaction has stopped. PARAMETERCHANGED: 'parameterchanged' // Triggered when a parameter in an // interaction changes. // A static parameter is the one that do not change over time. // A dynamics parameter is one that can change or not in time due to velocity // and friction once it is started at an initial value. ACTIVECHANGED: 'change:active' //Triggered when the active state of the //interaction changes
Type:
- string
- Source:
- bu/enums.js
-
InteractionOptions
-
Options for a
bu.interaction.Interaction
.Type:
- Object
- Source:
- bu/typedefs.js
Properties:
Name Type Description element
Element | undefined The DOM element where the events are listened to.
active
boolean | undefined If the interaction must be set to active or not.
-
InteractionStatus
-
Interaction status properties.
Type:
- Object
- Source:
- bu/typedefs.js
Properties:
Name Type Description instance
bu.interaction.Interaction Interaction instance.
parameterChangedHandler
function The handler for the parameter changed events.
-
KeyOptions
-
Options for a
bu.interaction.KeyAxis
.Type:
- Object
- Source:
- bu/typedefs.js
Properties:
Name Type Description element
Element | undefined The DOM element where the events are listened to.
active
boolean | undefined If the interaction must be set to active or not.
keyCode
number | undefined Key which activates the interaction when pressed.
parameter
string | undefined The parameter to be controlled (e.g.
x
,y
orzoom
).velocity
number | undefined Velocity at which the parameter changes. Use a negative number for opposite direction.
friction
number | undefined Friction at which the parameter stops.
-
PointerType
-
Types of pointers in an interaction.
MOUSE: 'mouse' // Using the mouse. TOUCH: 'touch' // Using fingers in a touch surface.
Type:
- string
- Source:
- bu/enums.js
-
QtvrOptions
-
Options for a
bu.interaction.Qtvr
.Type:
- Object
- Source:
- bu/typedefs.js
Properties:
Name Type Description element
Element | undefined The DOM element where the events are listened to.
active
boolean | undefined If the interaction must be set to active or not.
speed
number | undefined Speed.
friction
number | undefined Friction.
maxFrictionTime
number | undefined Max friction time.
-
ScrollZoomOptions
-
Options for a
bu.interaction.ScrollZoom
.Type:
- Object
- Source:
- bu/typedefs.js
Properties:
Name Type Description element
Element | undefined The DOM element where the events are listened to.
active
boolean | undefined If the interaction must be set to active or not.
maxFrictionTime
number | undefined Max friction time.
zoomDelta
number | undefined Zoom delta.