更新日志

GoJS 2.1

新的动画系统

GoJS 2.1 contains a number of new features to animate different components of your Diagram.

See the Intro page on Animation and the Custom Animation extension for more details and examples.

数据同步功能增强

GoJS 2.1 contains some new methods to ease integration of GoJS diagrams in applications that maintain their own data, particularly React apps.

See the Intro page on using GoJS with React and the gojs-react example project for details and examples. Also see gojs-react, a package containing React Components for GoJS Diagrams, Palettes, and Overviews.

Changes for 2.1.3

  • Fixed a regression (that started in 2.0.0) with AvoidsNodes links improperly re-routing when using the DraggingTool.
  • Fixed a undo (redo) bug with AnimationTriggers that used location or position on Parts.
  • Improved routing of duplicate links that have Link.adjusting set to a value other than None and have more than the standard number of points in their route.

Changes for 2.1.2

Changes for 2.1.1

  • Fixed updating of Adornments when there are Bindings from Model.modelData and that shared object has been modified by calling Model.set.
  • Improved performance when replacing Diagram.model when cleaning up the old model, which had infrequently resulted in obscure warnings in debug mode about Node.isTreeLeaf.
  • Fixes for loading Models with serialized EnumValues.
  • Performance improvements for concurrent animations.
  • Fixes for consistency of animation state. This includes modifying when AnimationStarting and InitialAnimationStarting are called, and fixes when default animations are stopped and another is immediately started, such as when loading a new model in the middle of animation.
  • Fixed Model.fromJson loading models with serialized EnumValues.
  • Improved showing non-default cursors when dragging between diagrams.
  • Fixed the operation of Diagram.handlesDragDropForTopLevelParts when dragging on the elements of a Group.
  • Fixed a bug where Diagram.scrollHorizontalLineChange and Diagram.scrollVerticalLineChange would not affect scrolling size in some browsers.
  • Fixed a bug where some AvoidsNodes Links would not route properly in nested groups.

2.1.0 的其他更新


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

  • Shapes with a shadow and a Shape.fill value of "transparent" now apply the shadow to the Shape.stroke, instead of the invisible Shape.fill.
  • Minor scrollbar fixes.
  • Fixed "PanelExpanderButton" click event handler to set InputEvent.handled to true, so that other click event handlers in containing panels will not run.
  • Improved the Map constructor and Map.addAll method to accept an instance of Map.

Changes for 2.0.17

  • Fixed a bug with scrollbars when setting invisible/hidden Diagram DIVs to visible/unhidden while modifying their size.
  • Improved orthogonal link segment overlap avoidance in LayeredDigraphLayout.
  • Optimizations for Puppeteer.

Changes for 2.0.16

Changes for 2.0.15

  • Link JumpOver fixes.
  • Fixed an animation bug where some Model loading events might not respect the value of AnimationManager.isInitial.
  • Fixed a bug with AnimationManager.isInitial, where subsequent animations may not occur when it is false.
  • Fixed a bug with Picture drawing when the Picture is scaled to be drawn smaller than a pixel. During expanding animations, it is possible that such a small scale is applied to a Picture.

Changes for 2.0.14

Changes for 2.0.13

  • When dragging over a different Diagram than the source, such as in a drag from a Palette, the DraggingTool now checks the Diagram's cursor and only changes it to "copy" if the Diagram.currentCursor value is "" or "auto".
  • Drawing fix for some objects disappearing when rotated, and the Diagram is scaled.
  • Optimized Group.move not to try moving member parts when the offset is zero. This improves the stability of layouts that move groups, such as PoolLayout in some samples.
  • This bugfix potentially breaks old elementFinished code in Shape geometries with multiple figures. Fix for Diagram.makeSVG elementFinished optional argument: Shapes with multiple geometry figures would pass the final SVG <path> generated as the SVG element, when they should be grouped together and pass an SVG <g> instead. This is what TextBlock already does when there is more than one line of text.

Changes for 2.0.12

  • Fixed a memory leak with internal Picture caching when modifying Panel item arrays.
  • Fixed animation when expanding and collapsing during Diagram load.
  • Fixed drawing in IE when drawing shapes with zero width or height geometries that have a stroke.
  • The DraggingTool will no longer auto scroll the diagram if Diagram.isReadOnly is true or both Diagram.allowMove and Diagram.allowCopy are false. This means that, by default, a Palette will no longer auto scroll while the DraggingTool is active.
  • Improved positioning of unrotated link labels when GraphObject.segmentOffset is go.Point(NaN, NaN) and the link segment is more vertical than horizontal.

Changes for 2.0.11

Changes for 2.0.10

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

Changes for 2.0.5

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

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.

1.x 更新日志详见 这里