mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Add comments about possible optimisations in PathItem#transformContent().
This commit is contained in:
parent
739c5a669f
commit
3af5d549f6
1 changed files with 8 additions and 0 deletions
|
@ -148,11 +148,19 @@ PathItem = Item.extend(new function() {
|
|||
transformContent: function(matrix, flags) {
|
||||
for (var i = 0, l = this._segments.length; i < l; i++) {
|
||||
var segment = this._segments[i];
|
||||
// We need to convert handles to absolute coordinates in order
|
||||
// to transform them.
|
||||
// TODO: Is transformation even required if they are [0, 0]?
|
||||
// TODO: Can we optimise this by using the matrix.transform()
|
||||
// version that takes arrays as in and output values, and just
|
||||
// modifying points rather than producing new ones? This would
|
||||
// consume less memory for sure.
|
||||
var point = segment.point;
|
||||
var handleIn = segment.handleIn.add(point);
|
||||
var handleOut = segment.handleOut.add(point);
|
||||
point = matrix.transform(point);
|
||||
segment.point = point;
|
||||
// Convert handles back to relative values after transformation
|
||||
segment.handleIn = matrix.transform(handleIn).subtract(point);
|
||||
segment.handleOut = matrix.transform(handleOut).subtract(point);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue