style(sequence): rename lineStarty to lineStartY

Fixes @cspell/eslint warnings.
This commit is contained in:
Alois Klink
2022-10-16 10:23:57 +01:00
parent 989d716c36
commit aa43cfb5ac

View File

@@ -293,15 +293,15 @@ const boundMessage = function (diagram, msgModel) {
bounds.bumpVerticalPos(lineHeight); bounds.bumpVerticalPos(lineHeight);
let lineStarty; let lineStartY;
let totalOffset = textDims.height - 10; let totalOffset = textDims.height - 10;
const textWidth = textDims.width; const textWidth = textDims.width;
if (startx === stopx) { if (startx === stopx) {
lineStarty = bounds.getVerticalPos() + totalOffset; lineStartY = bounds.getVerticalPos() + totalOffset;
if (!conf.rightAngles) { if (!conf.rightAngles) {
totalOffset += conf.boxMargin; totalOffset += conf.boxMargin;
lineStarty = bounds.getVerticalPos() + totalOffset; lineStartY = bounds.getVerticalPos() + totalOffset;
} }
totalOffset += 30; totalOffset += 30;
const dx = Math.max(textWidth / 2, conf.width / 2); const dx = Math.max(textWidth / 2, conf.width / 2);
@@ -313,15 +313,15 @@ const boundMessage = function (diagram, msgModel) {
); );
} else { } else {
totalOffset += conf.boxMargin; totalOffset += conf.boxMargin;
lineStarty = bounds.getVerticalPos() + totalOffset; lineStartY = bounds.getVerticalPos() + totalOffset;
bounds.insert(startx, lineStarty - 10, stopx, lineStarty); bounds.insert(startx, lineStartY - 10, stopx, lineStartY);
} }
bounds.bumpVerticalPos(totalOffset); bounds.bumpVerticalPos(totalOffset);
msgModel.height += totalOffset; msgModel.height += totalOffset;
msgModel.stopy = msgModel.starty + msgModel.height; msgModel.stopy = msgModel.starty + msgModel.height;
bounds.insert(msgModel.fromBounds, msgModel.starty, msgModel.toBounds, msgModel.stopy); bounds.insert(msgModel.fromBounds, msgModel.starty, msgModel.toBounds, msgModel.stopy);
return lineStarty; return lineStartY;
}; };
/** /**
@@ -329,10 +329,10 @@ const boundMessage = function (diagram, msgModel) {
* *
* @param {any} diagram - The parent of the message element * @param {any} diagram - The parent of the message element
* @param {any} msgModel - The model containing fields describing a message * @param {any} msgModel - The model containing fields describing a message
* @param {number} lineStarty - The Y coordinate at which the message line starts * @param {number} lineStartY - The Y coordinate at which the message line starts
* @param diagObj * @param diagObj
*/ */
const drawMessage = function (diagram, msgModel, lineStarty, diagObj) { const drawMessage = function (diagram, msgModel, lineStartY, diagObj) {
const { startx, stopx, starty, message, type, sequenceIndex, sequenceVisible } = msgModel; const { startx, stopx, starty, message, type, sequenceIndex, sequenceVisible } = msgModel;
const textDims = utils.calculateTextDimensions(message, messageFont(conf)); const textDims = utils.calculateTextDimensions(message, messageFont(conf));
const textObj = svgDraw.getTextObj(); const textObj = svgDraw.getTextObj();
@@ -361,8 +361,8 @@ const drawMessage = function (diagram, msgModel, lineStarty, diagObj) {
.append('path') .append('path')
.attr( .attr(
'd', 'd',
`M ${startx},${lineStarty} H ${startx + Math.max(conf.width / 2, textWidth / 2)} V ${ `M ${startx},${lineStartY} H ${startx + Math.max(conf.width / 2, textWidth / 2)} V ${
lineStarty + 25 lineStartY + 25
} H ${startx}` } H ${startx}`
); );
} else { } else {
@@ -373,27 +373,27 @@ const drawMessage = function (diagram, msgModel, lineStarty, diagObj) {
'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 {
line = diagram.append('line'); line = diagram.append('line');
line.attr('x1', startx); line.attr('x1', startx);
line.attr('y1', lineStarty); line.attr('y1', lineStartY);
line.attr('x2', stopx); line.attr('x2', stopx);
line.attr('y2', lineStarty); line.attr('y2', lineStartY);
} }
// Make an SVG Container // Make an SVG Container
// Draw the line // Draw the line
@@ -441,7 +441,7 @@ const drawMessage = function (diagram, msgModel, lineStarty, diagObj) {
diagram diagram
.append('text') .append('text')
.attr('x', startx) .attr('x', startx)
.attr('y', lineStarty + 4) .attr('y', lineStartY + 4)
.attr('font-family', 'sans-serif') .attr('font-family', 'sans-serif')
.attr('font-size', '12px') .attr('font-size', '12px')
.attr('text-anchor', 'middle') .attr('text-anchor', 'middle')
@@ -812,8 +812,8 @@ export const draw = function (_text, id, _version, diagObj) {
msgModel.starty = bounds.getVerticalPos(); msgModel.starty = bounds.getVerticalPos();
msgModel.sequenceIndex = sequenceIndex; msgModel.sequenceIndex = sequenceIndex;
msgModel.sequenceVisible = diagObj.db.showSequenceNumbers(); msgModel.sequenceVisible = diagObj.db.showSequenceNumbers();
const lineStarty = boundMessage(diagram, msgModel); const lineStartY = boundMessage(diagram, msgModel);
messagesToDraw.push({ messageModel: msgModel, lineStarty: lineStarty }); messagesToDraw.push({ messageModel: msgModel, lineStartY: lineStartY });
bounds.models.addMessage(msgModel); bounds.models.addMessage(msgModel);
} catch (e) { } catch (e) {
log.error('error while drawing message', e); log.error('error while drawing message', e);
@@ -837,7 +837,7 @@ export const draw = function (_text, id, _version, diagObj) {
} }
}); });
messagesToDraw.forEach((e) => drawMessage(diagram, e.messageModel, e.lineStarty, diagObj)); messagesToDraw.forEach((e) => drawMessage(diagram, e.messageModel, e.lineStartY, diagObj));
if (conf.mirrorActors) { if (conf.mirrorActors) {
// Draw actors below diagram // Draw actors below diagram