mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-14 12:59:46 +02:00
fix: do not alter line breaks when drawing text
This commit is contained in:
@@ -226,7 +226,6 @@ const drawNote = function(elem, noteModel) {
|
|||||||
textObj.anchor = conf.noteAlign;
|
textObj.anchor = conf.noteAlign;
|
||||||
textObj.textMargin = conf.noteMargin;
|
textObj.textMargin = conf.noteMargin;
|
||||||
textObj.valign = conf.noteAlign;
|
textObj.valign = conf.noteAlign;
|
||||||
textObj.wrap = true;
|
|
||||||
|
|
||||||
let textElem = drawText(g, textObj);
|
let textElem = drawText(g, textObj);
|
||||||
|
|
||||||
@@ -272,7 +271,7 @@ const actorFont = cnf => {
|
|||||||
*/
|
*/
|
||||||
const drawMessage = function(g, msgModel) {
|
const drawMessage = function(g, msgModel) {
|
||||||
bounds.bumpVerticalPos(10);
|
bounds.bumpVerticalPos(10);
|
||||||
const { startx, stopx, starty, message, type, sequenceIndex, wrap } = msgModel;
|
const { startx, stopx, starty, message, type, sequenceIndex } = msgModel;
|
||||||
const lines = common.splitBreaks(message).length;
|
const lines = common.splitBreaks(message).length;
|
||||||
let textDims = utils.calculateTextDimensions(message, messageFont(conf));
|
let textDims = utils.calculateTextDimensions(message, messageFont(conf));
|
||||||
const lineHeight = textDims.height / lines;
|
const lineHeight = textDims.height / lines;
|
||||||
@@ -293,7 +292,6 @@ const drawMessage = function(g, msgModel) {
|
|||||||
textObj.valign = conf.messageAlign;
|
textObj.valign = conf.messageAlign;
|
||||||
textObj.textMargin = conf.wrapPadding;
|
textObj.textMargin = conf.wrapPadding;
|
||||||
textObj.tspan = false;
|
textObj.tspan = false;
|
||||||
textObj.wrap = wrap;
|
|
||||||
|
|
||||||
drawText(g, textObj);
|
drawText(g, textObj);
|
||||||
|
|
||||||
|
@@ -21,9 +21,7 @@ export const drawRect = function(elem, rectData) {
|
|||||||
export const drawText = function(elem, textData) {
|
export const drawText = function(elem, textData) {
|
||||||
let prevTextHeight = 0,
|
let prevTextHeight = 0,
|
||||||
textHeight = 0;
|
textHeight = 0;
|
||||||
const lines = textData.wrap
|
const lines = textData.text.split(common.lineBreakRegex);
|
||||||
? textData.text.split(common.lineBreakRegex)
|
|
||||||
: [textData.text.replace(common.lineBreakRegex, ' ')];
|
|
||||||
|
|
||||||
let textElems = [];
|
let textElems = [];
|
||||||
let dy = 0;
|
let dy = 0;
|
||||||
|
Reference in New Issue
Block a user