fix: minor refinement

This commit is contained in:
omkarht
2025-07-01 18:11:41 +05:30
parent 5055ade44e
commit a4a27611dd
2 changed files with 14 additions and 10 deletions

View File

@@ -1076,10 +1076,11 @@ export const draw = async function (_text: string, id: string, _version: string,
for (const box of bounds.models.boxes) {
box.height = bounds.getVerticalPos() - box.y;
bounds.insert(box.x, box.y, box.x + box.width, box.height);
box.startx = box.x;
box.starty = box.y;
box.stopx = box.startx + box.width;
box.stopy = box.starty + box.height;
const boxPadding = conf.boxMargin * 2;
box.startx = box.x - boxPadding;
box.starty = box.y - boxPadding * 0.25;
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)';
svgDraw.drawBox(diagram, box, conf);
}
@@ -1344,6 +1345,9 @@ async function calculateActorMargins(
return (total += actors.get(aKey).width + (actors.get(aKey).margin || 0));
}, 0);
const standardBoxPadding = conf.boxMargin * 8;
totalWidth += standardBoxPadding;
totalWidth -= 2 * conf.boxTextMargin;
if (box.wrap) {
box.name = utils.wrapLabel(box.name, totalWidth - 2 * conf.wrapPadding, textFont);

View File

@@ -712,13 +712,13 @@ const drawActorTypeControl = function (elem, actor, conf, isFooter) {
.attr('marker-end', 'url(#filled-head-control)');
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))(
actor.description,
actElem,
rect.x,
rect.y + (!isFooter ? 30 : 40),
rect.y + 30,
rect.width,
rect.height,
{ class: `actor ${ACTOR_MAN_FIGURE_CLASS}` },
@@ -774,8 +774,8 @@ const drawActorTypeEntity = function (elem, actor, conf, isFooter) {
.attr('stroke', '#333')
.attr('stroke-width', 2);
const boundBox = actElem.node().getBBox();
actor.height = boundBox.height + conf.boxTextMargin;
const bounds = actElem.node().getBBox();
actor.height = bounds.height + (conf.sequence.labelBoxHeight ?? 0);
if (!isFooter) {
actorCnt++;
@@ -916,7 +916,7 @@ const drawActorTypeDatabase = function (elem, actor, conf, isFooter) {
const lastPath = cylinderGroup.select('path:last-child');
if (lastPath.node()) {
const bounds = lastPath.node().getBBox();
actor.height = bounds.height + 2 * conf.boxTextMargin;
actor.height = bounds.height + (conf.sequence.labelBoxHeight ?? 0);
}
return actor.height;
@@ -989,7 +989,7 @@ const drawActorTypeBoundary = function (elem, actor, conf, isFooter) {
.attr('width', actor.width);
const bounds = actElem.node().getBBox();
actor.height = bounds.height + conf.boxTextMargin;
actor.height = bounds.height + (conf.sequence.labelBoxHeight ?? 0);
_drawTextCandidateFunc(conf, hasKatex(actor.description))(
actor.description,