Undo whitespace changes

This commit is contained in:
Ronald Heggenberger 2022-05-21 09:40:21 +02:00
parent 7372ca5e8e
commit 077e6621b9
3 changed files with 51 additions and 51 deletions

View File

@ -364,8 +364,8 @@ It is possible to get a sequence number attached to each arrow in a sequence dia
```html ```html
<script> <script>
mermaid.initialize({ sequence: { showSequenceNumbers: true }, }); mermaid.initialize({ sequence: { showSequenceNumbers: true }, });
</script> </script>
``` ```
It can also be be turned on via the diagram code as in the diagram: It can also be be turned on via the diagram code as in the diagram:

View File

@ -156,8 +156,8 @@ export const parseMessage = function (str) {
_str.match(/^[:]?wrap:/) !== null _str.match(/^[:]?wrap:/) !== null
? true ? true
: _str.match(/^[:]?nowrap:/) !== null : _str.match(/^[:]?nowrap:/) !== null
? false ? false
: undefined, : undefined,
}; };
log.debug('parseMessage:', message); log.debug('parseMessage:', message);
return message; return message;

View File

@ -367,21 +367,21 @@ const drawMessage = function (diagram, msgModel, lineStarty) {
.attr( .attr(
'd', 'd',
'M ' + 'M ' +
startx + startx +
',' + ',' +
lineStarty + lineStarty +
' C ' + ' C ' +
(startx + 60) + (startx + 60) +
',' + ',' +
(lineStarty - 10) + (lineStarty - 10) +
' ' + ' ' +
(startx + 60) + (startx + 60) +
',' + ',' +
(lineStarty + 30) + (lineStarty + 30) +
' ' + ' ' +
startx + startx +
',' + ',' +
(lineStarty + 20) (lineStarty + 20)
); );
} }
} else { } else {
@ -887,13 +887,13 @@ export const draw = function (text, id) {
diagram.attr( diagram.attr(
'viewBox', 'viewBox',
box.startx - box.startx -
conf.diagramMarginX + conf.diagramMarginX +
' -' + ' -' +
(conf.diagramMarginY + extraVertForTitle) + (conf.diagramMarginY + extraVertForTitle) +
' ' + ' ' +
width + width +
' ' + ' ' +
(height + extraVertForTitle) (height + extraVertForTitle)
); );
addSVGAccessibilityFields(parser.yy, diagram, id); addSVGAccessibilityFields(parser.yy, diagram, id);
@ -1095,17 +1095,17 @@ const buildNoteModel = function (msg, actors) {
noteModel.width = shouldWrap noteModel.width = shouldWrap
? Math.max(conf.width, textDimensions.width) ? Math.max(conf.width, textDimensions.width)
: Math.max( : Math.max(
actors[msg.from].width / 2 + actors[msg.to].width / 2, actors[msg.from].width / 2 + actors[msg.to].width / 2,
textDimensions.width + 2 * conf.noteMargin textDimensions.width + 2 * conf.noteMargin
); );
noteModel.startx = startx + (actors[msg.from].width + conf.actorMargin) / 2; noteModel.startx = startx + (actors[msg.from].width + conf.actorMargin) / 2;
} else if (msg.placement === parser.yy.PLACEMENT.LEFTOF) { } else if (msg.placement === parser.yy.PLACEMENT.LEFTOF) {
noteModel.width = shouldWrap noteModel.width = shouldWrap
? Math.max(conf.width, textDimensions.width + 2 * conf.noteMargin) ? Math.max(conf.width, textDimensions.width + 2 * conf.noteMargin)
: Math.max( : Math.max(
actors[msg.from].width / 2 + actors[msg.to].width / 2, actors[msg.from].width / 2 + actors[msg.to].width / 2,
textDimensions.width + 2 * conf.noteMargin textDimensions.width + 2 * conf.noteMargin
); );
noteModel.startx = startx - noteModel.width + (actors[msg.from].width - conf.actorMargin) / 2; noteModel.startx = startx - noteModel.width + (actors[msg.from].width - conf.actorMargin) / 2;
} else if (msg.to === msg.from) { } else if (msg.to === msg.from) {
textDimensions = utils.calculateTextDimensions( textDimensions = utils.calculateTextDimensions(
@ -1235,27 +1235,27 @@ const calculateLoopBounds = function (messages, actors) {
loops[current.id] = current; loops[current.id] = current;
break; break;
case parser.yy.LINETYPE.ACTIVE_START: case parser.yy.LINETYPE.ACTIVE_START:
{ {
const actorRect = actors[msg.from ? msg.from.actor : msg.to.actor]; const actorRect = actors[msg.from ? msg.from.actor : msg.to.actor];
const stackedSize = actorActivations(msg.from ? msg.from.actor : msg.to.actor).length; const stackedSize = actorActivations(msg.from ? msg.from.actor : msg.to.actor).length;
const x = const x =
actorRect.x + actorRect.width / 2 + ((stackedSize - 1) * conf.activationWidth) / 2; actorRect.x + actorRect.width / 2 + ((stackedSize - 1) * conf.activationWidth) / 2;
const toAdd = { const toAdd = {
startx: x, startx: x,
stopx: x + conf.activationWidth, stopx: x + conf.activationWidth,
actor: msg.from.actor, actor: msg.from.actor,
enabled: true, enabled: true,
}; };
bounds.activations.push(toAdd); bounds.activations.push(toAdd);
} }
break; break;
case parser.yy.LINETYPE.ACTIVE_END: case parser.yy.LINETYPE.ACTIVE_END:
{ {
const lastActorActivationIdx = bounds.activations const lastActorActivationIdx = bounds.activations
.map((a) => a.actor) .map((a) => a.actor)
.lastIndexOf(msg.from.actor); .lastIndexOf(msg.from.actor);
delete bounds.activations.splice(lastActorActivationIdx, 1)[0]; delete bounds.activations.splice(lastActorActivationIdx, 1)[0];
} }
break; break;
} }
const isNote = msg.placement !== undefined; const isNote = msg.placement !== undefined;