mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-08 05:42:07 -05:00
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:
parent
3a5aa466de
commit
6af787e475
1 changed files with 6 additions and 7 deletions
|
@ -876,12 +876,6 @@ var Path = this.Path = PathItem.extend({
|
||||||
};
|
};
|
||||||
}, new function() { // A dedicated scope for the tricky bounds calculations
|
}, 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) {
|
function getBounds(that, matrix, strokePadding) {
|
||||||
// Code ported and further optimised from:
|
// Code ported and further optimised from:
|
||||||
// http://blog.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html
|
// 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;
|
matrix = null;
|
||||||
first._transformCoordinates(matrix, prevCoords, false);
|
first._transformCoordinates(matrix, prevCoords, false);
|
||||||
var min = prevCoords.slice(0, 2),
|
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) {
|
function processSegment(segment) {
|
||||||
segment._transformCoordinates(matrix, coords, false);
|
segment._transformCoordinates(matrix, coords, false);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue