Skip to content

Commit d59e2c8

Browse files
Merge pull request #4900 from syncfusion-content/ES-892766_ScrollPadding1
ES 892766: Scroll padding support.
2 parents 78619d2 + e5a87a1 commit d59e2c8

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed
-204 KB
Loading
30.7 KB
Loading

blazor/diagram/scroll-settings.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,52 @@ To explore about the options , refer [ScrollLimitMode](https://help.syncfusion.c
257257
| Diagram | ![ScrollLimitMode as Diagram](./images/ScrollLimitDiagram.gif)|
258258
| Infinity | ![ScrollLimitMode as Infinity](./images/ScrollLimitInfinity.gif)|
259259

260+
## Scroll Padding
261+
The [ScrollPadding](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Diagram.ScrollSettings.html#Syncfusion_Blazor_Diagram_ScrollSettings_ScrollPadding) property in the scroll settings allows you to extend the scrollable region based on the [ScrollLimit](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Diagram.ScrollSettings.html#Syncfusion_Blazor_Diagram_ScrollSettings_ScrollLimit), when an element is interacted with at the edges of the viewport. It specifies the maximum distance between the object and the edge of the diagram area. This behavior is essential for improving the user experience, especially in large diagrams where users need to extend elements across different parts of the diagram area.
262+
263+
N> The default value is 0 pixels.
264+
265+
The following code example illustrates how to set scroll padding.
266+
267+
```cshtml
268+
@using Syncfusion.Blazor.Diagram
269+
<SfDiagramComponent Height="600px" Width="600px" Nodes="@nodes">
270+
@* Sets the ScrollSettings for the diagram *@
271+
<ScrollSettings ScrollPadding="@ScrollBorder">
272+
</ScrollSettings>
273+
</SfDiagramComponent>
274+
@code
275+
{
276+
DiagramMargin ScrollBorder = new DiagramMargin() { Left = 100, Right = 100, Top = 100, Bottom = 100 };
277+
DiagramObjectCollection<Node> nodes;
278+
protected override void OnInitialized()
279+
{
280+
nodes = new DiagramObjectCollection<Node>();
281+
// A node is created and stored in the nodes collection.
282+
Node node = new Node()
283+
{
284+
ID = "node1",
285+
// Position of the node.
286+
OffsetX = 250,
287+
OffsetY = 250,
288+
// Size of the node.
289+
Width = 100,
290+
Height = 100,
291+
Style = new ShapeStyle()
292+
{
293+
Fill = "#6495ED",
294+
StrokeColor = "white"
295+
}
296+
};
297+
// Add node.
298+
nodes.Add(node);
299+
}
300+
}
301+
```
302+
![Scoll Padding support for node](images/ScrollPadding.png)
303+
304+
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/Blazor-Diagram-Examples/tree/master/UG-Samples/ScrollSettings/ScrollPadding)
305+
260306
## Scrollable Area
261307
Scrolling beyond any particular rectangular area can be restricted by using the [ScrollableArea](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Diagram.ScrollSettings.html#Syncfusion_Blazor_Diagram_ScrollSettings_ScrollableArea) property of scroll settings. To restrict scrolling beyond any custom region, set the [ScrollLimit](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Diagram.ScrollSettings.html#Syncfusion_Blazor_Diagram_ScrollSettings_ScrollLimit) as “limited.” The following code example illustrates how to customize the scrollable area.
262308

0 commit comments

Comments
 (0)