-
Notifications
You must be signed in to change notification settings - Fork 42
VTS Browser UI API
David Levinsky edited this page Apr 17, 2017
·
1 revision
This module provides methods for user interface.
Method | Returns | Description |
---|---|---|
getControl(<String> id) | Control | Get UI control. The map browser has these built in controls: "compass", "scale", "zoom", "layers" |
addControl(<String> id, <String> html, <Bool> visible) | Control | Creates a new UI control. Content of the control is defined by an HTML string. |
removeControl(<String> id) | null | Removes a UI control. |
getMapElement() | Element | Returns the element used for displaying the map. This element is usable for listening for events (mouse, touch, ...). |
Method | Returns | Description |
---|---|---|
setVisible(<Bool> state) | Control | Set UI control visibility state. |
getVisible() | Bool | Get UI control visibility state. |
setHtml(<String> id, <String> html) | Control | Sets HTML content of the UI control. |
getElement(<String> id) | Element | Get UI control element by HTML element id. |
Method | Returns | Description |
---|---|---|
setStyle(<String> key, <String> value) | Element | Sets element style. |
getStyle(<String> key) | String | Returns element style. |
setClass(<String> name) | Element | Sets element class. |
getClass() | String | Returns element class. |
hasClass(<String> name) | Bool | Returns whether element has class. |
addClass(<String> name) | Element | Adds a class to element classes. |
removeClass(<String> name) | Element | Removes a class from element classes. |
on(<String> eventName, <Function> callback) | Element | Adds an event listener to the element. The event names are the same as DOM event names. Callback is called with Event object as a parameter. Additional event names "drag", "dragstart", "dragend" can be used when dragging events are enabled by setDraggableState. |
once(<String> eventName, <Function> callback) | Element | Adds an event listener to the element. This event listener is automatically removed when the callback occurs. |
off(<String> eventName, <Function> callbak) | Element | Removes an event listener from the element. |
fire(<String> eventName, <Object> data) | Element | Calls an event listener with custom event data. |
setDraggableState(<Bool> state) | Element | Sets whether dragging events are enabled. Dragging events are: "drag", "dragstart", "dragend". |
getDraggableState() | Bool | Returns whether dragging events are enabled. |
getDraggingState() | DraggingState | Returns the state of dragging. |
Method | Returns | Description |
---|---|---|
getMouseButton() | String | Returns the name of mouse button used. Possible values are: "left", "right", "middle". This event method is supported for the following events: "mousedown", "mouseup". |
getMouseCoords() | Array | Returns coordinates of the mouse cursor [X,Y]. This event method is supported for the following events: "mousedown", "mouseup", "mousemove", "dragstart", "dragend", "drag". |
getDragDelta() | Array | Returns drag delta [DX,DY]. This event method is supported for the "drag" event. |
getDragButton(<String> button) | Bool | Returns whether the mouse button is pressed. Possible button names are: "left", "right", "middle". This event method is supported for the following events: "dragstart", "dragend", "drag". |
getWheelDelta() | Number | Returns wheel delta. This event method is supported for the "mousewheel" event. |
getTouchesCount() | Number | Returns the number of interacting touches. This event method is supported for the following events: "touchstart", "touchend", "touchmove". |
getTouchCoords(<Number> index) | Array | Returns the coordinates of the touch point [X,Y]. This event method is supported for the following events: "touchstart", "touchend", "touchmove". |