mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-21 15:09:39 +02:00
fix: minor refinement
This commit is contained in:
@@ -1076,10 +1076,11 @@ export const draw = async function (_text: string, id: string, _version: string,
|
|||||||
for (const box of bounds.models.boxes) {
|
for (const box of bounds.models.boxes) {
|
||||||
box.height = bounds.getVerticalPos() - box.y;
|
box.height = bounds.getVerticalPos() - box.y;
|
||||||
bounds.insert(box.x, box.y, box.x + box.width, box.height);
|
bounds.insert(box.x, box.y, box.x + box.width, box.height);
|
||||||
box.startx = box.x;
|
const boxPadding = conf.boxMargin * 2;
|
||||||
box.starty = box.y;
|
box.startx = box.x - boxPadding;
|
||||||
box.stopx = box.startx + box.width;
|
box.starty = box.y - boxPadding * 0.25;
|
||||||
box.stopy = box.starty + box.height;
|
box.stopx = box.startx + box.width + 2 * boxPadding;
|
||||||
|
box.stopy = box.starty + box.height + boxPadding * 0.75;
|
||||||
box.stroke = 'rgb(0,0,0, 0.5)';
|
box.stroke = 'rgb(0,0,0, 0.5)';
|
||||||
svgDraw.drawBox(diagram, box, conf);
|
svgDraw.drawBox(diagram, box, conf);
|
||||||
}
|
}
|
||||||
@@ -1344,6 +1345,9 @@ async function calculateActorMargins(
|
|||||||
return (total += actors.get(aKey).width + (actors.get(aKey).margin || 0));
|
return (total += actors.get(aKey).width + (actors.get(aKey).margin || 0));
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
|
const standardBoxPadding = conf.boxMargin * 8;
|
||||||
|
totalWidth += standardBoxPadding;
|
||||||
|
|
||||||
totalWidth -= 2 * conf.boxTextMargin;
|
totalWidth -= 2 * conf.boxTextMargin;
|
||||||
if (box.wrap) {
|
if (box.wrap) {
|
||||||
box.name = utils.wrapLabel(box.name, totalWidth - 2 * conf.wrapPadding, textFont);
|
box.name = utils.wrapLabel(box.name, totalWidth - 2 * conf.wrapPadding, textFont);
|
||||||
|
@@ -712,13 +712,13 @@ const drawActorTypeControl = function (elem, actor, conf, isFooter) {
|
|||||||
.attr('marker-end', 'url(#filled-head-control)');
|
.attr('marker-end', 'url(#filled-head-control)');
|
||||||
|
|
||||||
const bounds = actElem.node().getBBox();
|
const bounds = actElem.node().getBBox();
|
||||||
actor.height = bounds.height + conf.boxTextMargin;
|
actor.height = bounds.height + 2 * (conf?.sequence?.labelBoxHeight ?? 0);
|
||||||
|
|
||||||
_drawTextCandidateFunc(conf, hasKatex(actor.description))(
|
_drawTextCandidateFunc(conf, hasKatex(actor.description))(
|
||||||
actor.description,
|
actor.description,
|
||||||
actElem,
|
actElem,
|
||||||
rect.x,
|
rect.x,
|
||||||
rect.y + (!isFooter ? 30 : 40),
|
rect.y + 30,
|
||||||
rect.width,
|
rect.width,
|
||||||
rect.height,
|
rect.height,
|
||||||
{ class: `actor ${ACTOR_MAN_FIGURE_CLASS}` },
|
{ class: `actor ${ACTOR_MAN_FIGURE_CLASS}` },
|
||||||
@@ -774,8 +774,8 @@ const drawActorTypeEntity = function (elem, actor, conf, isFooter) {
|
|||||||
.attr('stroke', '#333')
|
.attr('stroke', '#333')
|
||||||
.attr('stroke-width', 2);
|
.attr('stroke-width', 2);
|
||||||
|
|
||||||
const boundBox = actElem.node().getBBox();
|
const bounds = actElem.node().getBBox();
|
||||||
actor.height = boundBox.height + conf.boxTextMargin;
|
actor.height = bounds.height + (conf.sequence.labelBoxHeight ?? 0);
|
||||||
|
|
||||||
if (!isFooter) {
|
if (!isFooter) {
|
||||||
actorCnt++;
|
actorCnt++;
|
||||||
@@ -916,7 +916,7 @@ const drawActorTypeDatabase = function (elem, actor, conf, isFooter) {
|
|||||||
const lastPath = cylinderGroup.select('path:last-child');
|
const lastPath = cylinderGroup.select('path:last-child');
|
||||||
if (lastPath.node()) {
|
if (lastPath.node()) {
|
||||||
const bounds = lastPath.node().getBBox();
|
const bounds = lastPath.node().getBBox();
|
||||||
actor.height = bounds.height + 2 * conf.boxTextMargin;
|
actor.height = bounds.height + (conf.sequence.labelBoxHeight ?? 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return actor.height;
|
return actor.height;
|
||||||
@@ -989,7 +989,7 @@ const drawActorTypeBoundary = function (elem, actor, conf, isFooter) {
|
|||||||
.attr('width', actor.width);
|
.attr('width', actor.width);
|
||||||
|
|
||||||
const bounds = actElem.node().getBBox();
|
const bounds = actElem.node().getBBox();
|
||||||
actor.height = bounds.height + conf.boxTextMargin;
|
actor.height = bounds.height + (conf.sequence.labelBoxHeight ?? 0);
|
||||||
|
|
||||||
_drawTextCandidateFunc(conf, hasKatex(actor.description))(
|
_drawTextCandidateFunc(conf, hasKatex(actor.description))(
|
||||||
actor.description,
|
actor.description,
|
||||||
|
Reference in New Issue
Block a user