File tree Expand file tree Collapse file tree 8 files changed +30
-8
lines changed Expand file tree Collapse file tree 8 files changed +30
-8
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
44The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
55and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
66
7+ ## Diagrams [ 1.4.1] - 2020-12-24
8+
9+ ### Added
10+
11+ - ` EnableVirtualization ` option: whether to only render visible nodes or not.
12+ - ` RegisterModelComponent ` overload that takes ` Type ` s as input for dynamic registrations.
13+
714## Diagrams [ 1.4.0] - 2020-12-12
815
916### Added
Original file line number Diff line number Diff line change 2323 <input id =" panningCheckbox" type =" checkbox" class =" custom-control-input" @onchange =" TogglePanning" checked />
2424 <label class =" custom-control-label" for =" panningCheckbox" >Toggle Panning</label >
2525 </div >
26+ <div class =" custom-control custom-checkbox ml-2" >
27+ <input id =" virtualizationCheckbox" type =" checkbox" class =" custom-control-input" @onchange =" ToggleVirtualization" checked />
28+ <label class =" custom-control-label" for =" virtualizationCheckbox" >Toggle Virtualization</label >
29+ </div >
2630</div >
2731
2832<CascadingValue Name =" DiagramManager" Value =" diagramManager" >
Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ protected override void OnInitialized()
2525
2626 protected void TogglePanning ( ) => diagramManager . Options . AllowPanning = ! diagramManager . Options . AllowPanning ;
2727
28+ protected void ToggleVirtualization ( )
29+ => diagramManager . Options . EnableVirtualization = ! diagramManager . Options . EnableVirtualization ;
30+
2831 private NodeModel NewNode ( double x , double y )
2932 {
3033 var node = new NodeModel ( new Point ( x , y ) ) ;
Original file line number Diff line number Diff line change 77 <PackageLicenseExpression >MIT</PackageLicenseExpression >
88 <Authors >zHaytam</Authors >
99 <Description >A fully customizable and extensible all-purpose diagrams library for Blazor</Description >
10- <AssemblyVersion >1.4.0 </AssemblyVersion >
11- <FileVersion >1.4.0 </FileVersion >
10+ <AssemblyVersion >1.4.1 </AssemblyVersion >
11+ <FileVersion >1.4.1 </FileVersion >
1212 <RepositoryUrl >https://github.com/zHaytam/Blazor.Diagrams</RepositoryUrl >
13- <Version >1.4.0 </Version >
13+ <Version >1.4.1 </Version >
1414 <PackageId >Z.Blazor.Diagrams.Core</PackageId >
1515 <PackageTags >blazor diagrams diagramming svg drag</PackageTags >
1616 <Product >Z.Blazor.Diagrams.Core</Product >
Original file line number Diff line number Diff line change @@ -278,12 +278,14 @@ public void UnregisterSubManager<T>() where T : DiagramSubManager
278278 }
279279
280280 public void RegisterModelComponent < M , C > ( ) where M : Model where C : ComponentBase
281+ => RegisterModelComponent ( typeof ( M ) , typeof ( C ) ) ;
282+
283+ public void RegisterModelComponent ( Type modelType , Type componentType )
281284 {
282- var modelType = typeof ( M ) ;
283285 if ( _componentByModelMapping . ContainsKey ( modelType ) )
284286 throw new Exception ( $ "Component already registered for model '{ modelType . Name } '.") ;
285287
286- _componentByModelMapping . Add ( modelType , typeof ( C ) ) ;
288+ _componentByModelMapping . Add ( modelType , componentType ) ;
287289 }
288290
289291 public Type ? GetComponentForModel < M > ( M model ) where M : Model
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ public class DiagramOptions
1818 public bool AllowMultiSelection { get ; set ; } = true ;
1919 [ Description ( "Whether to allow panning or not" ) ]
2020 public bool AllowPanning { get ; set ; } = true ;
21+ [ Description ( "Only render visible nodes" ) ]
22+ public bool EnableVirtualization { get ; set ; } = true ;
2123
2224 public DiagramZoomOptions Zoom { get ; set ; } = new DiagramZoomOptions ( ) ;
2325 public DiagramLinkOptions Links { get ; set ; } = new DiagramLinkOptions ( ) ;
Original file line number Diff line number Diff line change 55 <RazorLangVersion >3.0</RazorLangVersion >
66 <Authors >zHaytam</Authors >
77 <PackageLicenseExpression >MIT</PackageLicenseExpression >
8- <AssemblyVersion >1.4.0 </AssemblyVersion >
9- <FileVersion >1.4.0 </FileVersion >
8+ <AssemblyVersion >1.4.1 </AssemblyVersion >
9+ <FileVersion >1.4.1 </FileVersion >
1010 <RepositoryUrl >https://github.com/zHaytam/Blazor.Diagrams</RepositoryUrl >
1111 <Description >A fully customizable and extensible all-purpose diagrams library for Blazor</Description >
12- <Version >1.4.0 </Version >
12+ <Version >1.4.1 </Version >
1313 <GeneratePackageOnBuild >true</GeneratePackageOnBuild >
1414 <PackageTags >blazor diagrams diagramming svg drag</PackageTags >
1515 <PackageId >Z.Blazor.Diagrams</PackageId >
Original file line number Diff line number Diff line change @@ -129,6 +129,10 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
129129
130130 private async void CheckVisibility ( )
131131 {
132+ // _isVisible must be true in case virtualization gets disabled and some nodes are hidden
133+ if ( ! DiagramManager . Options . EnableVirtualization && _isVisible )
134+ return ;
135+
132136 if ( Node . Size == null )
133137 return ;
134138
You can’t perform that action at this time.
0 commit comments