Enhancement #7593

Better scaling of diagrams rendered into SVG

Added by Reino Ruusu 3 months ago. Updated about 1 month ago.

Status:ClosedStart date:2017-11-02
Priority:4Due date:2017-11-02
Assignee:Tuukka Lehtonen% Done:

100%

Category:DiagramSpent time:-
Target version:2017-27
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
Story points-
Velocity based estimate-
ReleaseSimantics 1.31.0Release relationshipAuto

Description

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.

before.png (6.23 KB) Reino Ruusu, 2017-11-03 02:40 pm

after.png (29.9 KB) Reino Ruusu, 2017-11-03 02:40 pm

zoomed.png (28.4 KB) Reino Ruusu, 2017-11-03 02:42 pm

Associated revisions

Revision 181b3b45
Added by Reino Ruusu about 1 month ago

Improved scaling of diagrams rendered into selectable SVG. (refs #7593)

Merge of change 1184.

Change-Id: I27ad59665d0be021a1fcd8d68e6d4eca0edc3fda

History

#1 Updated by Reino Ruusu 3 months ago

Additional problems include clipping of selection boxes at the left and top parts of the diagram.

#2 Updated by Reino Ruusu 3 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.

Solution

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.

#3 Updated by Reino Ruusu 2 months ago

Sulca diagram without scaling:

Unscaled Sulca diagram zoomed in in browser:

Properly scaled Sulca diagram:

#4 Updated by Tuukka Lehtonen 2 months ago

  • Subject changed from Better scaling of digarams redered into SVG to Better scaling of diagrams rendered into SVG

#5 Updated by Tuukka Lehtonen 2 months ago

  • Target version changed from 2017-26 to 2017-27

#6 Updated by Tuukka Lehtonen about 1 month ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

I believe this is fixed now that Reino's commit is merged.

#7 Updated by Tuukka Lehtonen about 1 month ago

  • Tags set to 1.31.0, diagram, svn
  • Release set to 56

#8 Updated by Tuukka Lehtonen about 1 month ago

  • Release notes set to Changed diagram SVG rendering to use a global configurable scaling term to better adapt to dynamically scaled graphics.

#9 Updated by Tuukka Lehtonen about 1 month ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF