mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
Updated labels
This commit is contained in:
parent
0fbe5f2f10
commit
90b7a3be63
@ -57,7 +57,7 @@ export const dividedRect = 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 - 4 * (bbox.y - (bbox.top ?? 0))})`
|
||||
`translate(${x + (node.padding ?? 0) / 2 - (bbox.x - (bbox.left ?? 0))}, ${y + rectOffset + (node.padding ?? 0) / 2 - (bbox.y - (bbox.top ?? 0))})`
|
||||
);
|
||||
|
||||
updateNodeBounds(node, polygon);
|
||||
|
@ -55,7 +55,7 @@ export const flippedTriangle = async (parent: SVGAElement, node: Node): Promise<
|
||||
|
||||
label.attr(
|
||||
'transform',
|
||||
`translate(${-bbox.width / 2 - (bbox.x - (bbox.left ?? 0))}, ${-h / 2 + 4 * (bbox.y - (bbox.top ?? 0))})`
|
||||
`translate(${-bbox.width / 2 - (bbox.x - (bbox.left ?? 0))}, ${-h / 2 + (bbox.y - (bbox.top ?? 0))})`
|
||||
);
|
||||
|
||||
node.intersect = function (point) {
|
||||
|
@ -52,7 +52,7 @@ export const halfRoundedRectangle = async (parent: SVGAElement, node: Node) => {
|
||||
polygon.attr('transform', `translate(${-w / 2 - h / 4}, ${-h / 2})`);
|
||||
label.attr(
|
||||
'transform',
|
||||
`translate(${-w / 2 + (node.padding ?? 0) - h / 4 - (bbox.x - (bbox.left ?? 0))}, ${-h / 2 + (node.padding ?? 0) - 4 * (bbox.y - (bbox.top ?? 0))})`
|
||||
`translate(${-w / 2 + (node.padding ?? 0) - h / 4 - (bbox.x - (bbox.left ?? 0))}, ${-h / 2 + (node.padding ?? 0) - (bbox.y - (bbox.top ?? 0))})`
|
||||
);
|
||||
|
||||
updateNodeBounds(node, polygon);
|
||||
|
@ -67,7 +67,7 @@ export const linedCylinder = async (parent: SVGAElement, node: Node) => {
|
||||
|
||||
label.attr(
|
||||
'transform',
|
||||
`translate(${-bbox.width / 2 - (bbox.x - (bbox.left ?? 0))}, ${h / 2 - bbox.height + outerOffset - 4 * (bbox.y - (bbox.top ?? 0))})`
|
||||
`translate(${-bbox.width / 2 - (bbox.x - (bbox.left ?? 0))}, ${h / 2 - bbox.height + outerOffset - (bbox.y - (bbox.top ?? 0))})`
|
||||
);
|
||||
|
||||
node.intersect = function (point) {
|
||||
|
@ -73,7 +73,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 - 4 * (bbox.y - (bbox.top ?? 0))})`
|
||||
`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))})`
|
||||
);
|
||||
|
||||
updateNodeBounds(node, waveEdgeRect);
|
||||
|
@ -71,7 +71,7 @@ export const multiRect = async (parent: SVGAElement, node: Node) => {
|
||||
|
||||
label.attr(
|
||||
'transform',
|
||||
`translate(${-(bbox.width / 2) - rectOffset - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) + rectOffset - 4 * (bbox.y - (bbox.top ?? 0))})`
|
||||
`translate(${-(bbox.width / 2) - rectOffset - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) + rectOffset - (bbox.y - (bbox.top ?? 0))})`
|
||||
);
|
||||
|
||||
updateNodeBounds(node, multiRect);
|
||||
|
@ -90,7 +90,7 @@ export const multiWaveEdgedRectangle = async (parent: SVGAElement, node: Node) =
|
||||
|
||||
label.attr(
|
||||
'transform',
|
||||
`translate(${-(bbox.width / 2) - rectOffset - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) + rectOffset - waveAmplitude / 2 - 4 * (bbox.y - (bbox.top ?? 0))})`
|
||||
`translate(${-(bbox.width / 2) - rectOffset - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) + rectOffset - waveAmplitude / 2 - (bbox.y - (bbox.top ?? 0))})`
|
||||
);
|
||||
|
||||
updateNodeBounds(node, shape);
|
||||
|
@ -51,7 +51,7 @@ export const slopedRect = async (parent: SVGAElement, node: Node) => {
|
||||
polygon.attr('transform', `translate(0, ${h / 4})`);
|
||||
label.attr(
|
||||
'transform',
|
||||
`translate(${-w / 2 + (node.padding ?? 0) - (bbox.x - (bbox.left ?? 0))}, ${-h / 4 + (node.padding ?? 0) - 4 * (bbox.y - (bbox.top ?? 0))})`
|
||||
`translate(${-w / 2 + (node.padding ?? 0) - (bbox.x - (bbox.left ?? 0))}, ${-h / 4 + (node.padding ?? 0) - (bbox.y - (bbox.top ?? 0))})`
|
||||
);
|
||||
|
||||
updateNodeBounds(node, polygon);
|
||||
|
@ -85,7 +85,7 @@ export const taggedWaveEdgedRectangle = async (parent: SVGAElement, node: Node)
|
||||
waveEdgeRect.attr('transform', `translate(0,${-waveAmplitude / 2})`);
|
||||
label.attr(
|
||||
'transform',
|
||||
`translate(${-w / 2 + (node.padding ?? 0) - (bbox.x - (bbox.left ?? 0))},${-h / 2 + (node.padding ?? 0) - waveAmplitude / 2 - 4 * (bbox.y - (bbox.top ?? 0))})`
|
||||
`translate(${-w / 2 + (node.padding ?? 0) - (bbox.x - (bbox.left ?? 0))},${-h / 2 + (node.padding ?? 0) - waveAmplitude / 2 - (bbox.y - (bbox.top ?? 0))})`
|
||||
);
|
||||
|
||||
updateNodeBounds(node, waveEdgeRect);
|
||||
|
@ -55,7 +55,7 @@ export const triangle = async (parent: SVGAElement, node: Node): Promise<SVGAEle
|
||||
|
||||
label.attr(
|
||||
'transform',
|
||||
`translate(${-bbox.width / 2 - (bbox.x - (bbox.left ?? 0))}, ${h / 2 - bbox.height - 4 * (bbox.y - (bbox.top ?? 0))})`
|
||||
`translate(${-bbox.width / 2 - (bbox.x - (bbox.left ?? 0))}, ${h / 2 - bbox.height - (bbox.y - (bbox.top ?? 0))})`
|
||||
);
|
||||
|
||||
node.intersect = function (point) {
|
||||
|
@ -54,7 +54,7 @@ export const waveEdgedRectangle = async (parent: SVGAElement, node: Node) => {
|
||||
waveEdgeRect.attr('transform', `translate(0,${-waveAmplitude / 2})`);
|
||||
label.attr(
|
||||
'transform',
|
||||
`translate(${-w / 2 + (node.padding ?? 0) - (bbox.x - (bbox.left ?? 0))},${-h / 2 + (node.padding ?? 0) - waveAmplitude / 2 - 4 * (bbox.y - (bbox.top ?? 0))})`
|
||||
`translate(${-w / 2 + (node.padding ?? 0) - (bbox.x - (bbox.left ?? 0))},${-h / 2 + (node.padding ?? 0) - waveAmplitude / 2 - (bbox.y - (bbox.top ?? 0))})`
|
||||
);
|
||||
|
||||
updateNodeBounds(node, waveEdgeRect);
|
||||
|
@ -68,7 +68,7 @@ export const windowPane = async (parent: SVGAElement, node: Node) => {
|
||||
|
||||
label.attr(
|
||||
'transform',
|
||||
`translate(${-(bbox.width / 2) + rectOffset / 2 - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) + rectOffset / 2 - 4 * (bbox.y - (bbox.top ?? 0))})`
|
||||
`translate(${-(bbox.width / 2) + rectOffset / 2 - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) + rectOffset / 2 - (bbox.y - (bbox.top ?? 0))})`
|
||||
);
|
||||
|
||||
updateNodeBounds(node, windowPane);
|
||||
|
Loading…
x
Reference in New Issue
Block a user