diff --git a/src/item/Item.js b/src/item/Item.js index 6f52dcc4..6e2dfc63 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -836,7 +836,8 @@ new function() { // Injection scope for various item event handlers getStrokeBounds: { stroke: true }, getHandleBounds: { handle: true }, getInternalBounds: { internal: true }, - getVisibleBounds: { stroke: true, forSvgExport: true }, + // Includes text overhangs + getDrawnBounds: { stroke: true, drawnTextBounds: true }, }, function(options, key) { this[key] = function(matrix) { @@ -932,6 +933,7 @@ new function() { // Injection scope for various item event handlers return [ options.stroke ? 1 : 0, options.handle ? 1 : 0, + options.drawnTextBounds? 1 : 0, internal ? 1 : 0 ].join(''); }, diff --git a/src/svg/SvgExport.js b/src/svg/SvgExport.js index 2af1e4aa..6d18de18 100644 --- a/src/svg/SvgExport.js +++ b/src/svg/SvgExport.js @@ -438,7 +438,7 @@ new function() { rect = bounds === 'view' ? new Rectangle([0, 0], view.getViewSize()) : bounds === 'content' - ? Item._getBounds(children, matrix, { stroke: true, forSvgExport: true }) + ? Item._getBounds(children, matrix, { stroke: true, drawnTextBounds: true }) .rect : Rectangle.read([bounds], 0, { readNull: true }), attrs = { diff --git a/src/text/PointText.js b/src/text/PointText.js index 586b8bd5..a99a3901 100644 --- a/src/text/PointText.js +++ b/src/text/PointText.js @@ -102,12 +102,10 @@ var PointText = TextItem.extend(/** @lends PointText# */{ } }, _getBounds: function(matrix, options) { - var rect = options.forSvgExport ? this._getVisibleTextSize() : this._getMeasuredTextSize(); - console.log(rect); + var rect = options.drawnTextBounds ? this._getDrawnTextSize() : this._getMeasuredTextSize(); return matrix ? matrix._transformBounds(rect, rect) : rect; }, _getMeasuredTextSize () { - console.log("get measured text size"); var style = this._style, lines = this._lines, numLines = lines.length, @@ -124,8 +122,7 @@ var PointText = TextItem.extend(/** @lends PointText# */{ numLines ? - 0.75 * leading : 0, width, numLines * leading); }, - _getVisibleTextSize () { - console.log("get visible text size"); + _getDrawnTextSize () { var numLines = this._lines.length; var leading = this._style.getLeading();