Each manager view (class
IlvManagerView) has its own
transformer to define the area of the manager that the
view is displaying and also to define the zoom level and rotation
applied to objects.
You may retrieve the current transformer of a view using
the following method:
IlvTransformer getTransformer()
To modify the transformer associated with a view, use
the following methods:
void setTransformer(IlvTransformer t)
void addTransformer(IlvTransformer t)
void translate(float deltax, float deltay, boolean redraw)
void zoom(IlvPoint, double, double, boolean)
void fitTransformerToContent()
void ensureVisible(IlvPoint p)
void ensureVisible(IlvRect rect)
To avoid distorting the image when it is zoomed in or
out, you can specify that the vertical and horizontal aspect ratio
remain the same by using the following methods:
boolean isKeepingAspectRatio()
void setKeepingAspectRatio(boolean set)
When the KeepingAspectRatio
property
is on, the view ensures that the horizontal and vertical scaling are
always the same, whatever transformer you set in the view.
Example: Zooming a view
The following code zooms a view in by a scale factor
of 2:
managerView.zoom(point, 2.0, 2.0, true);
The point
given as an argument
keeps its position after the zoom. The last parameter forces the redrawing
of the view.
Transformer listeners
When the transformer of a view changes, the view calls
the transformerChanged
method of all listeners.
void transformerChanged(TransformerChangedEvent event)
This method is called with an instance of the class
TransformerChangedEvent as
a parameter. The
event
parameter can be
used to retrieve the old and the new value of the transformer.