function Leadtools.Controls.InteractiveService()
!MISSING Scrap '_RTJavaScript_Class_SYNTAX'!
The InteractiveService object hooks to an HTML element events and can be used to provide uniform tap, drag, hold, double tap, drag and pinch events. This can be done regardless of whether the application is running in a browser that supports mouse or touch events.
ImageViewer contains an instance of InteractiveService internally (accessible through the ImageViewer.InteractiveService property) and use it along with the ImageViewerInteractiveMode classes to perform rich interactive user interface interactions such as zoom, pan, scale, rubber banding and magnify glass.
To use the InteractiveService, call the Create method passing an HTML element that will act as the events element (EventsElement). The events of this element will be subscribed to and converted from raw mouse and touch to the common events mentioned above. Also, the Create method takes another HTML element that will act as the target element ( TargetElement). This element is the target that will be used to check if the event is triggered on its surface. All coordinates will be translated based on its position. In the case of ImageViewer, the main DIV element (ImageViewer.DivId) will act as the events element and the foreground canvas (ImageViewer.CanvasId) will act as the target element. This insures that all events inside the viewer surface will act upon and translated into the canvas (the image) coordinates.
InteractiveService contains the following members:
Members | Description |
---|---|
Owner |
The owner of the service. This is not used by InteractiveService but can be used by the application to pass any class and extra data. ImageViewer passes |
EventsElement |
The events element. |
TargetElement |
The target element. |
UserElements |
Any extra elements that should participate in the events handling. |
HitTestBuffer, PreventContextMenu, TapOnDown, DragStartsOnDown, PinchStartsOnDown, EnableMouseWheel and EnableSelection |
Options used to modify the operations of the service. |
StartListening, StopListening and IsListening |
Subscribe/Unsubscribe to the events |
Tap, DoubleTap, Hold, DragStarted, DragDelta, DragCompleted, PinchStarted, PinchDelta and PinchCompleted |
Uniform events for common user interface interaction regardless of the event source (mouse or touch) |
InteractiveService will subscribe to multiple JavaScript events. It is recommended if you create an instance of this object to call Dispose on it when you are done to free the resources used. ImageViewer will dispose its instance of InteractiveService when ImageViewer.Dispose is called.