GoJS typically renders the Diagram to an HTML Canvas, and offers exporting the Diagram scene to image formats and SVG. In GoJS 2.3, the library now supports rendering to a live SVG context in addition to the default Canvas context. Visually there should be no changes, and performance will be faster when using the default Canvas context, but the SVG context may be useful for applications where DOM accessibility is paramount, either because users need to select and copy text, or because screen readers need access to all text in the application.
The new SVG rendering context comes with significant changes and upgrades to the GoJS SVG structure, including exporting SVG. For example, an object with a
clip-path would formerly point to a
<clippath> via URL, and now clipping paths are defined in-line. These changes make some
elementFinished code in Diagram.makeSVG potentially incompatible.
Version 2.3 adds LayeredDigraphLayout.alignOption as a potentially faster alternative to LayeredDigraphLayout.packOption. When using this option, nodes are assigned coordinates within their layers to produce straighter paths of nodes and small edge lengths.
- Added PathFigure.isEvenOdd - PathFigures now support the “even-odd” fill rule. This can be set with the new property PathFigure.isEvenOdd or when making SVG-like Path syntax, with the fill rule
F0(instead of the default
"F0 M 0 0 L 50 50 ...".
- Added Size.inflate.
- Bugfixes for shadow drawing in TableRows and TableColumns, and when Shapes have a background set.
- Bugfixes for Table Panel separators when the Panel is scaled.
- Arguments passed to Diagram.scroll have been made consistent. Scrolling
'left'150 pixels will scroll left, but scrolling
'left'-150 pixels will scroll right.
- GraphObject.build now takes a third argument, which is passed to the static function GraphObject.takeBuilderArgument, if used.
- Point.intersectingLineSegments now tests for collapsed lines.
- The PDF samples in
projects/pdfnow use SVG for rendering diagrams, instead of raster images. This improves the quality of the pages and uses much less memory for large diagrams.
- Fixed Diagram.makeSVG when a background option is specified.
- Fixed successive calls to Diagram.makeSVG creating potentially blank SVG.
At the same time, we have released GoJS 2.2.23. GoJS 2.3 also contains the following change:
- Line (and therefore Link) intersection fix for some shape geometries containing arcs and beziers, when the start or end of the curve overlaps the adjacent path point.