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 },
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('');
},

View file

@ -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 = {

View file

@ -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();