Triggers¶
These are the available callbacks that the map will trigger and can be subscribed
with subscribe method:
Input triggers¶
click: Will be called whenclickevent is triggered on the map.dblclick: Will be called whendblclickevent is triggered on the map.contextmenu: Will be called whencontextmenuevent is triggered on the map.up: Will be called whenmouseuportouchstartevents are triggered on the map.down: Will be called whenmousedownortouchendevents are triggered on the map.move: Will be called whenmousemoveortouchmoveevents are triggered on the map.hover: Will be called when hovering a node.enter: Will be called when the cursor enters the node.leave: Will be called when the cursor leaves the node.wheel: Will be called whenwheelevent is triggered on the map.keydown: Will be called when a keyboard key is pressed while the viewer is focused.keyup: Will be called when when a keyboard key is released while the viewer is focused.
State triggers¶
select: Will be called when a node is selected (interacting with it or using theselectmethod).unselect: Will be called when a node is unselected (interacting with it or using theunselectmethod).state_change: Will be called when a node change its state.
Camera triggers¶
zooming: Will be called when scaling_factor changes.panning: Will be called when there is map navigation without changing the zoom level.
Load triggers¶
pre_load_start: Triggered just afterloadMaphas been called, before theresettrigger.load_start: Will be called when a map starts the load process, after theresettrigger.load_success: Will be called when a map finishes the load process successfully.load_error: Will be called when a map load process finishes with an error.reset: Will be called when a map is reset. Loading a map or callingreset()implies triggeringreset.
pre_load_start -> reset -> load_start -> (load_success or load_error)
Misc triggers¶
update: Will be called in every frame.first_seen: Will be called when asectionis first seen on the Viewer when the scaling_factor is enough to show itsseats. This callback is useful to feed the availability of the map on demand.layer_level_changed: Will be called when a map change its level.
To standardize and allow the content extension, all these callbacks will receive the following basic Object as first parameter:
action(string): Action ID that triggered the call (from the list above).instance(MapViewer): Map Viewer Instance that triggered the call.nodes(MapViewerNode[]):MapViewerNodearray with the nodes that triggered the call. This array can be empty, for example if aclickis triggered from an empty part of the map, or in case ofzoomingorpanningtrigger, among others. It can also contain multiple nodes, for example clicking on a seat with a section below.original_event(Event) [optional]: Original event (click, mousemove, etc) object triggered (if any).point(Object) [optional]: If the action has been triggered in a specific location this object will have two properties:dom(number[]): Array with the DOM coordinates[x,y]in pixels relatives to the dom element representing the map. The top left corner of the map element n the dom will be coordinate [0,0], and the bottom right corner will be [width,height]. Useful to create popups over the map.scene(number[]): Array with the scene coordinates[x,y]in pixels relatives to the internal coordinate system. All nodes have a fixed position in the scene, independently of the scaling factor or translation of the viewport. Useful to be used with methods that accepts scene coordinates like focusOn, goTo or getNodesAt.
limits(Object) limits object.