GoJS Change Log
We maintain a GitHub Repository, which
you can star to follow version updates. We also notify of changes on
Twitter.
GoJS 3.0
GoJS 3.0 leverages modern JavaScript and more modern Canvas API features for increased performance.
However, this also means dropping support for old browsers such as IE11,
and there are a number of minor incompatibilities detailed below.
Minor Incompatibilities
-
Diagram.inherit has been removed from the API.
The only supported way to define subclasses is to use
class ... extends ... { . . . }
.
However, this is a JavaScript library, so it is still possible to dynamically override an
individual method on an individual object just by assigning it to a function(. . .) { . . . }
.
Note that one cannot use arrow functions unless access to this
is not needed,
as has always been the case.
-
The GoJS Set and Map collection classes no longer warn about potential collection modification
while iterating over the collection.
-
The GoJS Set and Map collection classes used to consider both a string and a number of the
same value (eg "3.14159" and 3.14159) as the same key. They are now considered different keys.
Be sure to always get with the same type of value that you added to the Set or set in the Map.
-
The value of InputEvent.key now exactly reflects the browser
KeyboardEvent.key
value.
If your code does not use the value of InputEvent.key anywhere (such as in a tool customization),
you do not need to do anything.
For some keys, these strings are slightly different. The differences are:
GoJS 2.3 | GoJS 3.0 |
"Esc" | "Escape" |
"Subtract" | "-" |
"Add" | "+" |
"Add" | "=" |
"Up" | "ArrowUp" |
"Down" | "ArrowDown" |
"Right" | "ArrowRight" |
"Left" | "ArrowLeft" |
"Del" | "Delete" |
-
GoJS 3.0 now reports the InputEvent.key faithfully as 'a' or 'A'.
In GoJS 2.3 it uppercased each letter key.
Note that GoJS treats both "+" and "=" (formerly "Add") as default commands to increase zoom.
-
GraphObject.areaBackground, formerly deprecated, has been removed.
Get the old behavior by wrapping a Panel around the GraphObject and setting that Panel's
GraphObject.background instead.
-
Model.copiesKey default value has changed from true to false.
For example, this is useful to prevent nodes copied from a Palette to a Diagram
to keep the same key in the target diagram's model that it had in the palette's model.
To get the old behavior, set
copiesKey: true
on the model.
-
CommandHandler.isZoomToFitRestoreEnabled default value has changed from true to false.
This removes the ability for repeated Shift-Z commands to restore the original diagram scale and position.
But it means that repeated programmatic calls to CommandHandler.zoomToFit will actually zoom-to-fit.
To get the old behavior, set
isZoomToFitRestoreEnabled: true
on the CommandHandler.
-
LayeredDigraphLayout.alignOption now defaults to the value LayeredDigraphAlign.All,
The new align code is usually better and faster than the old pack code, sometimes significantly faster.
To get the old behavior, set
alignOption: go.LayeredDigraphLayout.AlignNone
.
-
Layout.getLayoutBounds now respects each Part's GraphObject.margin, which makes it easier
to pretend that nodes are smaller or bigger than they actually are. To get the old behavior, don't
set Node.margin or set it to zero. TableLayout has been updated to maintain the original
behavior because it has always treated Node.margin differently from all other layouts.
-
Properties that were of type MarginLike but whose getters always returned an instance of Margin
now have the getter return the type Margin and have the setter take the type MarginLike.
New Features
-
LayeredDigraphLayout has improved the routing of links that go "backward" to form a cycle.
-
Added the static function TextBlock.isValidFont to allow dynamically deciding
whether a CSS font string is valid or not.
This is like the existing Brush.isValidColor for checking CSS color strings.
-
The ForceDirectedLayout class has been rewritten. For small to medium-sized graphs (up to around 1000 nodes), these changes
should not be noticeable, however for large graphs node placements should be more accurate. Several properties have been added to
ForceDirectedLayout and are documented in the API.
Enumerations
GoJS now uses Typescript enumerations to represent possible values for many properties.
This introduces one breaking change: when performing a comparison against Panel.type,
one must now use static members of PanelLayout such as PanelLayout.Vertical instead of static Panel members.
Code should be changed from:
myPanel.type === go.Panel.Vertical
to:
myPanel.type === go.PanelLayout.Vertical
Otherwise, this should not have a major impact on existing code.
Static EnumValue members have been deprecated in favor of these new enumerations,
but continue to exist for compatibility.