rename the bound type and fix cache flags

This commit is contained in:
DD 2018-10-24 17:25:55 -04:00
parent f85e3a7947
commit 893f85bdfe
3 changed files with 6 additions and 7 deletions

View file

@ -836,7 +836,8 @@ new function() { // Injection scope for various item event handlers
getStrokeBounds: { stroke: true }, getStrokeBounds: { stroke: true },
getHandleBounds: { handle: true }, getHandleBounds: { handle: true },
getInternalBounds: { internal: true }, getInternalBounds: { internal: true },
getVisibleBounds: { stroke: true, forSvgExport: true }, // Includes text overhangs
getDrawnBounds: { stroke: true, drawnTextBounds: true },
}, },
function(options, key) { function(options, key) {
this[key] = function(matrix) { this[key] = function(matrix) {
@ -932,6 +933,7 @@ new function() { // Injection scope for various item event handlers
return [ return [
options.stroke ? 1 : 0, options.stroke ? 1 : 0,
options.handle ? 1 : 0, options.handle ? 1 : 0,
options.drawnTextBounds? 1 : 0,
internal ? 1 : 0 internal ? 1 : 0
].join(''); ].join('');
}, },

View file

@ -438,7 +438,7 @@ new function() {
rect = bounds === 'view' rect = bounds === 'view'
? new Rectangle([0, 0], view.getViewSize()) ? new Rectangle([0, 0], view.getViewSize())
: bounds === 'content' : bounds === 'content'
? Item._getBounds(children, matrix, { stroke: true, forSvgExport: true }) ? Item._getBounds(children, matrix, { stroke: true, drawnTextBounds: true })
.rect .rect
: Rectangle.read([bounds], 0, { readNull: true }), : Rectangle.read([bounds], 0, { readNull: true }),
attrs = { attrs = {

View file

@ -102,12 +102,10 @@ var PointText = TextItem.extend(/** @lends PointText# */{
} }
}, },
_getBounds: function(matrix, options) { _getBounds: function(matrix, options) {
var rect = options.forSvgExport ? this._getVisibleTextSize() : this._getMeasuredTextSize(); var rect = options.drawnTextBounds ? this._getDrawnTextSize() : this._getMeasuredTextSize();
console.log(rect);
return matrix ? matrix._transformBounds(rect, rect) : rect; return matrix ? matrix._transformBounds(rect, rect) : rect;
}, },
_getMeasuredTextSize () { _getMeasuredTextSize () {
console.log("get measured text size");
var style = this._style, var style = this._style,
lines = this._lines, lines = this._lines,
numLines = lines.length, numLines = lines.length,
@ -124,8 +122,7 @@ var PointText = TextItem.extend(/** @lends PointText# */{
numLines ? - 0.75 * leading : 0, numLines ? - 0.75 * leading : 0,
width, numLines * leading); width, numLines * leading);
}, },
_getVisibleTextSize () { _getDrawnTextSize () {
console.log("get visible text size");
var numLines = this._lines.length; var numLines = this._lines.length;
var leading = this._style.getLeading(); var leading = this._style.getLeading();