fix client rect calc for TextPath

This commit is contained in:
Anton Lavrenov 2016-10-31 10:50:16 -06:00
parent ece28c58a0
commit 3c26ba3bb5
3 changed files with 15 additions and 13 deletions

View File

@ -3,7 +3,7 @@
* Konva JavaScript Framework v1.2.2
* http://konvajs.github.io/
* Licensed under the MIT or GPL Version 2 licenses.
* Date: Fri Oct 28 2016
* Date: Mon Oct 31 2016
*
* Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
* Modified work Copyright (C) 2014 - 2015 by Anton Lavrenov (Konva)
@ -15385,7 +15385,7 @@
},
getSelfRect: function() {
var points = [];
var fontSize = this.fontSize();
this.glyphInfo.forEach(function(info) {
points.push(info.p0.x);
@ -15405,11 +15405,12 @@
minY = Math.min(minY, y);
maxY = Math.max(maxY, y);
}
var fontSize = this.fontSize();
return {
x: Math.round(minX) - fontSize,
y: Math.round(minY) - fontSize,
width: Math.round(maxX - minX) + fontSize * 2,
height: Math.round(maxY - minY) + fontSize * 2
x: Math.round(minX) - fontSize / 2,
y: Math.round(minY) - fontSize / 2,
width: Math.round(maxX - minX) + fontSize,
height: Math.round(maxY - minY) + fontSize
};
}
};

4
konva.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -387,7 +387,7 @@
},
getSelfRect: function() {
var points = [];
var fontSize = this.fontSize();
this.glyphInfo.forEach(function(info) {
points.push(info.p0.x);
@ -407,11 +407,12 @@
minY = Math.min(minY, y);
maxY = Math.max(maxY, y);
}
var fontSize = this.fontSize();
return {
x: Math.round(minX) - fontSize,
y: Math.round(minY) - fontSize,
width: Math.round(maxX - minX) + fontSize * 2,
height: Math.round(maxY - minY) + fontSize * 2
x: Math.round(minX) - fontSize / 2,
y: Math.round(minY) - fontSize / 2,
width: Math.round(maxX - minX) + fontSize,
height: Math.round(maxY - minY) + fontSize
};
}
};