Releases: Blazor-Diagrams/Blazor.Diagrams
3.0.2
What's Changed
- Update ReflectionUtils.cs by @robertmclaws in #401
- upgrade to net8.0 by @SebastianWachsmuth in #395
- Version 3.0.2 by @zHaytam in #418
New Contributors
- @robertmclaws made their first contribution in #401
- @SebastianWachsmuth made their first contribution in #395
Full Changelog: 3.0.1...3.0.2
3.0.1
Added
Route
property toBaseLinkModel
to hold the result of the executed router
Fixed
- Constraints not checked when using
RemoveControl
(thanks to @K0369) - NRE Exception on the landing page demo when dragging a new link and not linking it to something (thanks to @K0369)
LinkVertexWidgetTests
failing on cultures that are not using a dot as decimal separator (thanks to @K0369)- NRE exception in the Diagram Demo project (thanks to @Suraj0500)
3.0.0
Finally, the new documentation website is here!
Please don't hesitate to create issues for any problems or improvements.
PS: I suck at design.
Added
AddLabel
method to links to easily createLinkLabelModel
AddVertex
method to links to easily createLinkVertexModel
ControlledSize
property to nodes. Iftrue
, the node will not be registered in theResizeObserver
(saves a JS call).autoSize
argument toSvgGroupModel
constructor
Changed
- Renamed
Point.Substract
toSubtract
(duh) - Avoid rendering link selection helper on dragged link
Fixed
SmoothPathGenerator
not working withLinkAnchor
- Mouse overlapping dragged link
- Useless Console Logs from
GroupModel
are now removed - JS exception in
(un)oberve
methods when the element doesn't exist anymore
Check out the other beta version for a complete CHANGELOG !
3.0.0 beta 7
Fix a dumb issue by me regarding ordering
3.0.0 beta 6
All NuGet packages have been updated.
Added
Style
parameter toPortRenderer
TargetAttached
to links, which triggers when a dragged link attaches to a target- If port snapping is enabled, it will trigger only once when you let go of the mouse
SuspendSorting
toDiagram
in order to suspend sorting models in eachOrderChanged
- If you know what you're doing, you could save some processing and avoid sorting everytime
RefreshOrders
to be called after unsuspending sorting in order to sort the models again and refresh the diagram
Changed
BaseLayer.Add
now returns the specific type given to it in argument- [BREAKING] CSS classes are now prefixed with
diagram-
to avoid clashes with other librariesdiagram-group
,diagram-node
,diagram-link
,diagram-port
,diagram-link-label
,diagram-link-vertex
,diagram-control
Fixed
- Portless links in children not refreshing when moving the parent group
- Link's
GetBounds
not returning a valid box - Port snapping choosing the first port in radius rather than the closest one
- Remove
Console.WriteLine
fromKeyboardShortcutsBehavior
- Diagram overwriting
Order
when it's not zero (zero being the default int value, which we now consider as not set)
3.0.0 beta 5
Added
AdditionalSvg
option toDiagramCanvas
in order to render any extra SVG content you wantAdditionalHtml
option toDiagramCanvas
in order to render any extra HTML content you wantDistanceTo
overload method toPoint
that takes x and yMoveAlongLine
method toPoint
FullPath
toPathGeneratorResult
to represent the full path without cuts- Fallback router to Orthogonal router
- Margin options to
OrthogonalRouter
radius
option toStraightPathGenerator
in order to generate rounded bends- Support for custom vertices
AutoSize
option to groups to control whether moving children resizes the group
Changed
- All routers are now classes instead of functions, they inherit from the new abstract class
Router
- All path generators are now classes instead of functions, they inherit from the new abstract class
PathGenerator
- Optimize Orthogonal router by using custom A* (x5 improvement)
Removed
Router
delegatePathGenerator
delegate
3.0.0 beta 4
Added
- Initial version of Ordering!
- Nodes, groups and links can now be ordered using the new
Order
property orSendToFront/Back
methods Diagram.OrderedSelectables
returns the ordered selectables/modelsDiagramCanvas
now uses this new property to render everything
- Nodes, groups and links can now be ordered using the new
GridSnapToCenter
option in order to snap nodes from their center instead of their top/left position (thanks to @Jeremy Vance)- More unit tests
Changed
Groups
is not a list of groups anymore, but a layer instead (just likeNodes
andLinks
)
Fixed
- Deleting a group doesn't delete links attached to it
- Deleting a group inside of a group doesn't refresh the parent group
- Links not refreshing when a group's dimensions are updated directly (e.g. deleting a child)
- Layers causing more refreshes than intended
Removed
- All group-related methods and events from
Diagram
, please use the new layer from now on
3.0.0-beta.3
Added
- Support for
LinkFactory
to return null in order to not create an ongoing link - Support for free links (no source/target required)
PositionAnchor
which reprensents a simple plain position (mutable)ArrowHeadControl
to control a link's Source/Target on the flyattached
css class to attached links
Changed
- Replace
OngoingPosition
with the newPositionAnchor
BaseLinkModel.Target
will never be null anymore. An ongoing link will have a position anchor as the target
Links.Factory
signature now takes the diagram, source (model) and the target anchor- Move
DynamicAnchor
back toAnchors
namespace and seal allAnchor
classes
Fixed
- Links attached to links not refreshing when the others are
LinkPathPositionProvider
not working with maxlength ratios- Deleting a link not deleting the links attached to it
Removed
PositionProvider
argument fromExecutableControl
for more freedomId
andRefresh
fromILinkable
- Unused
Offset
fromAnchor
and makeModel
nullable
3.0.0 beta 2
Added
Moved
event to MovablesVisible
property andVisbilityChanged
event to modelsOptions.Virtualization
(of type[Diagram]VirtualizationOptions
) for virtualization optionsPointerEnter/Leave
events for groups as well- Experimental Link to Link (using
LinkAnchor
)
Changed
- Rename
RegisterModelComponent
toRegisterComponent
- Rename
GetComponentForModel
toGetComponent
- Virtualization is now handled by a behavior instead of NodeRender
- This means that it works for almost all models (nodes, groups and links)
- Render link labels without foreignObject in widget nor MarkupString (Thank you .NET 6)
- Custom link labels only need to contain relevant content, they don't need to handle positioning anymore
Removed
EnableVirtualization
option (see added alternative)
3.0.0 beta 1
.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