Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Commit

Permalink
Fixes inconsistent text rendering, center alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
alderg committed Jan 29, 2020
1 parent c8c5307 commit 49f1e82
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions javascript/src/js/shape/mxText.js
Original file line number Diff line number Diff line change
Expand Up @@ -818,10 +818,9 @@ mxText.prototype.redrawHtmlShapeWithCss3 = function()
var h = Math.max(0, Math.round(this.bounds.height / this.scale));
var flex = 'position: absolute; left: ' + Math.round(this.bounds.x) + 'px; ' +
'top: ' + Math.round(this.bounds.y) + 'px; pointer-events: none; ';
var block = this.getTextCss() + ((this.pointerEvents) ?
'pointer-events: all; ' : '');
var block = this.getTextCss();

mxSvgCanvas2D.createCss(w, h, this.align, this.valign, this.wrap, this.overflow, this.clipped,
mxSvgCanvas2D.createCss(w + 2, h, this.align, this.valign, this.wrap, this.overflow, this.clipped,
(this.background != null) ? mxUtils.htmlEntities(this.background) : null,
(this.border != null) ? mxUtils.htmlEntities(this.border) : null,
flex, block, this.scale, mxUtils.bind(this, function(dx, dy, flex, item, block, ofl)
Expand Down
4 changes: 2 additions & 2 deletions javascript/src/js/util/mxSvgCanvas2D.js
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,7 @@ mxSvgCanvas2D.prototype.updateTextNodes = function(x, y, w, h, align, valign, wr
{
var s = this.state.scale;

mxSvgCanvas2D.createCss(w, h, align, valign, wrap, overflow, clip,
mxSvgCanvas2D.createCss(w + 2, h, align, valign, wrap, overflow, clip,
(this.state.fontBackgroundColor != null) ? this.state.fontBackgroundColor : null,
(this.state.fontBorderColor != null) ? this.state.fontBorderColor : null,
'display: flex; align-items: unsafe ' +
Expand Down Expand Up @@ -1467,7 +1467,7 @@ mxSvgCanvas2D.createCss = function(w, h, align, valign, wrap, overflow, clip, bg
if (wrap && w > 0)
{
block += 'white-space: normal; word-wrap: ' + mxConstants.WORD_WRAP + '; ';
fw = 'width: ' + Math.round(w + 2) + 'px; ';
fw = 'width: ' + Math.round(w) + 'px; ';

if (ofl != '' && overflow != 'fill')
{
Expand Down

0 comments on commit 49f1e82

Please sign in to comment.