Better scaling of diagrams rendered into SVG
|Assignee:||Tuukka Lehtonen||% Done:|
|Release notes:||Changed diagram SVG rendering to use a global configurable scaling term to better adapt to dynamically scaled graphics.|
|Tags:||diagram, 1.31.0, svn|
|Velocity based estimate||-|
|Release||Simantics 1.31.0||Release relationship||Auto|
Current rendering of diagrams into interactive (selectable) SVGs does not take scaling properly into account. This manifests as diagrams rendered by default at very small size, and produces problems especially in Sulca, which uses dynamic scaling of fonts.
#2 Updated by Reino Ruusu 5 months ago
SCLScenegraph.renderSVG0 uses a hand-written global scaling group for managing the scaling of diagrams. This causes a problem with dynamically scaled features that depend on the accuracy of the transformation in the Graphics2D objects.
Content dimensions are fetched using the zoomTo method of NavigationNode, but this zoom is only applied during rendering, which results in the wrong dimensions to be obtained prior to rendering.
Set global scaling to a blobal
org.simantics.modeling.SCLScenegraph.Generator and use it for rendering all object in the diagram.
Scaling is calculated to fit the diagram by default in an imaginary 1000-by-1000 pixel window. Create overloaded methods for setting the actual window size for rendering.
Extra padding is needed for the diagram dimensions to account for the dynamic padding of @SelectionNode@s, in order to avoid clipped selection boxes at the left and top sizes of the rendered image.