Package com.nomagic.magicdraw.ui.zoom
Class ZoomHelper
java.lang.Object
com.nomagic.magicdraw.ui.zoom.ZoomHelper
Helper functions to display zoomed GUI components
-
Method Summary
Modifier and TypeMethodDescriptionstatic intgetOriginalSize(int scaledSize, float zoomFactor) Opposite method togetScaledSize(int, float).static FontgetScaledFont(Font font, float zoomFactor) Takes the provided font and scales it's size by the given zoomFactor.static IcongetScaledIcon(Icon icon, float zoomFactor) Takes the provided icon and scales it's size by the given zoomFactor.static intgetScaledSize(int size, float zoomFactor) Takes the provided integer and scales (multiplies) it by the given zoomFactor.static booleanzoomComponent(Component component, float zoomFactor) If component implementsZoomableinterface, zooms the component by the given factor.static booleanzoomComponents(Container container, float zoomFactor) Iterates through inner components recursively and zooms all components that implementZoomableinterface.
-
Method Details
-
getScaledSize
@OpenApi public static int getScaledSize(int size, float zoomFactor) Takes the provided integer and scales (multiplies) it by the given zoomFactor. Trims the floating part of the result down.- Returns:
- scaled size
-
getOriginalSize
@OpenApi public static int getOriginalSize(int scaledSize, float zoomFactor) Opposite method togetScaledSize(int, float). Takes the provided scaledSize, which is already scaled by the given zoomFactor and returns the original not scaled size, by dividing the scaledSize from zoomFactor.- Returns:
- not scaled size
-
getScaledFont
Takes the provided font and scales it's size by the given zoomFactor.- Returns:
- scaled font
-
getScaledIcon
Takes the provided icon and scales it's size by the given zoomFactor. Icon caching is used to prevent repeated scaling of the same icon and zoomFactor.- Returns:
- scaled icon
-
zoomComponent
If component implementsZoomableinterface, zooms the component by the given factor. If component does not implement Zoomable, but it is a Container, then looks for Zoomable inner components recursively and zooms each of them.- Returns:
- true if component or at least one of it's sub components was zoomed
- See Also:
-
zoomComponents
Iterates through inner components recursively and zooms all components that implementZoomableinterface.- Returns:
- true if at least one of Container's inner components is Zoomable
-