Move access to Numerical.TOLERANCE out of the injection scope into getBounds(), so util files can be included at the end of the library again.

This commit is contained in:
Jürg Lehni 2011-05-07 11:23:46 +01:00
parent 3a5aa466de
commit 6af787e475

View file

@ -876,12 +876,6 @@ var Path = this.Path = PathItem.extend({
};
}, new function() { // A dedicated scope for the tricky bounds calculations
// Add some tolerance for good roots, as t = 0 / 1 are added seperately
// anyhow, and we don't want joins to be added with radiuses in
// getBounds()
var tMin = Numerical.TOLERANCE,
tMax = 1 - tMin;
function getBounds(that, matrix, strokePadding) {
// Code ported and further optimised from:
// http://blog.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html
@ -896,7 +890,12 @@ var Path = this.Path = PathItem.extend({
matrix = null;
first._transformCoordinates(matrix, prevCoords, false);
var min = prevCoords.slice(0, 2),
max = min.slice(0); // clone
max = min.slice(0), // clone
// Add some tolerance for good roots, as t = 0 / 1 are added
// seperately anyhow, and we don't want joins to be added with
// radiuses in getStrokeBounds()
tMin = Numerical.TOLERANCE,
tMax = 1 - tMin;
function processSegment(segment) {
segment._transformCoordinates(matrix, coords, false);