|| | |||Browse by category|
How to prevent a graphic object from getting bigger or smaller when the view is zoomed in or zoomed out?
zoomable() method so that it returns
false is not sufficient, as this method has no influence on the way the graphic object is drawn. It is only a flag that indicates to the
IlvGrapher whether the object can be managed in an optimized mode when using a quadtree. If the method returns
true, the object can be efficiently retrieved from the internally managed quadtree data structure.
To obtain a graphic object that does not grow or shrink when zooming in or zooming out, you have two options:
- Encapsulate it in an
IlvFixedSizeGraphicis a wrapper class that will keep your IlvGraphic with a constant size, whatever the zoom factor, whereas the
IlvHalfZoomingGraphicis a wrapper class used to prevent a graphic object from zooming above or below a given maximum or minimum zoom level.
- If you can modify the code of the object's class, override the
draw()method in such a way that the desired behavior is obtained.
boundingBox(IlvTransformer) method must be coded in a way that is consistent with the
draw() method. The graphic object should never be drawn outside the rectangle returned by the
boundingBox(IlvTransformer) method, and this for any value of the transformer. If the rectangle returned by
boundingBox(t) is outside the rectangle obtained by applying the transformer to the
boundingBox in manager coordinates (
boundingBox(null)), you should be sure that the
zoomable() method of your object returns