mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-22 08:50:13 +02:00
Fix default size if width/height not provided
This commit is contained in:
@@ -14,6 +14,29 @@ export const stateEnd = (
|
|||||||
node.labelStyle = labelStyles;
|
node.labelStyle = labelStyles;
|
||||||
const { cssStyles } = node;
|
const { cssStyles } = node;
|
||||||
const { lineColor, stateBorder, nodeBorder } = themeVariables;
|
const { lineColor, stateBorder, nodeBorder } = 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
|
const shapeSvg = parent
|
||||||
.insert('g')
|
.insert('g')
|
||||||
.attr('class', 'node default')
|
.attr('class', 'node default')
|
||||||
|
Reference in New Issue
Block a user