# GoJS Change Log

We maintain a GitHub Repository, which you can star to follow version updates. We also notify of changes on Twitter.

## GoJS 2.3

### New SVG Rendering Context

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 export 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.

Read more about the SVG Rendering Context here

### New Layered Digraph Layout Options for Better Performance

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.

### General New Features in GoJS 2.3

- 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 `F` or `F1`), eg `"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 GraphObject,takeBuilderArgument, if used.
- Point,intersectingLineSegments now tests for collapsed lines.
- The PDF samples in `projects/pdf` now use SVG for rendering diagrams, instead of raster images. This improves the quality of the pages and uses much less memory for large diagrams.

#### Changes for 2.3.1

- Fixed Diagram.makeSVG when a background option is specified.
- Fixed successive calls to Diagram.makeSVG creating potentially blank SVG.

## GoJS 2.2

GoJS 2.2 introduces a number of properties and methods for convenience and to improve customization. GoJS 2.2 also includes new methods for constructing objects, and enhances TypeScript typings support.

GoJS 2.2 also includes several performance enhancements when drawing large graphs, reduced memory usage, and more efficient replacing or merging of item Arrays.

Some of the samples and written documentation have been upgraded to use more modern JavaScript: `class`es, arrow functions, `const` and `let`, so the samples and documentation might no longer be viewable using old browsers such as Internet Explorer 11 or some old Android browsers. The library and the extensions continue to target ES5 (ES2012), so that apps using the library can still work on IE11.

### Method Chaining and New Ways to Build Objects

In GoJS 2.2 many methods that previously returned `void` now return the method's instance, to promote method chaining. GoJS 2.2 also introduces several new methods or arguments to allow type-checking of settings by compilers and in text editors.

Several existing methods now return their instance:

- GraphObject.setProperties and Diagram.setProperties - and their new synonyms GraphObject.attach and Diagram.attach
- Panel.add
- GraphObject.bind, which also has new functionality via method overloads.
- GraphObject.trigger - to add AnimationTriggers to a GraphObject
- Diagram.addEventListener, Diagram.addChangedListener, Diagram.addModelChangedListener, Model.addChangedListener
- Diagram.addLayer, Diagram.addLayerBefore, Diagram.addLayerAfter
- Animation.add, and Animation.addTemporaryPart

GraphObject constructors now accept one or two optional arguments. The first is the value for a common property, and the second is a JavaScript Object detailing properties to initialize. For example, one can now write:

- `new go.TextBlock("Some Text", { margin: 5 })`
- `new go.Picture("sourceURI.png", { width: 30, height: 30 })`
- `new go.Shape("RoundedRectangle", { fill: "blue", stroke: "yellow" })`
- `new go.Panel("Auto", { padding: 10, background: "green" })`

This means that one can now write code like:

    // Create a Node and add a Shape and a TextBlock to it:
    myDiagram.nodeTemplate =
      new go.Node("Vertical")
        .add(new go.Shape({ width: 40, height: 40, fill: "white" })  // default width & height & fill
              .bind("width") // binds data.width to Shape.width
              .bind("height")
              .bind("fill", "color") // binds data.color to Shape.fill
              .bind("figure", "fig")) // data.fig should be the registered name of a geometry figure generator
        .add(new go.TextBlock("(no name)",  // default string to display
                              { isMultiline: false, editable: true })
              .bind("text", "name", null, null));  // TwoWay Binding of TextBlock.text with data.name without converters

New methods GraphObject.set and Diagram.set return their instance. When using TypeScript definitions, the compiler checks these calls for GraphObject and Diagram property existence and value types.

New method GraphObject.apply can be used to define common functions that provide settings and bindings. Such customizations can then be applied to a GraphObject that you are initializing by calling GraphObject.apply with that function.

Together, these changes remove the need to use GraphObject,make when concisely defining Diagrams and templates. For a complete example, this code:

    const $ = go.GraphObject.make;

    const myDiagram = $(go.Diagram, "myDiagramDiv",
      {
        "undoManager.isEnabled": true
      });

    myDiagram.nodeTemplate =
      $(go.Node, "Auto",
        $(go.Shape, "RoundedRectangle",
          { strokeWidth: 0, fill: "white" },
          new go.Binding("fill", "color")),
        $(go.TextBlock,
          { margin: 8, font: "bold 14px sans-serif", stroke: '#333' },
          new go.Binding("text", "key"))
      );

Can now be written as:

    const myDiagram = new go.Diagram("myDiagramDiv",
      {
        "undoManager.isEnabled": true
      });

    myDiagram.nodeTemplate =
      new go.Node("Auto")
        .add(new go.Shape("RoundedRectangle", { strokeWidth: 0, fill: "white" })
              .bind("fill", "color"))
        .add(new go.TextBlock({ margin: 8, font: "bold 14px sans-serif", stroke: '#333' })
              .bind("text", "key"));

For more information and examples, see the intro page on Building Objects.

### General New Features in GoJS 2.2

- Spot Panels now support Panel.alignmentFocusName on the main element. This can be useful for creating Spot panels with multiple item arrays that align to the same main element. There is an example of this property in the Spot Panel section of the Panel intro page.
- The Diagram.autoScrollInterval property controls the milliseconds between autoscroll events.
- The Diagram.delayInitialization's argument function is now a passed a reference to the Diagram.
- The Overview.drawsGrid and Overview.updateDelay properties control drawing by an Overview.
- The CommandHandler.isZoomToFitRestoreEnabled property controls whether the CommandHandler.zoomToFit command ever restores the previous Diagram scale and position.
- The DraggingTool.copyCursor, DraggingTool.moveCursor, and DraggingTool.nodropCursor properties modify the cursors during a drag.
- The LinkingBaseTool.linkingCursor property modifies the cursor during linking.
- The GraphObject.findBindingPanel method walks up the visual tree to return the first Panel whose Panel.data is bound to data. Used in the Hyperlink sample.
- The Panel.copyTemplate method makes a deep copy of a Panel, including its Bindings, to allow use of the result in templates. This is used in LinkLabels In Front sample.
- The TextBlock.formatting property controls the policy of trimming whitespace on TextBlock text. This can be useful when text strings are preformatted.
- The TextBlock.lineHeight read-only property provides better information about how the text is being measured and rendered.
- The TextBlock.spacingAbove and TextBlock.spacingBelow properties better control the measuring and rendering in addition to the TextBlock.lineHeight.
- The Node.findExternalTreeLinksConnected method returns a collection of Links that connect with this Node or any in its subtree, excluding any isTreeLink Links. This is the tree-equivalent of Group.findExternalLinksConnected for Groups/subgraphs.
- The Node.findVisibleNode method walks up the chain of Node.containingGroups to find the first node that is visible. This can be overridden to change behavior, as it is in Tree Mapper sample.
- The PanelLayout.remeasureObject method forces a specific GraphObject (but none of its containing panels) to remeasure. This can be useful implementing custom layouts.
- The DraggingTool now optimizes transactions to reduce memory usage by only saving the first and last drag changes. This can be changed by overriding DraggingTool.stopTransaction.
- The Binding constructor now accepts a back-converter as an argument. A null or function argument value as the fourth argument will automatically call Binding.makeTwoWay> for you. Not supplying the fourth argument or passing it undefined will leave the Binding OneWay, as it has in the past.
- The RadialLayout extension by default spreads the children better.
- The TextEditingTool now stops any default animation when the tool is activated.
- The TextEditingTool now respects the vertical alignment when a TextBlock is taller than its text.
- InputEvent.bubbles allows events to bubble beyond the Diagram div. This can be useful in CommandHandler and Tool method overrides.
- For some testing environments: Diagram,isUsingDOM and Diagram,useDOM can query and control the GoJS library's expectation of a DOM existing.
- Fixed a regression from 2.1.29 where some links may update their geometries outside of a transaction.
- Potentially incompatible: Touch and Mouse events have been replaced internally with Pointer events. The GoJS API has not changed, nor has its behavior, as long as the browser is not so old that it does not implement pointer events.

### Easier Manipulation and Customization of Geometries

GoJS 2.2 contains new methods to simplify geometric calculations and more easily customize geometries.

- Point,intersectingLineSegments is a static function that returns true if two finite straight line segments intersect each other.
- Rect,intersectsLineSegment is a static function that returns true if a rectangular area is intersected by a finite straight line segment.
- Point,compareWithLineSegment is a static function that compares a point with a finite straight line segment, given x,y numbers. Point.compareWithLineSegmentPoint is a method that performs the same comparison, but on Points.
- Geometry.containsPoint is a method that returns true if the Geometry contains a given point.
- The Link.routeBounds read-only property returns the bounds of the Link geometry in document coordinates. Used in the BalloonLink sample.
- The Node.getAvoidableRect method returns the area to be avoided for this node, by default equal to the node's GraphObject.actualBounds plus the Node.avoidableMargin. This method can be overridden to customize AvoidsNodes routing behavior near a node to account for the visual area occupied by the node being smaller than the full rectangular bounds of the node.
- Groups now implement Panel.isClipping. If set to true on a Group and if the group has a Group.placeholder, the group will visually clip its member nodes and links. This does not change how those parts are measured, nor does it affect how those parts may be positioned.
- The Layer.isInDocumentBounds property allows finer control of which layers are part of the Diagram.documentBounds. Before 2.2, only layers with Layer.isTemporary set to true were excluded from the document bounds (and could not be explicitly included).
- The ResizingTool.oppositePoint property returns the Point opposite to the chosen, dragged handle of the "Resizing" Adornment. This allows customizations like the LimitedGroupResizingTool sample, which demonstrates a custom tool to allow resizing groups while disallowing the group to resize smaller than its members, and also disallowing the group to expand to cover any non-member nodes.
- The `RoundedRectangles` extension code now includes definitions for the "RoundedLeftRectangle" and "RoundedRightRectangle" figures. The definitions for all four "Rounded...Rectangle" figures has been modified slightly to better match the curves of a full "RoundedRectangle".

#### Changes for 2.2.23

- 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.

#### Changes for 2.2.22

- Disallow browser wheel events on the Diagram canvas from bubbling if the wheel has a horizontal component. This bubble prevention also prevents the browser in some systems from committing page "back" and "forward" actions.
- Fixed a bug where resetting Picture.source to the empty string may cause a property set error.

#### Changes for 2.2.21

- Improved Link.makeGeometry so that overrides do not need to test for situations where a Link has fewer than two points.
- Improved shadows when Diagram and Part are scaled.

#### Changes for 2.2.20

- Improved LinkingTool.doActivate to assign the location of the LinkingBaseTool.temporaryToNode (or the LinkingBaseTool.temporaryFromNode, if drawing a link in the reverse direction) so as to avoid momentarily seeing where the temporary node had been the last time the user tried to draw a new link.
- Corrected functionality when a browser cancels a Pointer event (for instance when the browser is minimized during ongoing Pointer events).
- Corrected GraphObject.mouseLeave sometimes not getting called when the user's pointer leaves the Diagram.
- Fixed iOS Safari text highlighting when dragging Pointer events out of a Diagram.
- Fixed a regression from 2.2.18 where link JumpOvers might cause "Change not within a transaction" warnings on model load.

#### Changes for 2.2.19

- Event fix for some platforms that reimplement DOM functionality (Polymer and Salesforce Aura components).
- Graduated panels no longer display shadows on Shape and TextBlock elements when those elements explicitly disable shadows with GraphObject.shadowVisible.

#### Changes for 2.2.18

- Fix for some initialization animations which could set Part.location incorrectly.
- Fixed operation of the LinkShiftingTool extension when the mouse is inside the connected node.
- The TypeScript extensions are now compiled with options `"noImplicitOverride": true, "noUnusedLocals": true`.
- Fix since 2.2.0: Link bounds now always contain all JumpOvers.
- Fix since 2.2.0: When a Diagram.autoScale is applied, dragging Parts outside of the viewport now reliably triggers a redraw.

#### Changes for 2.2.17

- Internal performance optimizations.
- LinkLabelDraggingTool extension now supports labels with GraphObject.segmentIndex of NaN.
- Static Brush functions will no longer trigger Chrome's warning about `willReadOnly`.

#### Changes for 2.2.16

- Fixed a regression from 2.2.13 that caused chained animations (calls to an Animation.start inside annother Animation's Animation.finished) to fail.
- Fixed Picture.successFunction/Picture.errorFunction not firing when a Part with a Picture is copied, and that Picture's Picture.source is not data-bound.
- Fixed a regression from 2.1.50 where setting a Picture.source binding and a default value would fail to use the default value, if there was no data to bind.

#### Changes for 2.2.15

- Fixed non-Path Geometry copies not to have a null value for Geometry.figures.
- Improved the calculation of the midpoint of Bezier curve Links that have exactly three points in their route.
- Fixed some empty Table panels causing an exception.
- Loading the GoJS library twice is now a console warning, instead of an error.

#### Changes for 2.2.14

- Diagram Layouts with Layout.isRealtime set to `true` will no longer attempt real-time layouts during the DraggingTool operation.
- Graduated Panels now deal with highly precise floating point numbers more accurately.

#### Changes for 2.2.13

- Fixed asynchronous model loading which might intermittently fail to perform AvoidsNodes routing.
- Enhanced the ArrangingLayout extension to support placing the side nodes about the middle of the side, by supporting values such as `go.Spot.Bottom` for the ArrangingLayout.side property.
- Improved the "HyperlinkText" builder extension so that it works by default in Adornments and other Parts that are in temporary layers, by setting GraphObject.isActionable to true.
- Table panel separator strokes no longer draw if a row or column is empty of visual elements, and will not draw a separator above the first-rendered row/col.

#### Changes for 2.2.12

- We have been optimizing the space used by GraphObjects. The heap used by typical large diagrams now occupies about 10% less space. Creating copies of a lot of nodes and links may be a bit faster now too.
- Fixed the new PanelLayoutFlow extension so that multiple "Flow" panels can coexist in the same panel.
- Improved GenogramLayout in the Genogram sample to support a horizontal direction as well as the standard vertical direction.
- Improved the Selectable Fields and Selectable Ports samples so that clicking on fields or ports within a node respects the Control and Shift modifiers to toggle or add to the collection of selected fields or ports.
- Fixed object picking (Diagram.findObject, GraphObject.containsPoint, etc) for Shapes with a GraphObject.background.
- The Group.layout property setter now checks to make sure that the new layout is not also the value of Diagram.layout.

#### Changes for 2.2.11

- Like the DraggingTool in v2.2.0, LinkReshapingTool, ResizingTool, and RotatingTool now optimize transactions to reduce memory usage by only saving the first and last changes for each property of each object in the transaction. This can be changed by overriding stopTransaction on the respective tool.
- Shape.graduatedSkip, TextBlock.graduatedSkip, and TextBlock.graduatedFunction now take a second argument, the Shape or TextBlock that the function is being called for.
- Graduated Panels now correctly draw ticks/labels at very large Panel.graduatedMax values.
- The AMD `define` statement has been removed from the module version of the library (`go-module.js`, `go.mjs`, `go-debug-module.js`)
- The DraggingTool, when dragging a Link (DraggingTool.draggedLink), now passes that link as the RelinkingTool.originalLink so that link validation predicates are passed that link.
- Disconnected links now support setting Part.locationSpot.

#### Changes for 2.2.10

- Graduated panels now draw all tick marks specifying a Shape.graduatedSkip/TextBlock.graduatedSkip function, even when they could be very close together.
- Fixed drawing on very zoomed-out graphs.
- Multiple orthogonal links between identical nodes side-by-side are now drawn without crossings. This fixes a regression from 2.1.51.

#### Changes for 2.2.9

- Fixed a regression from 2.2.8 with Table Panel when tables are empty (including tables in Node templates).

#### Changes for 2.2.8

- Improved Table Panel measuring when using TableRows and TableColumns in sparsely populated tables.
- Improved Table Panel arranging of items that span several rows or columns, when those rows or columns do not all exist.
- Animation fixes when AnimationTriggers execute during a drag.
- Improved accuracy of tick angles along curves in Graduated panels.
- Fix for two-way bindings on Part.location when undoing.
- Calls to Diagram.makeImage and Diagram.makeImageData no longer throw exceptions when attempting to render "broken" images.

#### Changes for 2.2.7

- Nested or space-constrained Table Panels apportion space more correctly when some Table elements are stretched and other rows/columns have their width or height set.
- Improved the ScrollingTable extension to include a scrollbar "thumb".

#### Changes for 2.2.6

- Made improvements in gesture handling for iPad + keyboard combinations.
- Made improvements and added features to the Gantt and Donut Charts samples.
- Drag and drop from a Diagram into empty page space no longer throws an error (regression in 2.2.4).
- Data Inspector, when `multipleSelection` option is true, now clears the properties fields when the Diagram.selection is empty.

#### Changes for 2.2.5

- Drag and drop across Diagrams fixed on touch devices (regression in 2.2.4 for non Shadow DOM environments).
- Module versions of the library `release/go.mjs` and `release/go-module.js` now export `go` as the default export.

#### Changes for 2.2.4

- Allow AnimationTriggers to run during Tool operation. Previously, Animation Triggers would not run if a Tool was active, which prevented some tools such as LinkingTool from starting animations during their events.
- Fixed a regression since 2.2.0: Drag and drop in Shadow DOM environments such as Angular now correctly identify the target Diagram (for dropping from Palettes, for instance).
- Diagram,useDOM and Diagram,isUsingDOM were incorrectly minified, and now have their names properly exposed.

#### Changes for 2.2.3

- Fixed Spot Panels erroneously giving incorrect sizing information to its elements if a previous element had a stretch.
- Improved LayeredDigraphLayout routing of Bezier curve links to reduce crossing over nodes.
- Fixed optimization (in 2.0.0) of Panel.rebuildItemElements when item template(s) may have changed.
- The `package.json` now specifies `"module": "release/go-module.js"`

#### Changes for 2.2.2

- Added `init` optional argument to Brush constructor.
- Stopped tap-hold on some versions of iOS Safari from selecting text.
- Improvements for licensing Electron apps.

#### Changes for 2.2.1

- Added rounded corners to the BalloonLink extension, controlled by the new property BalloonLink.corner. Improved BalloonLink's implementation of BalloonLink.base.
- Fixed licensing issues when using Windows high contrast mode, due to changes in Chrome and Edge.
- Added `init` optional argument to Layer and Animation constructors. Animation.start and Animation.stop now return `this`.

#### Changes for 2.1 are here.

#### Changes for 2.0 are here.

#### Changes for 1.* are here.

GoJS