The low-level engine offers a Matrix
-based stream of updates, as long as it is fed
with touch events and knows the dimensions of your content.
There is no strict limit over what you can do with a Matrix
,
Canvas
objects aroundView
hierarchiesImageView
s or Bitmap
MotionEvent
sIf you are interested in using the engine directly, I encourage you to take a look at the ZoomLayout
or ZoomImageView
implementations. It is extremely simple. Basically:
ZoomEngine
passing the View
that acts as a container for your contentsetContentSize(float, float)
onInterceptTouchEvent
or onTouchEvent
ZoomEngine.Listener
subscribed will be passed Matrix
updatesAPI | Description |
---|---|
setContentSize(float, float) |
Sets the size of the content, whatever it is. |
onTouchEvent(MotionEvent) |
Should be called to feed the engine with new events. |
onInterceptTouchEvent(MotionEvent) |
Should be called to feed the engine with new events. |
setContainerSize(float, float) |
Updates the container size. This is generally not needed. The engine will get the container dimensions using a OnGlobalLayout listener. However, in some cases, you might want to trigger this directly. |
The size methods will also accept a boolean indicating whether the engine should re-apply the transformation. The transformation is always applied if the engine is in its starting state.