UI5 Development: Events
Tags:
Visualization Object Events
Click/Tap Event
To get the click/tap event from a VO in the the "Action" array ("Action": [...]) we add the following JSON:
"Actions": {
"Set": {
"Action": [
{
"id": "1",
"name": "MY_CLICK_ON_SPOT",
"refScene": "YourScene_ID",
"refVO": "YourVO_ID",
"refEvent": "Click"
}
]
}
}
Remarks
You can choose a semantic name for the event. With the other parameters you specify the VO and the scene containing it, that should fire the Click event.
The id of the subscribed action (here "1") must be unique.
Additional parameters
The following fragment as a property of an Action object ("Action": [...]) gives the zoomlevel , centerpoint and geographical position where the action was triggered as additonal parameters of the event.
"AddActionProperty": [
{
"name": "zoom"
},
{
"name": "centerpoint"
},
{
"name": "pos"
}
]
Context Menu Request Event
The following json fragment will raise a context menu requerst event if the user right clicks with a mouse or taps longer on the VO.
"Actions": {
"Set": {
"Action": [
{
"id": "1",
"name": "CONTEXT_MENU_REQUEST",
"refScene": "YourScene_ID",
"refVO": "YourVO_ID",
"refEvent": "ContextMenu"
}
]
}
}
See here how to react on this event: UI5 Development: Raising a Context Menu
Additional parameters
The following fragment as a property of an Action object ("Action": [...]) gives the zoomlevel, centerpoint and geographical position where the action was triggered as additonal parameters of the event.
"AddActionProperty": [
{
"name": "zoom"
},
{
"name": "centerpoint"
},
{
"name": "pos"
},
{
"name": "pitch"
},
{
"name": "yaw"
}
]
Map & Navigation Events
The application can get map or navigation specific events
Zoom Event
A zoom event will be fired if the user zooms in or out. Additional paramteres are the centerpoint in geo coordinates and the pos in geocoordinates where the zoom action was triggered.
"Actions": {
"Set": {
"Action": [
{
"id": "3",
"name": "ZOOM_EVENT",
"refScene": "Scene1",
"refVO": "Map",
"refEvent": "ZoomChanged",
"AddActionProperty": [
{
"name": "zoom"
},
{
"name": "centerpoint"
},
{
"name": "pos"
}
]
}
]
}
}
Centerpoint Changed Event
A centerpoint event will be fired if the user navigates the map.
Additional paramteres are the zoom level and the pos in geocoordinates where the zoom action was triggered.
"Actions": {
"Set": {
"Action": [
{
"id": "3",
"name": "ZOOM_EVENT",
"refScene": "Scene1",
"refVO": "Map",
"refEvent": "CenterpointChanged",
"AddActionProperty": [
{
"name": "zoom"
},
{
"name": "centerpoint"
},
{
"name": "pos"
}
]
}
]
}
}