Search
What's New in this Release

The list below describes recent changes and additions to JsDiagram:

New in version 4.5.1

Node constraints

The constraints property lets you apply size and direction constraints to a node. It returns a NodeConstraints object with following properties:

  • keepRatio: a bool value indicating whether the initial width/height ratio of a node should be preserved.
  • maxHeight: the maximum node height allowed.
  • maxWidth: the maximum node width allowed.
  • minHeight: the minimum node height allowed.
  • minWidth: the minimum node width allowed.
  • moveDirection: a member of the DirectionConstraint enumeration. Set it to Horizontal or Vertical to let users move a node only in specified direction.

These constraints are considered when a user modifies the node interactively. They are ignored if node placement is changed programmatically by using API methods and properties.

Miscellaneous

  • TabbedDiagramView now keeps separate zoom level and scroll position per tab.
  • shapeLibraryLoaded event raised when library XML file is loaded and its shape definitions are available for use.
  • fixed undo / redo of text in-place edit operations.
  • fix for item hover events of DiagramDocument not raised by TabbedDiagramView.

New in version 4.5

Shape design enhancements

New event system

Event emitter objects are now exposed as properties of Diagram and DiagramView, and you can register handlers by calling their addEventListener method:

JavaScript  Copy Code
diagram.nodeCreated.addEventListener(
    (sender, args) =>
    {
        if (sender.defaultShape.id == "Rectangle")
            args.node.anchorPattern = pattern1;
        else
            args.node.anchorPattern = pattern2;
    });

Legacy event handling syntax will remain supported for compatibility with old code.

Collapse and expand table rows

Table rows can be assigned to distinct sections of the table. Each section can be collapsed or expanded, hiding or showing all rows in the section except the header one. To define a section, set the header property of a row. A section consists of all rows after a header row and spans to the next header. Each header row displays a [±] button that allows expanding or collapsing the section interactively. Clicking that button raises the tableSectionCollapsed and tableSectionExpanded events. Sections can be collapsed or expanded programmatically by setting the expanded property of their header rows.

Miscellaneous

  • dividerStroke properties added to ContainerNode, TableNode and TreeViewNode classes. It lets you customize the appearance of the divider line drawn between a node's caption bar and content area.
  • removed an eval call used for creating custom components from CompositeNode Json templates, allowing for stricter Content Security Policy rules. Now custom components must be registered by calling registerComponent method to allow instantiating them from a template.
  • linkRouted event raised when links are modified by automatic routing.

API changes

To allow for stricter Content Security Policy rules, the library no longer loads CSS scripts automatically. If you use components from the Diagramming.Controls package, you must now explicitly link the common-ui.css file from distribution's themes folder.