Fix default size if not provided

This commit is contained in:
Per Brolin
2024-09-30 10:44:01 +02:00
parent edc2ac7fea
commit a7a9185222

View File

@@ -12,6 +12,28 @@ export const stateStart = (
) => {
const { lineColor } = themeVariables;
// If incoming height & width are present, subtract the padding from them
// as labelHelper does not take padding into account
// also check if the width or height is less than minimum default values (50),
// if so set it to min value
if (node.width || node.height) {
if ((node.width ?? 0) < 50) {
node.width = 50;
}
if ((node.height ?? 0) < 50) {
node.height = 50;
}
}
if (!node.width) {
node.width = 50;
}
if (!node.height) {
node.width = 50;
}
const shapeSvg = parent
.insert('g')
.attr('class', 'node default')