From 49f1e827723922a8130d8f047c6574fa3b06fe75 Mon Sep 17 00:00:00 2001 From: Gaudenz Alder Date: Wed, 29 Jan 2020 10:49:51 +0100 Subject: [PATCH] Fixes inconsistent text rendering, center alignment --- javascript/src/js/shape/mxText.js | 5 ++--- javascript/src/js/util/mxSvgCanvas2D.js | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/javascript/src/js/shape/mxText.js b/javascript/src/js/shape/mxText.js index 180411810..c66d775f9 100644 --- a/javascript/src/js/shape/mxText.js +++ b/javascript/src/js/shape/mxText.js @@ -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) diff --git a/javascript/src/js/util/mxSvgCanvas2D.js b/javascript/src/js/util/mxSvgCanvas2D.js index 1afa84372..0b24c86a5 100644 --- a/javascript/src/js/util/mxSvgCanvas2D.js +++ b/javascript/src/js/util/mxSvgCanvas2D.js @@ -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 ' + @@ -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') {