mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-05 23:29:37 +02:00
Updated padding for neo look
This commit is contained in:
@@ -8,8 +8,10 @@ export const dividedRectangle = async (parent: SVGAElement, node: Node) => {
|
||||
const { labelStyles, nodeStyles } = styles2String(node);
|
||||
node.labelStyle = labelStyles;
|
||||
const { shapeSvg, bbox, label } = await labelHelper(parent, node, getNodeClasses(node));
|
||||
const w = bbox.width + node.padding;
|
||||
const h = bbox.height + node.padding;
|
||||
const paddingX = node.look === 'neo' ? (node.padding ?? 0) * 2 : (node.padding ?? 0);
|
||||
const paddingY = node.look === 'neo' ? (node.padding ?? 0) * 1 : (node.padding ?? 0);
|
||||
const w = Math.max(bbox.width + paddingX * 2, node?.width ?? 0);
|
||||
const h = Math.max(bbox.height + paddingY * 2, node?.height ?? 0);
|
||||
const rectOffset = h * 0.2;
|
||||
|
||||
const x = -w / 2;
|
||||
@@ -53,7 +55,7 @@ export const dividedRectangle = async (parent: SVGAElement, node: Node) => {
|
||||
|
||||
label.attr(
|
||||
'transform',
|
||||
`translate(${x + (node.padding ?? 0) / 2 - (bbox.x - (bbox.left ?? 0))}, ${y + rectOffset + (node.padding ?? 0) / 2 - (bbox.y - (bbox.top ?? 0))})`
|
||||
`translate(${x + paddingX / 2 - (bbox.x - (bbox.left ?? 0))}, ${y + rectOffset + paddingY / 2 - (bbox.y - (bbox.top ?? 0))})`
|
||||
);
|
||||
|
||||
updateNodeBounds(node, polygon);
|
||||
|
@@ -17,8 +17,10 @@ export const halfRoundedRectangle = async (parent: SVGAElement, node: Node) => {
|
||||
const minWidth = 80,
|
||||
minHeight = 50;
|
||||
const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
|
||||
const w = Math.max(minWidth, bbox.width + (node.padding ?? 0) * 2, node?.width ?? 0);
|
||||
const h = Math.max(minHeight, bbox.height + (node.padding ?? 0) * 2, node?.height ?? 0);
|
||||
const paddingX = node.look === 'neo' ? (node.padding ?? 0) * 2 : (node.padding ?? 0);
|
||||
const paddingY = node.look === 'neo' ? (node.padding ?? 0) * 1 : (node.padding ?? 0);
|
||||
const w = Math.max(minWidth, bbox.width + paddingX * 2, node?.width ?? 0);
|
||||
const h = Math.max(minHeight, bbox.height + paddingY * 2, node?.height ?? 0);
|
||||
const radius = h / 2;
|
||||
const { cssStyles } = node;
|
||||
|
||||
|
@@ -13,8 +13,10 @@ export const linedWaveEdgedRect = async (parent: SVGAElement, node: Node) => {
|
||||
const { labelStyles, nodeStyles } = styles2String(node);
|
||||
node.labelStyle = labelStyles;
|
||||
const { shapeSvg, bbox, label } = await labelHelper(parent, node, getNodeClasses(node));
|
||||
const w = Math.max(bbox.width + (node.padding ?? 0) * 2, node?.width ?? 0);
|
||||
const h = Math.max(bbox.height + (node.padding ?? 0) * 2, node?.height ?? 0);
|
||||
const paddingX = node.look === 'neo' ? (node.padding ?? 0) * 2 : (node.padding ?? 0);
|
||||
const paddingY = node.look === 'neo' ? (node.padding ?? 0) * 2 : (node.padding ?? 0);
|
||||
const w = Math.max(bbox.width + paddingX * 2, node?.width ?? 0);
|
||||
const h = Math.max(bbox.height + paddingY * 2, node?.height ?? 0);
|
||||
const waveAmplitude = h / 4;
|
||||
const finalH = h + waveAmplitude;
|
||||
const { cssStyles } = node;
|
||||
@@ -66,7 +68,7 @@ export const linedWaveEdgedRect = async (parent: SVGAElement, node: Node) => {
|
||||
waveEdgeRect.attr('transform', `translate(0,${-waveAmplitude / 2})`);
|
||||
label.attr(
|
||||
'transform',
|
||||
`translate(${-w / 2 + (node.padding ?? 0) + ((w / 2) * 0.1) / 2 - (bbox.x - (bbox.left ?? 0))},${-h / 2 + (node.padding ?? 0) - waveAmplitude / 2 - (bbox.y - (bbox.top ?? 0))})`
|
||||
`translate(${-w / 2 + paddingX + ((w / 2) * 0.1) / 2 - (bbox.x - (bbox.left ?? 0))},${-h / 2 + paddingY - waveAmplitude / 2 - (bbox.y - (bbox.top ?? 0))})`
|
||||
);
|
||||
|
||||
updateNodeBounds(node, waveEdgeRect);
|
||||
|
@@ -8,8 +8,10 @@ export const windowPane = async (parent: SVGAElement, node: Node) => {
|
||||
const { labelStyles, nodeStyles } = styles2String(node);
|
||||
node.labelStyle = labelStyles;
|
||||
const { shapeSvg, bbox, label } = await labelHelper(parent, node, getNodeClasses(node));
|
||||
const w = Math.max(bbox.width + (node.padding ?? 0) * 2, node?.width ?? 0);
|
||||
const h = Math.max(bbox.height + (node.padding ?? 0) * 2, node?.height ?? 0);
|
||||
const paddingX = node.look === 'neo' ? (node.padding ?? 0) * 2 : (node.padding ?? 0);
|
||||
const paddingY = node.look === 'neo' ? (node.padding ?? 0) * 2 : (node.padding ?? 0);
|
||||
const w = Math.max(bbox.width + paddingX * 2, node?.width ?? 0);
|
||||
const h = Math.max(bbox.height + paddingY * 2, node?.height ?? 0);
|
||||
const rectOffset = 5;
|
||||
const x = -w / 2;
|
||||
const y = -h / 2;
|
||||
|
Reference in New Issue
Block a user