3.0.0 beta 1
Pre-release
Pre-release
.NET 6!
A lot of things changed in this version, a lot of breaking changes were introduced but I believe it was necessary.
Many changes were required to make everything clearer, customizable and cleaner (code wise).
I'm aiming to completely decouple the Core library from the UI, because I'm thinking of giving MAUI Diagrams a try very soon!
https://www.nuget.org/packages/Z.Blazor.Diagrams.Core/3.0.0-beta.1
https://www.nuget.org/packages/Z.Blazor.Diagrams/3.0.0-beta.1
Added
BlazorDiagram
class (inheritsDiagram
) to the blazor package to replace the old Core oneBlazorDiagramOptions
that inherit from the other diagram options to add Blazor (UI) specific optionsBlazor.Diagrams.Models.SvgNodeModel
class to represent a node that needs to be rendered in the SVG layerGetBehavior<T>
method toDiagram
in order to retrieve a registered behaviorKeyboardShortcutsBehavior
class which handles keyboard shortcuts/actions:SetShortcut
: sets an action (Func<Diagrambase, ValueTask>
) to be executed whenever the specified combination is pressedRemoveShortcut
: removes a defined action (if it exists)
KeyboardShortcutsDefaults
containing the default shortcuts that were deleted (DeleteSelection
andGrouping
)- Anchors functionality:
- An Anchor determines where on an element the link will connect
- Instead of links requiring the source and target to be either both nodes or both ports, there is now only one
Source
andTarget
of typeAnchor
- This lets the link not worry about the details of from/to where its going, as long as the anchor provides it with its position when asked for
- Current implementations:
SinglePortAnchor
: Specifies that the connection point is a specific port (supports shape & alignment)ShapeIntersectionAnchor
: Specifies that the connection point is the intersection of a line with the node's shapeDynamicAnchor
: Specifies that the connection point is one of the given positions (closest)
- Virtual
IShape GetShape()
method on nodes (defaultRectangle
) and ports (defaultCircle
) Options.LinksLayerOrder
to indicate the order of the links layer (svg for blazor)Options.NodesLayerOrder
to indicate the order of the nodes layer (html for blazor)- Support for SVG groups that also represent children as a hierarchy (
SvgGroupModel
) - Node renderer will now append, in addition to
node locked
, the classesselected grouped
IHasBounds
andIHasShape
interfaces to both nodes and portsIPositionProvider
to encapsulate how certain positions are calculated given a model- They are used for dynamic anchors and controls for now
BoundsBasedPositionProvider
returns the position based on the bounds of the model (e.g. (0.5, 0.5) would be the center)ShapeAnglePositionProvider
returns the position as the point at the angle of the shapeLinkPathPositionProvider
returns the position based on the link's path (getPointAtLength
)
- Links have a reference to
Diagram
now PointerEnter
andPointerLeave
events for nodes and links for nowGeneratedPathResult
andPaths
toBaseLinkModel
to always have access to the actual pathsControls
feature (beta):- They are things that can show up on top of nodes/links and can even be clicked to be executed
- Their UI is also picked up from the registered components
Control
designates a control that has a position and will be rendered if visibleExecutableControl
designates a control that has a position and will be executed when pressed (PointerDown event)- Default controls for now are:
BoundaryControl
shows the model's boundaryRemoveControl
shows a button that when clicked, removes the model from the diagramDragNewLink
shows a button that when clicked, starts a new link dragging from that node
GridWidget
a background grid that moves with the diagram instead of being fixed like in the Snap to grid example- More unit tests
Changed
- Core package changes:
- Web dependency was removed from the Core package
Diagram
is now abstract- These changes were done to decouple the core from the rendering, in the future we might have a MAUI renderer
- Web dependency was removed from the Core package
Diagram.GetComponentForModel
now accepts acheckSubclasses
argument (defaulttrue
)- Constraints now must return a
ValueTask<bool>
instead of a simplebool
- Renamed
AllLinks
toPortLinks
for more clarity on which links, sinceLinks
contains the others - Dragging links from ports will now follow the mouse at the same pace minus 5 pixels so that it doesn't go on top of the link it self or other ports
- How groups are rendered
GroupRenderer
will take care of rendering the group with the appropriate style and classes- Only
GroupNodes
is required,GroupLinks
was deleted because all links are shown in the svg layer (with appropriate order)
Diagram.AddGroup
will now return the added group- All
Mouse
events have been converted toPointer
events PathGenerator
now returnSvgPath
instead of just stringsNavigatorWidget
was rewritten to be faster, lighter, WORKING and customizable- It now can also take the shape of the nodes into account (rect and ellipse for now)
Fixed
- Virtualization throwing a JSException (#155)
- Ports not rendering correctly because of the missing
@key
(#220) - Link not refreshing when a new vertex is created, which was showing out of link
Removed
DefaultNodeComponent
andDefaultLinkComponent
options (seeGetComponentForModel
changes)RenderLayer
from the Core package and all its usageDeleteSelectionBehavior
since there is a new keyboard shortcuts systemGroupingBehavior
since there is a new keyboard shortcuts systemBaseLinkModelExtensions
since it was Obselete- Unnecessary port refreshes when dragging a link ends or when link snapping
ShapeDefiner
delegate and constructor arguments on nodes since delegates can't be serializedTouchX
events