Touch zoom event.
[event] touchZoom([in] int status, [in] int winX, [in] int winY, [in] int distance)
This event is fired when the user performs a touch zoom, i.e., a two-finger "pinch" gesture.

The status argument is:

The winX, winY arguments are the coordinates of one of the touch points, in window coordinates.

The distance argument is the distance between the two touch points.

This event is only called if enableTouchZoom is set to true.

IMPORTANT: Setting enableTouchZoom to true only enables the events; it does not perform any zooming. The touchZoom event must be implemented to handle zooming.

The purpose is to allow the application code to update the user interface (e.g., a "current zoom" display), limit the minimum/maximum zoom level, etc. The standard approach is to zoom based on the ratio of the current distance to the previous distance. See the sample code below.

Private touchZoomPrevDist As Long ... viewer.enableTouchZoom = True ... Private Sub viewer_touchZoom(status As Long, winX As Long, winY As Long, distance As Long) _ Handles viewer.touchZoom ' on the first touchZoom event (status = 0), just save the distance ' for use in subsequent events If status <> 0 Then ' compute the new zoom level z = (viewer.zoomPercent * distance) / touchZoomPrevDist ' don't go below 10% or above 800% If z < 10 Then z = 10 ElseIf z > 800 Then z = 800 End If ' set the new zoom level viewer.zoomCentered(z) End If ' save the distance - this will be used in the next touchZoom event touchZoomPrevDist = distance End Sub