Hi,
I use images both in the palette and for the shapes.
But what are the recommended size for image in the palette?
And how to I handle resizing of a shape once it is part of a diagram? Can the shape change to a different size of image or what is the best way for me to handle this?
|
<SfSymbolPalette ID="symbolPalette" Height="700px" SymbolDragSize="@DragSize">
</SfSymbolPalette>
@code{
public SymbolDragSizeModel DragSize = new SymbolDragSizeModel()
{
Height = 250,
Width = 250
};
} |
Sorry for being unclear.
It is not regarding dragging.
But since I use image in the nodes the size of the image should match the shown node size, so:
#1
When shown in the palette with standard settings what should the size of the used image be?
#2
Once dropped on the diagram how do I handle that the user resize the node or zoom the diagram so the image used in the node is still looking good?
|
#1
When shown in the palette with standard settings what should the size of the used image be? |
There is no default size for the node in the diagram. for rendering the nodes in the diagram height and width must be provided. | |
|
#2
Once dropped on the diagram how do I handle that the user resize the node or zoom the diagram so the image used in the node is still looking good? |
We suggest you use AspectRatio. For enabling AspectRatio you need to add constraints of AspectRatio to the node. By enabling it when you resize the node both the height and width of the node are updated. For more information, please refer to the below code snippet and sample link.
Code snippet:
|
Hi,
I maked two images here. What image size should I use here?
It is unclear to me how the size of the image is managed inside
|
// Do not set SymbolHeight and SymbolWidth in symbol palette
<SfSymbolPalette @ref="palette" id="palettes" Width="100%" Height="700px" ExpandMode="Syncfusion.Blazor.Navigations.ExpandMode.Multiple" Palettes="@Palettes">
<SymbolMargin Left="12" Right="12" Bottom="12" Top="12"></SymbolMargin>
</SfSymbolPalette>
new DiagramNode()
{
Id = "image1",
Shape = new DiagramShape() { Type = Shapes.Image, Source=https://www.pngitem.com/pimgs/m/462-4623623_blazor-icon-blazor-logo-svg-hd-png-download.png },
Height = 80,
Width = 100,
},
new DiagramNode()
{
Id = "image2",
Shape = new DiagramShape() { Type = Shapes.Image, Source=https://media.glassdoor.com/sqll/263207/syncfusion-squarelogo.png },
Height = 120,
Width = 150,
}, |
Thanks, I got it solved now