mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-22 07:19:57 -05:00
Use new dontLink parameter for Path.Constructors optimisations.
This commit is contained in:
parent
c9eb538f7a
commit
4dd90b440e
1 changed files with 8 additions and 8 deletions
|
@ -132,13 +132,13 @@ Path.inject({ statics: new function() {
|
||||||
rect = Rectangle.read(arguments, 0, 4);
|
rect = Rectangle.read(arguments, 0, 4);
|
||||||
size = Size.read(arguments, 4, 2);
|
size = Size.read(arguments, 4, 2);
|
||||||
}
|
}
|
||||||
size = Size.min(size, rect.getSize().divide(2));
|
size = Size.min(size, rect.getSize(true).divide(2));
|
||||||
var path = new Path(),
|
var path = new Path(),
|
||||||
uSize = size.multiply(kappa * 2),
|
uSize = size.multiply(kappa * 2),
|
||||||
bl = rect.getBottomLeft(),
|
bl = rect.getBottomLeft(true),
|
||||||
tl = rect.getTopLeft(),
|
tl = rect.getTopLeft(true),
|
||||||
tr = rect.getTopRight(),
|
tr = rect.getTopRight(true),
|
||||||
br = rect.getBottomRight();
|
br = rect.getBottomRight(true);
|
||||||
path._add([
|
path._add([
|
||||||
new Segment(bl.add(size.width, 0), null, [-uSize.width, 0]),
|
new Segment(bl.add(size.width, 0), null, [-uSize.width, 0]),
|
||||||
new Segment(bl.subtract(0, size.height), [0, uSize.height], null),
|
new Segment(bl.subtract(0, size.height), [0, uSize.height], null),
|
||||||
|
@ -176,13 +176,13 @@ Path.inject({ statics: new function() {
|
||||||
Oval: function(rect) {
|
Oval: function(rect) {
|
||||||
rect = Rectangle.read(arguments);
|
rect = Rectangle.read(arguments);
|
||||||
var path = new Path(),
|
var path = new Path(),
|
||||||
topLeft = rect.getTopLeft(),
|
point = rect.getPoint(true),
|
||||||
size = new Size(rect.width, rect.height),
|
size = rect.getSize(true),
|
||||||
segments = new Array(4);
|
segments = new Array(4);
|
||||||
for (var i = 0; i < 4; i++) {
|
for (var i = 0; i < 4; i++) {
|
||||||
var segment = ovalSegments[i];
|
var segment = ovalSegments[i];
|
||||||
segments[i] = new Segment(
|
segments[i] = new Segment(
|
||||||
segment._point.multiply(size).add(topLeft),
|
segment._point.multiply(size).add(point),
|
||||||
segment._handleIn.multiply(size),
|
segment._handleIn.multiply(size),
|
||||||
segment._handleOut.multiply(size)
|
segment._handleOut.multiply(size)
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue