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

For 2.0, GoJS has been rewritten in TypeScript, with improvements to stability and documentation. All customers (with or without source code license) can take advantage of the TypeScript definitions `.d.ts` file, which is much more comprehensive in 2.0.

A source license will now include TypeScript source files as well as JavaScript sources, and examples of how to build the library into your project with Webpack or Browserify, should you wish to. This will allow you to remove unused modules from the source code, such as Layouts, Models, and Tools that you are not using. Note that unless you have strong minification, you may not see size improvements over the pre-built `go.js` library, which is highly optimized.

The size of the `go.js` library has been slightly reduced (both uncompressed and gzipped), from 1.8 versions.

The main library has been reduced by removing many of the uncommon figures. These are now an extension. (Figures.js)

GoJS can now be run DOM-less, in Node.

We have added the ability to create your own Panels, with the new PanelLayout class. See an example here.

#### Changes for 2.0.10

- Fixed a bug with simulated InputEvents, such as used by Robot, that caused GraphObject.mouseEnter and GraphObject.mouseLeave event handlers not to be called.
- The Diagram.model setter and Diagram.clear now call Diagram.clearSelection and Diagram.clearHighlighteds.
- Fixed a bug that would prevent some Picture.successFunction from ever firing.
- Fixed a bug with bezier link routing in LayeredDigraphLayout when LayeredDigraphLayout.setsPortSpots was false and an end of the link was undirected.
- Fixed a performance bug with Picture caching, introduced in 2.0.5.

#### Changes for 2.0.9

- Diagram.makeSVG now accepts `callback` and `callbackTimeout` options. This makes it more like Diagram.makeImage and Diagram.makeImageData (which have had these options since 2.0.0). If a callback function is provided, the methods will instead return null and SVG creation will wait until all Diagram Picture sources are loaded before creating the SVG and invoking the callback.
- Fixed a regression with Diagram.makeSVG where it would not draw Pictures that were not yet loaded, even if they had a valid size.
- Fixed GridLayouts when used as a Group.layout and when GridLayout.alignment is `go.GridLayout.Position`, to treat GridLayout.wrappingWidth as a width limit, regardless of the Layout.arrangementOrigin. If you were forced to set GridLayout.wrappingColumn to a value just to be free of the treatment of the default value for GridLayout.wrappingColumn (`NaN`) to indicate the width of the viewport, it is now possible to set GridLayout.wrappingWidth to respect a smaller value.
- Fixed maintaining the selection state of selected Parts that change their category.
- GoJS will step down the Canvas resolution during drawing operations like dragging and panning, which can lead to "fuzzy" shapes and text during these operations. This is now only done when a slower frame rate is detected.
- Drawing performance improvements, especially in well-connected graphs.
- Fixed a bug with trackpad scrolling reversing at the end of scroll events.
- Fixed a bug drawing grids on some Overviews.

#### Changes for 2.0.8

- Fixed a regression with Pictures from 2.0.4 that would throw an error when setting Picture.source.
- Fixed potential errors in Binding.ofObject bindings when changing category/template because the bindings were being evaluated on the copied new template rather than on the original Part.

#### Changes for 2.0.7

- Floorplanner 2.0 - New Floorplanner project (see it here), written in TypeScript, at `projects/floorplannerTS`. New features include:
  - Wall mitering, with updated dimension links and angle nodes to account for this
  - The ability to define rooms, complete with name, floor type, area, and draggable labels
  - Textures - apply seamless textures to furniture or floors, by use of GoJS Pattern Brushes
  - Full integration with the GoCloudStorage library (save to Local Storage / Google Drive / Dropbox / OneDrive)
  - Export to PNG
  - Export to SVG
  - Ability to define unit scale in Options menu
- New intro page on Replacing Diagrams and Models
- Fixed a bug with Link Shape Geometries not rendering when updated partially off-screen.
- Fixed a bug with InputEvent.clickCount: Before, on touch devices, this count was incremented only on the end of the touch, and not the start. This was discrepant from mouse click behavior, and would lead to problems when Tools queried the clickCount on touch/mouseDown, when determining for instance if a particular InputEvent was a double-click. Now, the InputEvent.clickCount is reported consistently on mouseDown/touchStart/pointerDown and the corresponding "up" events.
- GoJS previously would set the Canvas Context's imageSmoothingEnabled property to false. It no longer does this. If this change causes visual errors, please contact us.

#### Changes for 2.0.6

- Fixed a bug with the `go.d.ts` file where GraphObject.alignment was missing.
- Added missing cloneProtected overrides for BalloonLink and DimensioningLink so data is properly copied.

#### Changes for 2.0.5

- Fix for Shape,defineFigureGenerator where it would incorrectly throw an error on Geometry bounds being too large, when they were not.
- Some touch events would cause [intervention] warnings in some browsers when canceled because GoJS would call `preventDefault` on non-cancelable events. This has been fixed.
- Fixed a bug with Diagram.zoomToFit when Diagram.scrollMode was set to Diagram,InfiniteScroll.
- Fixed a bug where GuidedDraggingTool was snapping the whole part to a guideline instead of the location object.

#### Changes for 2.0.4

- Fixed the TypeScript declaration of GraphObject,make to allow an `HTMLDivElement` as an argument when building a Diagram. Also added some type overloads of that function to reduce apparent type errors with correct code.
- Fixed some apparent non-determinism in the results of LayeredDigraphLayout upon an initial layout.
- Animation upgrades, notably when you move a port during an animation, connected Links will properly re-route.

#### Changes for 2.0.3

- Improved data binding of tooltips and context menus for item panels to avoid temporarily setting Panel.data incorrectly.
- Enhanced the meaning of UndoManager.maxHistoryLength so that a value of zero causes no Transactions to be remembered in the UndoManager.history but allows commits and rollbacks to occur normally.
- Fixed a bug from 2.0.1 with Diagram.makeSVG incorrectly re-using SVG elements.
- Fixed a bug from 2.0.0 with Diagram.makeSVG when drawing dashed paths.
- Deployment fixes for electron apps.

#### Changes for 2.0.2

- Updated the Charts in Nodes sample to use Chart.js.
- Deployment fixes. This release should resolve "Cannot use 'in' operator to search for 'go' in undefined" errors in some browser contexts.

#### Changes for 2.0.1

- TypeScript declarations: we have created the ObjectData interface, defined as `{ [index: string]: any; }`, to allow easier manipulation of data Objects, mostly in Models and change notification. Many methods and properties now use `ObjectData` instead of `Object` in the `go.d.ts` file. The compiled JavaScript is unchanged by these better type declarations.
- We have added interface declarations for the "options" argument to Diagram.makeImage, Diagram.makeImageData, and Diagram.makeSvg. Also we have added more precise declarations replacing the `string` type for arguments to Diagram.addDiagramListener, Diagram.removeDiagramListener, Diagram.scroll, and for the properties Shape.strokeCap, Shape.strokeJoin, and TextBlock.textAlign. JavaScript calls to these methods are unchanged by these better type declarations.
- We have improved the declarations for GraphObject,make. You may find that you will need to cast the result of calling this function or pass a result type when the first argument is a string. For example: `$(go.Node, . . ., { contextMenu: $<go.Adornment>("ContextMenu", . . .) }, . . .`. Also, you may find that event handlers need to have precise type declarations for the arguments. For example: `$(go.Node, . . ., { click: function(e: go.InputEvent, node: go.GraphObject) { . . .} }, . . .`. JavaScript calls to this function are unchanged by the better type declarations for GraphObject,make.
- The HTML Divs created for the default context menu now have CSS class names: 'goCXforeground' and 'goCXbackground'. The HTML textarea for the TextEditingTool now has the CSS class name: 'goTXarea'.
- When supplied with an argument, CommandHandler.expandTree, CommandHandler.collapseTree, CommandHandler.expandSubGraph, and CommandHandler.collapseSubGraph incorrectly operated on the Diagram.selection if the argument Part was already in an expanded/collapsed state. This has been fixed not to do so.
- Performance improvements with JumpOver/JumpGap Links.
- Fixed a bug with inappropriate invalidation of link routes when a Group was moved.
- Fixes for SVG rendering of Pattern brushes.

#### Changes for 2.0

- Build GoJS from TypeScript Source:

  GoJS can be compiled from the TypeScript source files. Dynamically building GoJS this way allows unused modules/code to be removed. See the new Intro page on Building GoJS from TypeScript sources

- GoJS now runs in DOM-less environments like Node:

  GoJS can run in DOM-less environments, like Node, without any dependencies. See the new Introduction page on GoJS with Node.js.

  GoJS cannot guarantee accurate Picture and TextBlock measuring in DOM-less environments, so if you do not set `desiredSize` (or `width` and `height`) on TextBlocks or Pictures, you may want to use GoJS inside of a headless browser project, like Chrome's Puppeteer. We detail how to use GoJS with Puppeteer in the Server Side Images Introduction page.

  DOM-less environments can be used for server-side work, such as computing complex layouts. Headless environments such as Puppeteer can be used to do layout calculations or to make server-side images of Diagrams.

  See the note about Diagram.viewSize below.

- Reworked part-moving and added a new class: DraggingOptions:

  DraggingOptions holds properties for Part-moving operations, and DraggingInfo holds relative positions of dragged objects, for use in snapping and cancellation. The DraggingTool has an instance of the DraggingOptions class, and setting properties like DraggingTool.isGridSnapEnabled modifies this instance. If the Diagram has no DraggingTool associated with it, it falls back to the default properties of the class. You can create your own to pass to part-moving methods. Typically you do not need to create an instance of this class.

  Moving parts has been reworked. Diagram.moveParts, Diagram.computeMove, and CommandHandler.computeEffectiveCollection now accept an additional argument for a DraggingOptions instance. This allows fine-grained control over programmatic moving of nodes. Typically, these options are supplied by the DraggingTool.dragOptions instance.

  DraggingTool.computeMove functionality has been moved to Diagram.computeMove, and DraggingTool.computeEffectiveCollection functionality has been moved to CommandHandler.computeEffectiveCollection. These methods remain on their original class for compatibility when overriding, but the main functionality has been moved to the Diagram class for tree-shaking reasons.

- Diagram and Layer:
  - Added Diagram.mouseEnter and Diagram.mouseLeave to allow for functions to be called on mouseenter and mouseleave events on the Diagram's Canvas element.
  - When mouse leaves a Diagram, Diagram.lastInput is now set to the "mouseout" MouseEvent.
  - Added `"GainedFocus"` and `"LostFocus"` DiagramEvents, which allow functions to be called when the Diagram's canvas gains or loses focus, without having to access any of the DOM within the Diagram.div.
  - Added Diagram.findPartsAt, Diagram.findPartsIn and Diagram.findPartsNear as convenience functions. These functions call Diagram.findObjectsAt, Diagram.findObjectsIn or Diagram.findObjectsNear and only return Parts in non-temporary layers, rather than all GraphObjects.
  - Added Diagram.viewSize which can be used to set a viewport size in DOM-less environments. See the new Intro page on GoJS with Node.js.
  - Added Diagram.handlesDragDropForTopLevelParts which determines whether drag-and-drop events may be bubbled up to the diagram if not handled by a Part.
  - Diagram.moveParts, Diagram.copyParts, and Diagram.computePartsBounds now accept an Array of parts, in addition to their former iterable collection of Parts.
  - Diagram.makeImage and Diagram.makeImageData now accept `callback` and `callbackTimeout` options. If a callback function is provided, the methods will instead return null and image creation will wait until all Diagram Picture sources are loaded before creating the image and invoking the callback.
- Models:
  - Added property Model.copiesKey which controls whether Model.copyNodeData and GraphLinksModel.copyLinkData copy any key property of the data. Setting this to false is useful in forcing copies from a Palette to get a new unique key. The default value is true for compatibility with version 1.*.
  - Improved Model.updateTargetBindings and Part.updateTargetBindings to update Panels that have Panel.itemArray data bound if the contents of the Array have changed. In version 1, the reference to the Array had to have changed -- the Panel.itemArray had to have been replaced. In version 2, the Panel.itemArray property setter checks to see if all of the Array items have corresponding Panels and that all child Panels correspond to Array items (i.e. Panel.data refers to the Array item), even if the new property value is a reference to the same Array that it had been before.
- Parts:
  - Added Part.rotationSpot to control the Spot within the Part.rotateObject that the RotatingTool will pivot about.
  - Part.move and Part.moveTo now have an additional optional boolean argument to specify moving by location instead of position.
- Panels and PanelLayout:
  - Spot Panels now allow child elements to stretch, which will match the size of the main element. See the Intro Page for an example.
  - It is now possible to create your own Panel layouts with the PanelLayout class. This is expected to be very uncommon, but may serve uncommon use cases. See the PanelLayout sample for an example. There is a new static function, Panel,definePanelLayout for this purpose.
  - When building from source, it is also possible to exclude many Panel types that you are not using, to make the resulting JS smaller. See the Intro page on building GoJS sources for details.
- GraphObjects and Geometry:
  - GraphObject.cloneProtected is now documented. It functions in a similar fashion to Model.cloneProtected and Layout.cloneProtected, and is necessary for properly copying additional properties on custom subclasses of GraphObject.
  - Added properties Picture.flip and TextBlock.flip, which default to GraphObject,None, can be set to GraphObject,FlipHorizontal, GraphObject,FlipVertical, or GraphObject,FlipBoth to flip a Picture's or TextBlock's rendering.
  - Added properties Shape.graduatedSkip and TextBlock.graduatedSkip, which allow ticks/labels along a Graduated panel to be skipped, causing gaps. These properties take a function, and default to null meaning no ticks/labels will be skipped.
  - Added predefined builders for "ToolTip" and "ContextMenu" for ease of template creation. The definitions for these builders can be found in Buttons.js
  - Added TextBlock,WrapBreakAll as a value for TextBlock.wrap, which allows text to break at individual characters.
  - Added TextBlock,getBaseline, TextBlock,setBaseline, TextBlock,getUnderline, TextBlock,setUnderline, which give more control over the height to that lines of text and underlines are drawn.
  - Added GraphObject.getDocumentBounds, as a convenient way to avoid having to call GraphObject.getDocumentPoint on all four corner points of a rectangular area.
- Layouts:
  - Documented CircularNetwork, ForceDirectedNetwork, LayeredDigraphNetwork, and TreeNetwork. These are the subclasses of LayoutNetwork for their respectively-named Layouts.
  - Added Layout.getLayoutBounds method and Layout.boundsComputation functional property, to support easier customization for how large the layout treats each node. This is convenient when your nodes have decorations or text that you do not want to consider during the layout, even if those objects might overlap other nodes.
  - Documented Layout.initialOrigin method, to be called by overrides of Layout.doLayout when used as a Group.layout that may want to account for the original location of the group when the group has a Group.placeholder.
- Tools and Commands:
  - CommandHandler.scrollToPart has been extended to automatically expand any subtrees and subgraphs in order to make visible each Part that it scrolls to.
  - Added ClickCreatingTool.isGridSnapEnabled, which works like DraggingTool.isGridSnapEnabled and ResizingTool.isGridSnapEnabled.
  - Added RotatingTool.computeRotationPoint to control the point about which the object rotates. Added RotatingTool.rotationPoint to remember the result of RotatingTool.computeRotationPoint. Added RotatingTool.handleAngle and RotatingTool.handleDistance to determine where the rotation handle is placed relative to the rotation point in the Part.rotateObject. A custom RotatingTool is no longer needed to position the rotation handle above the object.
  - Improved LinkingBaseTool.copyPortProperties to better handle rotated ports when setting up a temporary port.
- Brushes:
  - Added Brush,isDark instance and static methods, which determine whether a Brush or CSS color string is "dark", based on luminance. This can be useful in bindings to determine text colors.
  - Added Brush,mix to allow for the mixing of two CSS colors.
- Samples and Extensions:
  - Many samples have been translated into TypeScript, in the `samplesTS` folder in the kit.
  - Added PanelLayout, demonstrating Panel,definePanelLayout.
  - Added extensionsTS/PackedLayout, which demonstrates a custom layout for packing nodes closely into a rectangular or elliptical area. (Source is TS only)
  - Added Wordcloud, which demonstrates a wordcloud using a PackedLayout.
  - Added samplesTS/minimalModule, which demonstrates using GoJS as an ES6 module. (Source is TS only)
  - Added OverviewResizing, which demonstrates the OverviewResizingTool, used for resizing an Overview.box. This has replaced functionality that used to be built-in. It is defined in both the "extension" and "extensionsTS" folders.
  - Added extensionsTS/ZoomSlider, which demonstrates an HTML slider that can zoom in/out of a GoJS diagram.

#### Incompatible 2.0 changes and removals

Many of the minor changes were made to order to increase the modularity of the implementation. Nevertheless we have tried to maintain API compatibility with version 1.*.

- Most Predefined Shape figures

  In order to shrink the size of the GoJS library we no longer define most predefined figures in the library. Instead, you can find all of their definitions in the Figures.js file. You can load this file or simply load only those figures that you want to use by copying their definitions into your code. For example, the Shapes sample loads this file.

  A number of very common figures remain predefined in version 2.0. The figures that remain in 2.0 are: "Rectangle", "Square", "RoundedRectangle", "Border", "Ellipse", "Circle", "TriangleRight", "TriangleDown", "TriangleLeft", "TriangleUp", "Triangle", "Diamond", "LineH", "LineV", "BarH", "BarV", "MinusLine", "PlusLine", "XLine".

  Note also that the definitions that are in the Figures.js file are not entirely the same as their definitions in version 1.*. A number of figures have been improved and some figure parameters have been added or changed meaning. To use the old predefined figures, you can load or copy from the "extensions/Figures.js" file of an earlier version of GoJS.

  The static function Shape,defineFigureGenerator now has additional checks for geometric validity. To be valid, the generated Geometry bounds must be equal to or less than the supplied width and height.

- List, Set, and Map constructors no longer take type arguments, but are generic in TypeScript

  The GoJS `List`, `Set`, and `Map` constructors no longer take type arguments and no longer do type checking in JavaScript. However, when using TypeScript these classes are now generic and will do type checking at compile time.

  In JavaScript, instead of `new go.List(go.Point)`, write `new go.List()`. For compatibility, you can still provide an element type argument, but it is not used and not checked.

  In TypeScript, instead of `new go.List(go.Point)`, write `new go.List<go.Point>()`, and the TypeScript compiler will enforce the List element typing.

  All three constructors now take an optional Iterable or `Array` argument that provides the initial elements for the new collection.

  In a future major version, we may replace `go.Map` and `go.Set` with enhanced ES6 `Map` and `Set` classes.

- List.add, Set.add, and Map.add now all return the collection itself instead of a boolean. This is for increased compatibility with ES6 `Map` and `Set` collections.
- Panel.type used to be of type EnumValue and now is of type PanelLayout.

  This may affect data-bindings, in the uncommon case where a template binds Panel.type. You should make sure that any data bindings are returning possible type values such as `go.Panel.Horizontal`. Data binding Panel.type without using a conversion function will not work with old data, since the property has changed type.

- For Spot Panels, the `offsetX/offsetY` of GraphObject.alignmentFocus has been reversed.

  If you are using the `offsetX/offsetY` values in GraphObject.alignmentFocus, this may cause your panels to be arranged differently. You will need to flip the sign to retain compatibility.

  This change is to rectify a design inconsistency with Spot Panel elements. The `offsetX/offsetY` values now correctly offset the alignment focal point, and not the Spot Panel's element itself.

- CommandHandler.defaultScale has been moved to Diagram.defaultScale As with many of the other properties and methods that have been "moved" to other classes, this is to improve the ability to tree-shake code out of your app.
- DiagramEvent.cancel

  The only use for this property was with the `"SelectionDeleting"` DiagramEvent in order to prevent the user from deleting the selection. Where one might have written this Diagram listener:

      "SelectionDeleting": function(e) {
        if (e.diagram.selection.any(function(p) { return p.data.key.indexOf("e") >= 0; })) {
          e.cancel = true;
        }
      }

  one can write the equivalent functionality with this CommandHandler.canDeleteSelection method override:

      "commandHandler.canDeleteSelection": function() {
        return !this.diagram.selection.any(function(p) { return p.data.key.indexOf("e") >= 0; })
                && go.CommandHandler.prototype.canDeleteSelection.call(this);
      }

  Overriding the method supports the updating/enablement of commands that call CommandHandler.deleteSelection. Furthermore not having a "cancel" property on the DiagramEvent avoids any potential problems that might occur if there are multiple listeners for the `"SelectionDeleting"` event. The `"SelectionDeleting"` DiagramEvent remains useful, but not for controlling whether or not the deletion should happen.
- Button styling

  Updated the styling of buttons. Buttons are now rounded rectangles and have an effect when pressed. Some predefined buttons have increased a small amount in size:

  - TreeExpanderButton: 3 pixels wider and taller
  - SubGraphExpanderButton: 3 pixels wider and taller
  - PanelExpanderButton: 3 pixels wider and 5 pixels taller
  Definitions for buttons can be found in the Buttons.js file.
- Improved computation of Link.midPoint and Link.midAngle to be faster and changed some cases where labels fell on very small segments of a link. Orthogonal bezier links will also have more accurate label placement with the new methods.
- Diagram.initialContentAlignment's default value of Spot,Default now acts like Spot,Center, instead of Spot,None. Basically, if you don't set Diagram.initialContentAlignment, the contents will now show up in the middle of the viewport rather than at the top-left corner.
- Custom TextEditingTools (the values of TextEditingTool.currentTextEditor and TextBlock.textEditor) can no longer be set to HTML Elements. They must be an instance of HTMLInfo, which was introduced in version 1.7.
- The ResizingTool, when computing a cell size ResizingTool.computeCellSize, no longer checks the DraggingTool's possible grid snapping cell size. As with many of the other properties and methods that have been "moved" to other classes, this is to improve the ability to tree-shake code out of your app.
- Swapped the order of the RotatingTool and ResizingTool in the ToolManager.mouseDownTools list. This is to cause the RotatingTool's Adornment to be behind the ResizingTool's Adornment if both are present.
- Moved the OverviewResizingTool, which had been completely internal, out of the core library into an extension. The Overview.box can no longer be resized unless OverviewResizingTool has been loaded.
- Removed GraphObject.fromEndSegmentDirection and GraphObject.toEndSegmentDirection. One can override Link.getLinkDirection to achieve the same effects.
- Changed Link.getLinkPoint to treat a GraphObject.fromSpot or GraphObject.toSpot with Spot.x and Spot.y exactly 0.5 (but with any Spot.offsetX and Spot.offsetY) as if it were Spot.None but focussing on that spot. This allows for links to stop at the edge of a shape while going towards a point other than the center of the port. In the past the link direction for spots at (0.5, 0.5) was always assumed to be zero, going rightwards to or from the port, which was not intuitive or useful.
- The DiagramEvent.subject for "SelectionMoved" and "SelectionCopied" DiagramEvents is now a Set of the moved or of the newly copied Parts, not just the Diagram.selection. This makes it easier to find the unselected Parts that were moved or copied.
- The LayoutNetwork constructor and constructors for subclasses of LayoutNetwork now require the Layout as the first argument. This was needed for better code, to avoid potential null references.
- The LayoutVertex and LayoutEdge constructors and constructors for subclasses of LayoutVertex and LayoutEdge now require the LayoutNetwork as the first argument. This was needed for better code, to avoid potential null references.
- Placeholders in Groups now take up zero size when collapsed, even when there is padding in the Placeholder. You can add a GraphObject.margin on the Placeholder or specify its GraphObject.minSize to make sure that has a size when collapsed. Placeholders in Groups now respect GraphObject.minSize.
- Layout.isRealtime is now tri-state, with possible values being true, false, or null. The default is now null. A null value is treated as true for a Diagram.layout but false for a Group.layout. This reduces the number of situations where there can be surprising layout behavior when moving or resizing member nodes, while continuing to support explicit control of this property.
- Diagram.scrollsPageOnFocus has changed its default value from true to false. This avoids an occasional end-user complaint.
- Diagram.allowDrop has changed its default value from false to true. This helps avoid a common error when starting to use a Palette or a second Diagram.
- Overviews now include the observed diagram's viewport bounds so the Overview.box will always be visible. This reduces confusion that some end-users experience.
- Tool.doCancel now sets Tool.transactionResult to null before calling Tool.stopTool, in order to cause any call to Tool.stopTransaction to roll-back any transaction.

#### Changes for 1.8 and previous are here.