Jürg Lehni
90e3dd201a
Move boolean code into its own file, and add information comments again.
2013-05-03 16:16:52 -07:00
hkrish
d9d86f4ff7
Merge branch 'master' of https://github.com/paperjs/paper.js
...
* 'master' of https://github.com/paperjs/paper.js :
Undo recent change to Curve#getIntersection() since it breaks some boolean operations.
ý5:q
2013-05-03 19:24:03 +02:00
hkrish
e75cc32a3b
Merge branch 'master' of https://github.com/paperjs/paper.js
...
* 'master' of https://github.com/paperjs/paper.js :
Undo recent change to Curve#getIntersection() since it breaks some boolean operations.
ý5:q
2013-05-03 19:24:03 +02:00
Jürg Lehni
9e3b7eef50
Undo recent change to Curve#getIntersection() since it breaks some boolean operations.
2013-05-02 11:32:24 -07:00
Jürg Lehni
840e879ba8
Undo recent change to Curve#getIntersection() since it breaks some boolean operations.
2013-05-02 11:32:24 -07:00
hkrish
debce28bc4
Merge upstream
2013-05-02 14:18:24 +02:00
hkrish
10553c1bd8
Merge upstream
2013-05-02 14:18:24 +02:00
hkrish
381ee98cbc
Updated boolean operation methods.
...
The algorithm is based on paperjs' native segment and curve objects
rather than the generic Node and Link objects.
Also this is much smaller and faster! :)
2013-05-02 13:49:07 +02:00
hkrish
73b018f006
Updated boolean operation methods.
...
The algorithm is based on paperjs' native segment and curve objects
rather than the generic Node and Link objects.
Also this is much smaller and faster! :)
2013-05-02 13:49:07 +02:00
Jürg Lehni
f425c931a8
Improve Curve#getIntersections() by avoiding further subdivision of flat curves.
2013-05-01 18:40:57 -07:00
Jürg Lehni
e8fed1bdf0
Improve Curve#getIntersections() by avoiding further subdivision of flat curves.
2013-05-01 18:40:57 -07:00
Jürg Lehni
023c8b0432
Fix issue with recursive call of Curve.getIntersections().
2013-05-01 18:24:54 -07:00
Jürg Lehni
c61e8d57b9
Fix issue with recursive call of Curve.getIntersections().
2013-05-01 18:24:54 -07:00
hkrish
934ec8df7e
Fix: Update the getIntersections method signature in recursive calls
2013-05-01 13:29:02 +02:00
hkrish
f239a3980d
Fix: Update the getIntersections method signature in recursive calls
2013-05-01 13:29:02 +02:00
hkrish
d8dc762826
Merge branch 'master' of https://github.com/paperjs/paper.js
...
* 'master' of https://github.com/paperjs/paper.js :
Define CurveLocation#intersection as a way to retrieve the CurveLocation on the intersecting path when using Path#getIntersections().
ý5ý`qkb:q
2013-05-01 12:39:04 +02:00
hkrish
88b720be76
Merge branch 'master' of https://github.com/paperjs/paper.js
...
* 'master' of https://github.com/paperjs/paper.js :
Define CurveLocation#intersection as a way to retrieve the CurveLocation on the intersecting path when using Path#getIntersections().
ý5ý`qkb:q
2013-05-01 12:39:04 +02:00
Jürg Lehni
69f8bdc560
Define CurveLocation#intersection as a way to retrieve the CurveLocation on the intersecting path when using Path#getIntersections().
2013-04-30 18:41:26 -07:00
Jürg Lehni
883e3ad563
Define CurveLocation#intersection as a way to retrieve the CurveLocation on the intersecting path when using Path#getIntersections().
2013-04-30 18:41:26 -07:00
hkrish
30d9e322e8
Boolean Operations.
...
This is probably a crude integration. Need to resolve some issues,
such as finding the right place for constants, private classes etc.
2013-04-29 21:36:12 +02:00
hkrish
b4dd16bbfb
Boolean Operations.
...
This is probably a crude integration. Need to resolve some issues,
such as finding the right place for constants, private classes etc.
2013-04-29 21:36:12 +02:00
Jürg Lehni
c7ab32c501
Rearrange linear curve conditions.
2013-04-26 14:37:37 -07:00
Jürg Lehni
c513a24f46
Handle intersection between linear curves without recursive subdivision.
...
Closes #207 .
2013-04-26 14:31:42 -07:00
Jürg Lehni
06ffd8089d
Fix issue in Path#removeSegments() where curves are removed wrongly when start index is 0.
...
Closes #200 .
2013-04-26 08:46:57 -07:00
Jürg Lehni
74f6a93b33
Optimize Curve.getArea().
2013-04-25 17:47:11 -07:00
Jürg Lehni
898e216668
Implement Path#getArea() and CompoundPath#getArea().
2013-04-25 17:37:19 -07:00
Jürg Lehni
80a1129eab
Consistently use 'this' rather than 'Curve'.
2013-04-25 17:19:00 -07:00
Jürg Lehni
1b5ca4dec9
Rename Curve._addIntersections() to Curve.getIntersections()
2013-04-25 17:17:53 -07:00
Jürg Lehni
eaa6e3bb6b
Improve Curve#getCrossings() documentation and code.
2013-04-25 11:08:50 -07:00
Jürg Lehni
d7e075d316
Handle contour edge cases in Path#contains().
...
Closes #208 .
2013-04-25 11:03:49 -07:00
Jürg Lehni
edfd8f53de
Remove accidentally committed debugging code.
2013-04-24 19:28:46 -07:00
Jürg Lehni
c70b9e7d7d
Fix issue with Path#strokeBounds with #strokeJoin == 'miter' and clockwise orientation.
...
Closes #206 .
2013-04-24 19:27:31 -07:00
Jürg Lehni
69512ac396
Simplify and document Segment#_serialize().
2013-04-23 07:39:31 -07:00
Jürg Lehni
0c114883e1
Add unique ids to CurveLocation.
2013-04-22 19:11:42 -07:00
Jürg Lehni
dc9a9c42d2
Cleanup solveCubic() further.
2013-04-21 08:44:41 -07:00
Jürg Lehni
2fc4ff10ee
Implement Item#_contains() with local coordinates, and have Item#contains() take Item#matrix into account.
2013-04-21 08:43:05 -07:00
Jonathan Puckey
3136480e5e
Clean up Segment object constructor example.
2013-04-21 16:02:26 +02:00
Jonathan Puckey
52e7c39567
Improve Curve documentation.
2013-04-21 15:43:57 +02:00
Jonathan Puckey
fdd367e1c2
Add titles to Path.Constructors documentation examples.
2013-04-21 13:58:22 +02:00
Jonathan Puckey
a5997dcc24
Add example to Item#contains(point) docs.
2013-04-21 13:56:29 +02:00
Jonathan Puckey
daf8d0f881
Rename 'properties' constructor parameter to 'object' in docs.
2013-04-21 13:54:31 +02:00
Jürg Lehni
db7eb65bd7
Implement Item#contains() and use it for hit-testing Rasters.
2013-04-20 20:41:52 -07:00
Jürg Lehni
bb03c72ce8
Implement Item#hasFill().
2013-04-20 20:40:20 -07:00
Jürg Lehni
c45ad26b67
Remove tolerance parameter from solveCubic() / solveQuadratic() since we should always use EPSILON.
2013-04-20 19:58:42 -07:00
Jürg Lehni
14aa8e5dea
Improve precision of Numerical.solveCubic() and fix issues in Curve.getCrossings().
...
Closes #202 .
2013-04-20 19:14:19 -07:00
Jürg Lehni
461def5383
Fix issue with imprecise tangents / normals to curves at t = 0, 1.
2013-04-20 17:40:19 -07:00
Jürg Lehni
1952e3dc7d
Implement Curve#getCurvatureAt().
2013-04-20 17:26:51 -07:00
Jürg Lehni
bcb10a222f
Add SvgImport example for Inkscape and fix issue with multiple SVG path commands.
...
Closes #203 .
2013-04-20 14:54:21 -07:00
Jürg Lehni
e1807214f4
Large refactoring of Style handling for notable speed improvements.
2013-04-19 19:31:29 -07:00
Jürg Lehni
bf9acd4499
Correct Numerical.KAPPA value.
2013-04-19 18:57:31 -07:00
Jürg Lehni
9da392a99c
Commit initial support for Shape class.
...
Hit testing is still missing.
2013-04-19 17:25:50 -07:00
Jürg Lehni
90f2614d52
Export Numerical object and move KAPPA constant there.
2013-04-19 17:03:41 -07:00
Jürg Lehni
67203e753c
Move #applyMatrix setting to PathItem.
2013-04-19 13:16:00 -07:00
Jürg Lehni
8d99aa5f95
Handle color transformation in Item#transform() rather than Path#_applyMatrix().
...
Fixes an issue with BoucingBalls.html, now that CompoundPath#applyMatrix is true.
2013-04-19 13:13:54 -07:00
Jürg Lehni
9efbc288a1
Merge Path.Rectangle and Path.RoundRectangle.
2013-04-19 12:36:49 -07:00
Jürg Lehni
922b9b5bd0
Rename _cloning parameter to _preserve.
2013-04-19 11:54:16 -07:00
Jürg Lehni
2e265693ff
Make #drawSelected() protected.
2013-04-18 17:50:53 -07:00
Jürg Lehni
9ee8590a4d
Move Item.draw() to Item#draw().
...
Makes more sense this way.
2013-04-18 17:04:06 -07:00
Jürg Lehni
d23e21edd7
Make Item#draw() protected, so we know to not directly call it.
2013-04-18 16:58:35 -07:00
Jürg Lehni
1333f59d54
Have CompoundPath always apply transformations by default.
2013-04-18 16:22:21 -07:00
Jürg Lehni
9fe1ff951a
Clean up code.
2013-04-09 20:36:38 -07:00
Jürg Lehni
7f245974e6
Implement a faster method to filter out beginnings of intersected curves.
2013-04-09 20:35:31 -07:00
Jürg Lehni
a9a0857ba4
Find a better strategy to avoid duplicate solutions in PathItem#getIntersections().
...
Closes #197 .
2013-04-09 20:27:55 -07:00
Jürg Lehni
0f19e72733
Minor tweaks.
2013-04-09 19:12:47 -07:00
Jürg Lehni
b55d89acda
Move handling of clipping outside of draw function, so canvas context can correctly be saved and restored for clipping paths too.
2013-04-09 19:08:41 -07:00
Jürg Lehni
fbe8a558bd
Refactor Format literal to Formatter class that keeps precision stored.
2013-04-09 17:32:19 -07:00
Jürg Lehni
9b50020721
Check for gradient Colors correctly.
2013-04-09 08:35:42 -07:00
Jürg Lehni
d3bb68d0e0
Use faster Array construction.
2013-04-09 07:55:09 -07:00
Jürg Lehni
218732e320
Implement a row of simple optimizations to increase performance of Item constructors.
2013-04-07 17:36:09 -07:00
Jürg Lehni
fa143ad545
Fix typo.
2013-04-07 09:49:34 -07:00
Jürg Lehni
a0b903e49c
Simply call slice() instead of slice(0).
2013-04-06 18:39:17 +02:00
Jürg Lehni
18ed9010a6
Derive Item#type from Item#_class and use that instead in code that depends on Item types.
2013-04-06 18:07:30 +02:00
Jürg Lehni
f43b322d2a
Rename Base#_type property to #_class.
2013-04-06 09:16:08 +02:00
Jürg Lehni
cb62c6053a
Switch back to persistence of segments for good.
2013-04-05 17:34:09 +02:00
Jürg Lehni
1392f87d85
Switch back to serializing segment lists for now, so we can fix other failing tests.
2013-03-19 18:48:59 -07:00
Jürg Lehni
5ff911f68c
Have Path#closePath() handle merging of first and last segment, if doubled.
...
So we finally found a reason for #closePath() to stick around :)
2013-03-19 18:47:18 -07:00
Jürg Lehni
3f634f6420
Use same precision in Path#getPathData() as everywhere else.
2013-03-19 16:23:36 -07:00
Jürg Lehni
e854254986
Insert linear segments when dividing linear curves.
2013-03-19 16:17:12 -07:00
Jonathan Puckey
e3760afecd
Fix handling of param.clip in CompoundPath#draw.
2013-03-17 22:27:20 +01:00
Jonathan Puckey
e5c32b9520
Actually fix handling of param.clip in Path#draw.
2013-03-17 21:59:07 +01:00
Jonathan Puckey
4c4258d2e1
Fix Raster#getAverageColor by having Path#draw clip the context, when param.clip is true.
2013-03-17 21:41:46 +01:00
Jonathan Puckey
4b87860b30
Add documentation of Path#getLocationOf
2013-03-16 18:39:53 +01:00
Jonathan Puckey
6f490d8b34
Add documentation for Path#split.
2013-03-16 17:59:31 +01:00
Jonathan Puckey
2d9b0b2e8e
Improve Path documentation.
2013-03-10 19:48:46 +01:00
Jonathan Puckey
4292b90bd4
Improve Segment documentation.
2013-03-10 19:48:28 +01:00
Jonathan Puckey
38b9b327ae
Add Path.Constructor examples.
2013-03-10 19:09:09 +01:00
Jonathan Puckey
177f799bde
Rename Path.Star parameter from numPoints to points.
2013-03-10 18:09:05 +01:00
Jonathan Puckey
097a9c958f
Rename Path.RegularPolygon parameter from numSides to sides.
2013-03-10 18:02:16 +01:00
Jürg Lehni
97e85d66db
Fix issue with object literal properties being accidentally misread as path segments.
...
Closes #177 .
2013-03-05 00:28:21 -08:00
Jonathan Puckey
2666e60f28
Fix Path#getTangentAt example.
2013-03-04 12:37:55 +01:00
Jonathan Puckey
2d103dd792
Improve and fix example documentation.
2013-03-04 12:09:58 +01:00
Jürg Lehni
849d3efc2e
Have PathItem#setPathData() clear the previous content.
2013-03-03 16:56:48 -08:00
Jürg Lehni
8a69fcd1e5
Actually use precision setting in Path#getPathData().
2013-03-03 16:51:31 -08:00
Jürg Lehni
7b7168feb1
Fix reading of rectangle in Path.Constructor.
...
And all tests are green again.
2013-03-03 15:29:15 -08:00
Jonathan Puckey
7643085378
Path example documentation.
2013-03-03 20:48:03 +01:00
Jonathan Puckey
fa861f2047
Improve example documentation.
2013-03-03 20:10:25 +01:00
Jonathan Puckey
801eb0f2a8
Add example to Segment#selected docs.
2013-03-03 20:09:41 +01:00
Jonathan Puckey
3cdb11fe36
GradientStop & PathItem example documentation.
2013-03-03 19:47:32 +01:00
Jonathan Puckey
09e4bd0bb4
Improve Path.Constructors example documentation.
2013-03-03 18:34:39 +01:00
Jürg Lehni
1bfafee0ca
Use a default precision of three digits for exporting path data.
2013-03-02 08:14:17 -08:00
Jürg Lehni
67b1a602c4
Fix hit-testing of open filled Paths when they are part of a CompoundPath.
2013-03-01 21:47:13 -08:00
Jürg Lehni
936b1bccbb
Get curves uncached in CurveLocation#split() and #divide().
2013-03-01 20:26:03 -08:00
Jürg Lehni
03521796ef
Setting Path#selected to false should deselect all handles too.
2013-03-01 20:25:09 -08:00
Jürg Lehni
dfe1a7efab
Define setter for Segment#linear.
2013-03-01 20:24:46 -08:00
Jürg Lehni
2230c2888d
Fix issue with Curve#divide() where the wrong curve reference is returned.
2013-03-01 20:19:44 -08:00
Jürg Lehni
532176ac62
Fix drawing of selected handles.
2013-03-01 18:32:55 -08:00
Jürg Lehni
c543704115
Define Project#options as a way to configure things.
...
For now, only options.handleSize is in use.
2013-03-01 18:28:22 -08:00
Jürg Lehni
f0593c1fb9
Fix error with #getPathData() and empty paths.
2013-03-01 17:46:55 -08:00
Jürg Lehni
3f5d0a6925
Merge constructor._name with _type and use CamelCase for Item types.
2013-03-01 17:13:22 -08:00
Jürg Lehni
7553712e35
Simplify code for readRectangle() in Path.Constructors.
2013-03-01 14:39:26 -08:00
Jürg Lehni
3f85dcdb77
Use #_set() in Rectangle#initialize() to simplify code and increase flexibility.
2013-03-01 14:37:27 -08:00
Jürg Lehni
8d2c2f5fda
Fix an issue with PathFitter where path with only one segment would throw an error.
...
Closes #175 .
2013-03-01 14:28:32 -08:00
Jürg Lehni
7405858f32
Simplify code for reading of named arguments, removing the need for filtering arguments by using 'in' checks instead for the presence of properties / setters.
2013-03-01 14:06:04 -08:00
Jürg Lehni
06e33ba412
Improve flexibility of reading rectangles in Path.Constructor.
...
We can now define the rectangle by any property that it has setters for.
2013-03-01 13:52:11 -08:00
Jürg Lehni
12d4d563d9
Further shorten path data code.
2013-03-01 01:18:42 -08:00
Jürg Lehni
13a567bcaa
Fix handling of multiple h / v commands in path data.
2013-03-01 01:18:27 -08:00
Jürg Lehni
b649240696
Use correct defaults for #pathData serialization.
2013-02-28 19:55:18 -08:00
Jürg Lehni
cef30f9dd1
Switch to #pathData for JSON serialization of Path and CompoundPath.
2013-02-28 19:41:13 -08:00
Jürg Lehni
5fbc6e939d
Fix small SVG path-data parser issue.
2013-02-28 19:33:08 -08:00
Jürg Lehni
82cefa9846
Fix typo.
2013-02-28 19:29:44 -08:00
Jürg Lehni
0f140e391d
Minor clean ups.
2013-02-28 19:21:46 -08:00
Jürg Lehni
78b3621cf6
Implement PathItem#pathData getter and setter for SVG style path data.
...
And use it fro SvgImport too.
2013-02-28 19:14:06 -08:00
Jürg Lehni
9d8cddbe42
Implement new private Format object that handles formatting of number, point, size and rectangle.
2013-02-28 19:14:05 -08:00
Jürg Lehni
79e836373d
Clean up hitTest code a little.
2013-02-25 15:41:31 -08:00
Jürg Lehni
cd9184a6f0
Fix CompoundPath hit-testing.
2013-02-24 19:01:29 -08:00
Jürg Lehni
6b7c6b6c4c
Implement Item#bounds.selected to control drawing of selected item bounds.
2013-02-24 15:41:31 -08:00
Jürg Lehni
0a81787c7e
Fix a bug in CompoundPath#hitTest().
...
Results from Path#hitTest() were not passed through.
2013-02-24 14:56:28 -08:00
Jürg Lehni
119e5acbf9
Move #_setProperties() and #set() from Item to Base, rename it to #_set and use it for Tool too.
2013-02-15 18:28:49 -08:00
Jürg Lehni
23b51915eb
Implement CompoundPath#firstSegment, #lastSegment, #firstCurve and #lastCurve.
2013-02-15 18:05:16 -08:00
Jürg Lehni
d3ccec2256
Use the code from Group#isEmpty() and CompoundPath#isEmpty() for Item#isEmpty(), since any item that does not have children overrides it.
2013-02-15 18:01:23 -08:00
Jürg Lehni
24d467e292
Implement support for native dash strokes, through both setLineDash() and mozDash.
2013-02-12 15:32:21 -08:00
Jürg Lehni
fdd15e675f
Add options argument to #toJson() methods, and use to implement optional fractional digit precision control.
2013-02-12 14:57:54 -08:00
Jürg Lehni
489a785171
Override Item.extend() to merge the subclass' _serializeFields with the parent class' _serializeFields.
...
And have style fields always serialized in non-compact form for Color.
2013-02-11 17:08:23 -08:00
Jürg Lehni
b10454a83c
Rename Matrix#createInverse() to #inverted() and #createShiftless() to #shiftless().
2013-02-09 12:18:40 -08:00
Jürg Lehni
bc5826d324
Clean up code.
2013-02-08 18:46:22 -08:00
Jürg Lehni
dc35fdbd02
Move named inner functions out of nested scopes, to prepare for 'use strict;' transition.
2013-02-08 18:23:33 -08:00
Jürg Lehni
1ee29d56ac
Improve comment about JavaScriptCore bug.
2013-02-08 16:35:33 -08:00
Jürg Lehni
b6d2d83af5
Fix the strangest JavaScriptCore bug that I've encountered in ages.
...
Closes #168 . Read comment for more details.
2013-02-08 16:32:47 -08:00
Jürg Lehni
02ca95eb46
Avoid accidental global leakage.
2013-02-08 16:12:57 -08:00
Jürg Lehni
6c9c16ad3d
Update copyright information comments, and year.
2013-01-28 18:03:27 -08:00
Jürg Lehni
b0deda9445
Add missing documentation for various location related functions on Curve.
2013-01-28 16:47:45 -08:00
Jürg Lehni
c7d8aebb9e
Swap Curve's bounds scope with point evaluation scope, for proximity to bounds related methods in scope before.
2013-01-28 16:32:04 -08:00
Jürg Lehni
1a438b8b9b
Change Curve#[getPoint / getTangent / getNormal](t) to #[getPoint / getTangent / getNormal](offset, isParamter).
...
Keep deprecated versions around for now.
2013-01-28 16:30:28 -08:00
Jürg Lehni
e75ee18de1
Restructure code a bit.
2013-01-22 14:58:34 -08:00
Jürg Lehni
a5bfa9e5d3
Remove debug logging for Segment / Curve insertion, deletion and splitting.
2013-01-22 14:54:19 -08:00
Jürg Lehni
f09bc84a12
Implement correct handling of Curves / Segments synchronization, improve CurveLocation linking to Curves through their linked Segments, and preserve Curves in Path#split() calls.
2013-01-22 14:46:49 -08:00
Jürg Lehni
e4d98f7865
Add internal _cloning parameter to all insertion methods.
2013-01-20 16:14:30 -08:00
Jürg Lehni
677ea374c5
Only change #clockwise on closed Paths when inserting into CompoundPaths.
2013-01-20 15:48:06 -08:00
Jürg Lehni
c5ede2e955
Add support for _setProperties() to CompoundPath constructor.
2013-01-20 15:20:10 -08:00
Jürg Lehni
ba5aa86411
Include Roger Willcocks in the thanks regarding isSufficentlyFlat.
2013-01-20 14:28:02 -08:00
Jürg Lehni
4346563fe4
No need to merge Path#_serializeFields, simply keep in sync with Item#_serializeFields (excluding #children).
2013-01-20 14:01:43 -08:00
Jürg Lehni
b05a21d6c9
Fix bug in Curve#getLocationOf().
2013-01-20 14:01:42 -08:00
Jürg Lehni
49c8f8b6b5
A couple of improvements on Path#split().
2013-01-20 14:01:42 -08:00
Jürg Lehni
b04eb2b98f
Implement Path#split() and Curve#split().
2012-12-31 22:28:41 +01:00
Jürg Lehni
d2b799f4db
Fix various issues with Path#curves synchronization.
2012-12-31 22:21:50 +01:00
Jürg Lehni
f0038465cc
Fix clearing of removed segments.
2012-12-31 21:45:30 +01:00
Jürg Lehni
a10e44d601
Minor code clean-up.
2012-12-31 21:43:43 +01:00
Jürg Lehni
8cea919dbd
Calculate CurveLocation#parameter uncached when dealing with dividing or splitting, since these commands alter the underlying Path.
2012-12-31 21:42:55 +01:00
Jürg Lehni
5a2be6d545
No need for chainable functions on Item types.
2012-12-31 21:42:14 +01:00
Jürg Lehni
d509f86e1a
Fix issue where removing segments from open paths would correct curves wrongly.
2012-12-31 21:19:55 +01:00
Jürg Lehni
5da4e89672
Return 'this' in more places to facilitate chained calls inside the library.
2012-12-31 20:07:28 +01:00
Jürg Lehni
8ec8af4dc5
Define CurveLocation#divide().
2012-12-30 19:53:09 +01:00
Jürg Lehni
e066db4577
Implement Curve#divide().
2012-12-30 19:49:17 +01:00
Jürg Lehni
4185b63d99
Und recent renaming of #getNearest*() methods.
2012-12-30 19:43:35 +01:00
Jürg Lehni
4ab9a942b0
Clean up Path.Constructor code.
2012-12-30 18:33:46 +01:00
Jürg Lehni
a1fc86b19e
Add forgotten passing on of arguments._filtered.
2012-12-30 18:29:01 +01:00
Jürg Lehni
4e20a5794f
Remove debug logging.
2012-12-30 18:27:42 +01:00
Jürg Lehni
8bed8cb15d
Define mechanism for flexible reading of named arguments through Base.readNamed() and Base.hasNamed(), and use it to implement property object literal versions of Path.Constructor code.
2012-12-30 18:24:33 +01:00
Jürg Lehni
2abefee336
Merge Base.readValue() with Base.read() and rename Base.peekValue() to Base.peek().
...
When called directly on Base, read() reads values, otherwise the specific type of the subclass it is called on.
2012-12-30 16:07:20 +01:00
Jürg Lehni
1b539301ad
Find a better naming convention for the various getLocation* methods (*At for offsets / parameters, *Of for points), implement the missing methods on Curve and use them in Path.
2012-12-27 21:08:03 +01:00
Jürg Lehni
231369fa01
Shorten code a bit, using loops.
2012-12-27 20:46:12 +01:00
Jürg Lehni
cb8f3291d3
Clean up some comments.
2012-12-27 20:19:23 +01:00
Jürg Lehni
5b9d33f32e
Fix imprecision in intersection code by re-introducing tolerance parameter in Curve#isFlatEnough().
2012-12-27 20:13:45 +01:00
Jürg Lehni
3c4978eb04
Rename Curve#getParameter(point) to Curve#getParameterOf(point), to better distinguish from Curve#getParameterAt(length).
2012-12-27 20:09:21 +01:00
Jürg Lehni
00898908d3
Write documentation for PathItem#getIntersections().
2012-12-27 19:26:40 +01:00
Jürg Lehni
68ad4bb5ba
Implement PathItem#getIntersections(path) and Curve#getIntersections(curve) using divide-and-conquer approach, and new Curve.getBounds().
2012-12-27 19:23:03 +01:00
Jürg Lehni
03b5d58e79
Merge branch 'refs/heads/master' into intersection
2012-12-27 18:43:43 +01:00
Jürg Lehni
75596e1d03
Move a part of Path.getBounds() code into Curve._addBounds(), and use it to also define Curve.getBounds().
2012-12-27 18:38:55 +01:00
Jürg Lehni
57a9f4fc91
Use constant substitution for Numerical constants as well.
2012-12-27 18:36:59 +01:00
Jürg Lehni
050ca1dcb1
Further clean up Path.getBounds() code.
2012-12-27 17:43:21 +01:00
Jürg Lehni
3a1f2eec3f
Restructure Path#getBounds() code so Curve bounds calculations can be moved to Curve.
2012-12-27 15:19:42 +01:00
Jürg Lehni
2673991620
Have Path#_serializeFields inherit from Item#_serializeFields.
2012-12-27 13:04:38 +01:00
Jürg Lehni
f45c04a359
Remove overridden Path#matrix getters and setters, since we now control behavior through #applyMatrix.
2012-12-27 13:04:07 +01:00
Jürg Lehni
4f83e0eee6
Commit first version of serialization / deserialization mechanism.
...
It appears to work fine already for Paths and Groups.
2012-12-27 12:45:55 +01:00
Jürg Lehni
ae4e5d4be5
Rename Item#setProperties() to hidden #_setProperties() and add public Item#set() to use same functionality from outside.
2012-12-27 00:52:09 +01:00
Jürg Lehni
3ac039bd66
Implement properties object literal initialization for all Item constructors.
2012-12-25 22:12:25 +01:00
Jürg Lehni
947afe85f0
Simplify Path#initialize() code.
2012-12-25 16:59:05 +01:00
Jürg Lehni
8f093f6dd7
Remove all PORT comments, since we won't port back features to Scriptographer.
2012-12-25 16:07:48 +01:00
Jürg Lehni
b54bdadaff
Rename Item#transformContent to #applyMatrix.
2012-12-24 17:39:24 +01:00
Jürg Lehni
d6fceb928f
Implement Item#transformContent property, which controls wether Item#transform() directly applies transformations to contents, or simply stores them in Item#matrix.
2012-12-24 00:39:42 +01:00
Jürg Lehni
e21ea457a7
Remove Item#apply() and clean up #applyMatrix() and simplify handling.
2012-12-24 00:29:09 +01:00
Jürg Lehni
734cc1cc61
Undo commit 4445376c0204cb5a2e408c64b77a5b6fa09305ba since it clashes with magnification.
2012-12-21 16:41:57 +01:00
Jürg Lehni
c025c41ec0
Start implementing PathItem#getIntersections().
2012-12-21 16:13:38 +01:00
Jürg Lehni
d43cc28aac
Optimise Curve constructors that construct from 4 arguments (points) and 8 (coordinate values).
2012-12-20 18:03:11 +01:00
Jürg Lehni
e10ef4dba3
Fix comment.
2012-12-19 03:22:57 +01:00
Jürg Lehni
22ddd7a37e
Implement CompoundPath#curves.
2012-12-18 14:53:38 +01:00
Jürg Lehni
29a2bc781b
Implement the various bounds getter on Curve too, using caching and the new static Path.get*Bounds methods.
2012-12-18 14:35:21 +01:00
Jürg Lehni
4de5f30f72
Improve documentation.
2012-12-18 14:19:22 +01:00
Jürg Lehni
b535d9f843
Implement new Bootstrap feature that allows hiding of getter parameters to make sure beans are produced, and use it across the library.
2012-12-15 19:51:31 +01:00
Jürg Lehni
5a316c244b
Directly expose bounds methods as statics rather than using a private scope.
2012-12-15 08:27:37 -08:00
Jürg Lehni
0d2ed108e2
Refactor getBounds code so that functionality can be exposed as static methods on Path.
2012-12-15 08:19:10 -08:00
Jürg Lehni
021009abbc
Shorten Path#getBounds() code by using Numerical.solveQuadratic().
2012-12-15 07:58:20 -08:00
Jürg Lehni
09ee9a0689
Exclude 1 in parameter range for crossing counting, as segment points would be counted twice otherwise.
2012-12-15 02:27:36 -08:00
Jürg Lehni
16578e6b15
Clean up code.
2012-12-15 02:24:46 -08:00
Jürg Lehni
a36d244eb1
Handle impression in Curve#getCrossings(), causing wrong results when handling circles.
2012-12-15 01:52:23 -08:00
Jürg Lehni
9a7f72e163
Clean up getBounds code a bit, by using less local variables and more explicit variable names.
2012-12-14 21:40:25 -08:00
Jürg Lehni
2061cb0517
Fix Path#contains() for unclosed paths that have a fill color.
2012-12-14 21:39:47 -08:00
Jürg Lehni
9d8bf12028
Never return null from #getBounds.
2012-12-09 18:00:23 -08:00
Jürg Lehni
d16155f4fe
Fix CompoundPath#clone() so that it does not alter the #clockwise state on its children.
2012-12-01 11:31:03 -08:00
Jürg Lehni
f14b685c1d
Use #_type comparisson rather than slower instanceof operator wherever we can.
2012-12-01 11:17:09 -08:00
Jürg Lehni
ace1d0f441
No need to set _clockwise since #reverse() already does so.
2012-12-01 11:10:59 -08:00
Jürg Lehni
d0cc8b6c16
Fix issue with hit-testing filled paths that are not closed.
2012-11-28 22:13:31 -08:00
Jürg Lehni
4d51173881
Keep Path#curves in sync properly when removing the last segment of an open path.
...
Closes #138 .
2012-11-23 13:58:13 -08:00
Jürg Lehni
61b6026361
Rename CompoundPath#flatten() to #reduce(), to avoid clash with Path#flatten().
2012-11-23 01:16:21 -08:00
Ben Firshman
8ca26f650a
Fixed leaky _handle2
2012-11-20 15:53:31 +00:00
Ben Firshman
73d6c102a6
Fix k leaking into globals
2012-11-20 15:53:04 +00:00
Ben Firshman
dc1161b32a
Fix fullLength leaking into globals
2012-11-20 15:53:03 +00:00
Jürg Lehni
d671a08205
Introduce Base.toFloat() and rename Base.formatNumber() to Base.formatFloat()
2012-11-14 01:31:08 -08:00
Jürg Lehni
e9a9066d7f
Use group creation without explicit array declaration, as that's been supported all along.
2012-11-06 20:37:50 -08:00
Jürg Lehni
1cb6a7fc3c
Clean up Path#smooth() code a bit.
2012-11-06 20:18:59 -08:00
Jürg Lehni
f110038104
Improve clipping mask drawing, and remove some unneeded ctx.save() / ctx.restore() calls.
2012-11-06 20:14:21 -08:00
Jürg Lehni
4b6207bdb6
Do not allow adding of items other than paths to CompoundPath.
2012-11-06 14:01:52 -08:00
Jürg Lehni
28642bd1c8
Rename Path.Oval() to Path.Ellipse(), and deprecate Path.Oval().
2012-11-06 11:37:00 -08:00
Jürg Lehni
fd8fe9c08e
Rename CompoundPath#simplify() to #flatten() to avoid clashes with Path#simplify(), and add Path#flatten(), returning itself.
2012-11-06 10:16:03 -08:00
Jonathan Puckey
33c13b36a3
Fix drawing of groups where a compound path is used as a clip mask.
2012-11-06 18:07:51 +01:00
Jürg Lehni
4c51544b6e
Implement correct checks for primitives (rect, ellipse, circle).
2012-11-06 01:22:16 -08:00
Jürg Lehni
64b9daacd0
Code clean-up.
2012-11-05 21:06:56 -08:00
Jürg Lehni
6e0f29bf4a
Rename Path#closed getter to #isClosed() instead of #getClosed().
2012-11-05 21:06:47 -08:00
Jürg Lehni
400b454177
Introduce Numerical.isZero(), for comparisons against 0 with a tolerance.
2012-11-05 21:06:13 -08:00
Jürg Lehni
35568c15f2
Implement transparent constant-substitution in prepro.js to shave of some extra bytes of final distribution file.
2012-11-05 18:11:44 -08:00
Jürg Lehni
1050e3314e
Implement Segment#isLinear() and Path#isPolygon().
2012-11-04 00:03:49 -07:00
Jürg Lehni
19d145f281
Introduce Item#type, returning a simple item type string identifier.
2012-11-03 23:43:18 -07:00
Jürg Lehni
6ed1d67ada
Modernize Bootstrap.js, introduce Base.create() and use it instead of the Constructor.dont hack for object creation without the calling of initialize.
2012-11-03 21:49:37 -07:00
Jürg Lehni
07c0b6ce6a
Improve Path#moveTo behavior()
...
Allowing it to be called multiple times before any other drawing commands.
2012-11-03 19:45:02 -07:00
Jürg Lehni
1ce332756e
Rename ImportSvg to SvgImporter, and ExportSvg to SvgExporter.
2012-11-02 17:40:07 -07:00
Jürg Lehni
ab02023adf
Do not create extra points when asked to produce a round rectangle with no radius.
2012-11-02 17:04:21 -07:00
Jürg Lehni
b22ff5ecca
Revert a recent change in selection handling.
2012-11-02 16:27:59 -07:00
Jürg Lehni
f6f80e4061
Implement CompoundPath#contains() and #hitTest() correctly.
...
And change the way that styles are stored on CompoundPaths: Not in the first child but in the item itself.
2012-10-22 18:48:51 -04:00
Jürg Lehni
f73717a7e7
Fix issues in Numerical.solveQuadratic(), solveCubic() and Path#contains().
...
Closes #71 .
2012-10-22 18:21:33 -04:00
Jürg Lehni
317fcf5432
Only include strokeWidth in roughBounds if a strokeColor is actually set.
2012-10-20 16:01:53 -04:00
Jürg Lehni
f87eadecda
Correct default value for clockwise in arcTo().
2012-10-19 09:18:10 -04:00
Jürg Lehni
6441a682a8
Fix new error in quadraticCurveTo().
...
We don't seem to have test-cases for these yet.
2012-10-18 14:29:53 -07:00
Jürg Lehni
30374ae3b4
Implement proper index independent argument list reading of basic types.
...
Implemented for Point, Size, Rectangle and Color.
2012-10-18 14:24:15 -07:00
Jürg Lehni
44ad4d885a
Update link to Kaspar Fischer's PDF with new URL.
2012-10-15 15:48:38 -07:00
Jürg Lehni
e17e94b50b
Implement Item#isEmpty() for the various types.
...
And use it to tell #getBounds() when to ignore items.
2012-10-10 20:11:11 -07:00
Jürg Lehni
adb2ddc615
Fix CompoundPath#insertChild.
...
It was not returning success values and thus broke some tests.
2012-10-10 19:54:32 -07:00
Jürg Lehni
ef59ad2875
Improve selection handling and drawing for Path item.
...
In a way that makes more sense when building tools.
2012-10-10 19:33:42 -07:00
Jürg Lehni
523736d9e5
Handle view redraws correctly for all selection changes.
2012-10-08 23:12:43 -07:00
Jürg Lehni
6b08d96c45
Fix issue where out handle was compared to the wrong segment point when drawing.
...
This should fix #106 but needs to be verified before we can close the bug.
2012-10-05 19:08:31 -07:00
Jürg Lehni
77296c4640
Update documentation a bit.
2012-10-05 16:09:15 -07:00
Jürg Lehni
59a55f7574
Merge branch 'master' of github.com:paperjs/paper.js
2012-09-30 14:08:44 -07:00
Jürg Lehni
9e61995282
Handle parameter matching of beginning and ends of curves separately.
2012-09-30 14:06:31 -07:00
Jonathan Puckey
d20fb61c7c
Cleanup code.
2012-04-25 20:47:53 +02:00
Oliver Beattie
3c7563a3bf
When a path is transformed, the _length cache of its Curves should be invalidated
2012-03-17 17:09:54 +00:00
Jonathan Puckey
4d21e219c0
Merge pull request #74 from jonobr1/patch-1
...
Based on logic, I think the else if statement means to refer to c1 rathe...
2012-03-02 03:30:25 -08:00
Jonathan Puckey
c339ffca35
Close closed paths when drawing using Context#closePath(). Fixes #72
2012-03-01 23:25:00 +01:00
Jonathan Puckey
7093b73d31
Cleanup last merged pull request.
2012-03-01 17:06:39 +01:00
Alex Buchanan
f1a6357a05
Path.reverse() should adjust segment indices
2012-02-18 15:13:23 -08:00
Jono Brandel
ad811827fc
Based on logic, I think the else if statement means to refer to c1 rather than c0 again, but I'd like to verify with you guys.
2012-02-07 09:10:33 -08:00
Jürg Lehni
96f7d140a7
Use faster Point.create(x, y) internally.
2011-12-27 20:39:28 +01:00
Jürg Lehni
ad2abfb71f
Inline drawDashes() code.
2011-12-27 20:18:02 +01:00
Jürg Lehni
28806fe977
Ue the faster Matrix#_transformPoint().
...
And reuse Point objects if possible.
2011-12-26 11:06:36 +01:00
Jürg Lehni
7af06502bc
Fix Path#transform() to also return a reference to 'this'.
2011-12-25 16:39:08 +01:00
Jürg Lehni
783d2782c0
Fix wrong HitResult type when hitting Segment#point.
2011-12-25 16:38:43 +01:00
Jürg Lehni
1e690a68e0
Add TODO about HitResult points requiring transformations.
2011-12-25 12:39:10 +01:00
Jürg Lehni
3b0b1184a3
Implement checkSegment() without relying on #_transformCoordinates().
2011-12-25 12:34:51 +01:00
Jürg Lehni
c30ff47930
Remove matrix argument from all hit-testing related methods.
...
We better inverse-transform the point and save the code!
2011-12-25 00:19:01 +01:00
Jürg Lehni
733d879bb6
Add / improve comments about DOCS.
2011-12-23 22:47:10 +01:00
Jürg Lehni
98c82856ea
Override #matrix accessors in Path to do nothing.
...
For the same reasons as described in the previous commit.
2011-12-23 22:46:53 +01:00
Jürg Lehni
627961627e
Have Path always directly apply any transformation to its Segments.
...
This is required so the coordinates of its bounds, length and SegmentPoints are always in the same space.
2011-12-23 22:43:27 +01:00
Jürg Lehni
97b66582f8
Rename Item#applyMatrix() to shorter #apply().
2011-12-23 22:41:05 +01:00
Jürg Lehni
93ede28f3b
Implement new selection drawing mechanism.
...
Using the new Item#globalMatrix.
2011-12-20 11:42:00 +01:00
Jürg Lehni
daca14efb8
Add optional matrix in Path drawing code.
...
Required for new selection drawing mechanism to be implemented.
2011-12-20 11:40:31 +01:00
Jürg Lehni
42087071e7
Fix #strokeBounds for square caps.
...
Calculate the right points at both ends of paths.
2011-12-19 23:30:02 +01:00
Jürg Lehni
1e768e6c83
Fix #strokeBounds for strokes scaled using #matrix.
...
Gotta do the right thing, not the same buggy thing as Illustrator.
2011-12-19 23:21:13 +01:00
Jürg Lehni
4a46c8ac98
Fix recently introduced error with stroke/fillColor handling
...
Since CanvasContext#stroke/fillStyle cannot be set to null, we have to keep checking Style#fill/strokeColor even after calling #_setStyles().
2011-12-19 23:07:14 +01:00
Jürg Lehni
cc26fdc5d1
Optimise handling and setting of fill and stroke styles.
...
Handle setting of fillColor and strokeColor in Item#_setStyles() instead of the various #draw() methods, directly access internal styles instead of using accessor calls and fix PointText#draw().
2011-12-19 22:40:14 +01:00
Jürg Lehni
f5c1125709
Move Path#_setStyles() to Item, so it can be used in PointText too.
2011-12-19 21:25:39 +01:00
Jürg Lehni
466857659c
Unroll loop in Path#_setStyles().
2011-12-19 21:23:28 +01:00
Jürg Lehni
12dbb11ec3
Optimise and simplify ellipse code.
2011-12-19 13:51:26 +01:00
Jürg Lehni
3ccb4a6ebe
Fix strokeBounds calculation when a rotation matrix is in use.
...
The bounding box of the rotated pen ellipse was calculated wrongly.
2011-12-19 13:47:30 +01:00
Jürg Lehni
daa1343155
Add comment about perhaps renaming Path.Oval to Path.Ellipse.
2011-12-19 13:16:29 +01:00
Jürg Lehni
83df011e1d
Add missing colon.
2011-12-19 13:16:06 +01:00
Jürg Lehni
9e5eb17264
Improve Item#transform() and implement #applyMatrix() to support nested matrices. Work in progress.
2011-12-18 16:54:21 +01:00
Jürg Lehni
120ead209e
Define Segment#clone().
2011-12-07 11:54:41 +01:00
Jürg Lehni
566aaed0be
Define Segment#equals().
2011-12-07 11:53:07 +01:00
Jürg Lehni
3ece08bea1
Fix handling of recursion in Item#setSelected() / #setFullySelected().
2011-11-30 17:16:52 +01:00
Jürg Lehni
b51cf064b0
Make baseItem to last optional parameter of _getBounds.
2011-11-26 11:55:19 +01:00
Jürg Lehni
f799c85e76
Switch to using 'this' in private getBounds methods to point to path item rather than 'that'.
2011-11-26 11:48:08 +01:00
Jürg Lehni
a0ad81b576
Pass on the baseItem of a getBounds call, required to implement proper caching later.
2011-11-26 11:24:48 +01:00
Jürg Lehni
569c415b2f
Start implementing bounds caching the new way.
...
Work in progress still.
2011-11-24 15:37:44 +01:00
Jürg Lehni
c989d3ee3f
Restructure code a bit for easier reading.
2011-11-24 15:18:57 +01:00
Jürg Lehni
ea87be166e
Part one of big refactoring of bouding box handling. Functional, but caching is broken right now.
2011-11-24 15:13:21 +01:00
Jürg Lehni
b96cd4e1c8
Add comments about possible optimization of accessing of style properties.
2011-11-24 14:53:38 +01:00
Jürg Lehni
3f5e68aa76
Document the private getPendPadding() function.
2011-11-24 10:21:12 +01:00
Jürg Lehni
29aaf38320
Improve comments.
2011-11-24 10:17:31 +01:00
Jürg Lehni
cd1810e6a3
Fix arguments check in Path#getHandleBounds().
2011-11-23 18:13:05 +01:00
Jürg Lehni
b9f6c99dcd
Add comments and clean up code.
2011-11-17 19:28:05 +01:00
Jürg Lehni
c8e1a9c959
Merge remote-tracking branch 'origin/master'
2011-11-12 23:57:39 +01:00
Jürg Lehni
4ba752d42a
Add note and TODO about Path#contains() only working correctly for no-zero winding rule, which is not used by Canvas...
2011-11-12 19:49:12 +01:00
Jürg Lehni
ddf7c6534b
Fix Path#hitTest() to only consider strokeWidth if a strokeColor is provided too.
2011-11-12 19:48:39 +01:00
Jonathan Puckey
52385451f6
Resolve a few documentation todos.
2011-11-12 18:30:21 +01:00
Jonathan Puckey
3ac171a304
Path#smooth() example: select path using fullySelected instead of selected, so we can see its handles.
2011-11-12 16:45:33 +01:00
Jürg Lehni
a326b189b4
Improve Curve#isFlatEnough() by finding the right threshold through testing, and remove other less precise solutions.
2011-11-12 01:23:41 +01:00
Jürg Lehni
d43b54a531
Shorten Curve.isFlatEnough() code.
2011-11-11 20:58:33 +01:00
Jürg Lehni
fdd4ee8d31
Switch back to Kaspar Fischer's version of Curve.isFlatEnough, as it produces the best results with dashed lines.
2011-11-11 20:55:31 +01:00
Jürg Lehni
af9df0e1b8
Provide point of hit handles and segments too in HitResult.
2011-11-11 14:47:03 +01:00
Jürg Lehni
c4bea4d24c
Include comment about algorithm modifications.
2011-11-10 18:30:18 +01:00
Jürg Lehni
3397931bb2
Be consistent in Numerical. EPSILON comparison rules.
2011-09-22 21:14:16 +02:00
Jürg Lehni
571ca31dbf
Move ctx.restore() to same level as ctx.save(). Closes #51 .
2011-09-18 10:56:04 +02:00
Jürg Lehni
4e1dd90549
Use faster Size.create().
2011-08-16 13:52:31 +02:00
Jürg Lehni
4dd90b440e
Use new dontLink parameter for Path.Constructors optimisations.
2011-08-16 13:52:18 +02:00
Jürg Lehni
8f8188a091
Optimise Path.Rectangle constructor.
2011-08-16 13:39:37 +02:00
Jürg Lehni
3c5a46a8af
Implement SegmentPoint#isZero() that does not use the x / y accessors but the internal properties directly, for performance reasons, since it is used a lot internally.
2011-08-16 13:38:52 +02:00
Jürg Lehni
7e0307dd6a
Correct comments.
2011-08-16 13:36:58 +02:00
Jonathan Puckey
3a3f5ecabb
Segment: notify path of change when selection state of handles changes, so the view is redrawn.
2011-08-04 10:54:56 +02:00
Jürg Lehni
a8c08b3301
Docs: Document Path#getNearestLocation() and #getNearestPoint().
2011-08-01 11:48:27 +01:00
Jürg Lehni
7f81184848
Only intersect lines if their lengths are not conflicting with Numerical.EPSILON comparison of the cross product in Line#intersect().
2011-07-30 11:38:17 +01:00
Jürg Lehni
7d0db22b9b
Use squared distances in nearest point algorithm.
2011-07-30 11:37:07 +01:00
Jürg Lehni
3a7c5286b5
Improve precision of Line#intersect() and other parts that check for a divisor to not be 0, by comparing against the new Numerical.EPSILON rather than Numerical.TOLERANCE.
2011-07-28 11:03:59 +01:00
Jonathan Puckey
60a4292691
Fix the way children of CompoundPath have their orientation set by overriding Item#insertChild(index, item).
2011-07-27 20:30:39 +02:00
Jonathan Puckey
63628be923
Fix bug in CompoundPath#draw(ctx, draw) which was causing an error when a compound path didn't have any children.
2011-07-25 21:41:09 +02:00
Jonathan Puckey
53a602fb56
Path#_hitTest: check that a stroke hit test was requested.
2011-07-15 14:50:42 +02:00
Jonathan Puckey
91ab38ffd1
Path#getHandleBounds: remove optimization as it leads to problems when hit testing handles.
2011-07-15 12:58:34 +02:00
Jürg Lehni
a3bfc8fe40
Support all ways of defining a Point in SegmentPoint.create(), through fallback to Point.read().
2011-07-13 12:46:16 +01:00
Jonathan Puckey
ff685f294a
Fix problem with passing a Size to the Segment constructor.
2011-07-13 13:29:50 +02:00
Jürg Lehni
254aee47f8
Implement Path#getLocation(point)
2011-07-09 17:12:27 +02:00
Jürg Lehni
55f815cb72
Remove obsolete TODOs.
2011-07-09 17:12:13 +02:00
Jürg Lehni
45c7f9c4fc
Port back code to prevent tangents and normals of length 0 from Scriptographer.
2011-07-09 11:20:03 +02:00
Jürg Lehni
ebd3bfc092
Introduce faster versions of Rectangle#contains() that do not perform checks.
2011-07-09 11:07:12 +02:00
Jürg Lehni
833d4968ce
Change root solvers to not produce new arrays each time but fill a passed one that can be reused. Yields io impressive performance improvements.
2011-07-09 10:50:47 +02:00
Jürg Lehni
839107d341
Remove faulty code for calculation of tangents / normals.
2011-07-09 10:35:22 +02:00
Jürg Lehni
ec00150df2
Remove unused variable.
2011-07-09 10:34:18 +02:00
Jürg Lehni
4e1d613ed8
Fix Curve#getLength() again for straight lines.
2011-07-09 10:21:17 +02:00
Jürg Lehni
17b412ce6f
Fix a newly introduced bug in #contains().
2011-07-09 10:17:06 +02:00
Jürg Lehni
8a6d53766e
Explain code a litter better.
2011-07-09 10:11:50 +02:00
Jürg Lehni
8928a7b057
Fix #getCrossings() where calling #getPoint() / #getTangent() was slow and also wrong when a matrix was used.
2011-07-09 10:09:41 +02:00
Jürg Lehni
8606f25542
Switch from using Function#apply() trick for passing curve values as function parameters to simply passing arrays and looking up the values on then.
2011-07-09 10:08:43 +02:00
Jürg Lehni
23f38c6e5b
Fix Path#flatten(), where we don't want to add last segment again for closed paths.
2011-07-09 09:51:06 +02:00
Jürg Lehni
74b23c1882
Use #roughBounds rather than #bounds in #contains() check.
2011-07-09 09:27:54 +02:00
Jürg Lehni
0a7f5a12a5
Fix bug in 'stroke' hit-results.
2011-07-08 23:32:29 +02:00
Jürg Lehni
c033a5a7bc
Implement hit-test options: segments, handles and ends.
2011-07-08 23:26:21 +02:00
Jürg Lehni
bb4e71da81
Clean up isFlatEnough() code.
2011-07-08 22:26:22 +02:00
Jürg Lehni
dfbe3135ad
Remove HitResult inheritance from CurveLocation, but have a #location property pointing to it.
2011-07-08 22:25:42 +02:00
Jonathan Puckey
36be78c671
Fix small problem in Item#_hitTest.
2011-07-08 18:41:29 +02:00
Jonathan Puckey
a0f4371803
Fix CurveLocation#getSegment.
2011-07-08 18:39:05 +02:00
Jürg Lehni
fe37ce6bcb
Clean up comments.
2011-07-07 23:02:26 +02:00
Jürg Lehni
23c4499d15
Add comments about how to potentially improve getBounds() accuracy.
2011-07-07 23:00:40 +02:00
Jürg Lehni
ca50461fd1
Implement new Curve.isFlatEnough().
2011-07-07 23:00:16 +02:00
Jürg Lehni
69a7d0bfd4
Implement a first version of Item#hitTest(), so far working only for Path items. Work in progress.
2011-07-07 22:14:58 +02:00
Jürg Lehni
f15a541468
Improve documentation.
2011-07-07 16:10:27 +02:00
Jürg Lehni
64ae48af0b
Remove solved TODO.
2011-07-07 16:10:06 +02:00
Jürg Lehni
5655981f6d
Clean up white spaces.
2011-07-07 16:09:02 +02:00
Jürg Lehni
e573fe5dcd
Do not pass prevSlope to Curve#getCrossings(), rely on #getPrevious() instead.
2011-07-07 16:08:10 +02:00
Jürg Lehni
4a53503130
Add support for optional matrix in Path#contains(), Path#getNearestLocation(), Curve#getValues(), Curve#getCrossings(), Curve#getNearestLocation()
2011-07-07 16:07:29 +02:00
Jürg Lehni
9d2148245a
Implement Curve#getParameter(point), untested.
2011-07-06 23:15:32 +02:00
Jürg Lehni
56d62108cf
Rename PathFlattener#getParameter(offset) -> #getParameterAt(offset)
2011-07-06 23:14:18 +02:00
Jürg Lehni
b13c7622c8
Rename Curve#getParameter(length) -> Curve#getParameterAt(offset)
2011-07-06 23:13:38 +02:00
Jürg Lehni
778a161ba0
Rename Curve.solve() -> Curve.solveCubic()
2011-07-06 23:10:16 +02:00
Jürg Lehni
d6b666024b
Define #getNearestLocation() / #getNearestPoint() for Path.
2011-07-06 22:25:20 +02:00
Jürg Lehni
fadf6e98b5
Pass on minDistance to CurveLocation.
2011-07-06 22:21:49 +02:00
Jürg Lehni
c35133fae9
Add CurveLocation#distance, for Curve#getNearestLocation().
2011-07-06 22:19:01 +02:00
Jürg Lehni
0c0807e3e9
Streamline handling of undefined properties in CurveLocation.
2011-07-06 22:18:40 +02:00
Jürg Lehni
30e92c8a35
Simplify CurveLocation#getPoint(), as missing parameter cannot be determined if point is also undefined.
2011-07-06 22:14:44 +02:00
Jürg Lehni
17bdaf6fe4
Use CurveLocation for Curve#getNearest*() methods.
2011-07-06 22:08:10 +02:00
Jürg Lehni
8b6d9746ce
Rename Curve#getCrossingsFor() -> #getCrossings()
2011-07-06 22:07:34 +02:00
Jürg Lehni
5c3a6f72b6
Fix comments.
2011-07-06 15:31:16 +02:00
Jürg Lehni
ccd4113ba3
Implement Nearest Point-on-Curve Problem.
2011-07-05 13:20:31 +02:00
Jürg Lehni
4630a1bd4a
Fix documentation.
2011-07-05 13:17:34 +02:00
Jürg Lehni
c1f46977fa
Rename Curve.isSufficientlyFlat() to shorter Curve.isFlatEnough()
2011-07-05 13:17:07 +02:00
Jürg Lehni
4110a56521
Improve comments.
2011-07-05 01:20:25 +02:00
Jürg Lehni
6cc7417201
Handle edge case in crossing number algorithm where the beam in right x-direction is touching a tip where the curves change y-direction but do not interesect with the shape, by checking for slope changes.
2011-07-05 01:15:45 +02:00
Jürg Lehni
4924d683e4
Simplify Curve.solve() and improve documentation.
2011-07-04 23:42:16 +02:00
Jürg Lehni
c5269ecbab
Implement Path#contains(point) efficiently using the crossing number algorithm and our cubic polynomial solver.
2011-07-04 23:32:15 +02:00
Jürg Lehni
dad118cc20
Fix comments.
2011-07-04 23:30:25 +02:00
Jürg Lehni
45a3e7f873
Big refactoring of the way bounds are handled and cached, properly supporting Groups inside Symbols, and also adding #roughBounds, to be used by upcoming hit testing code.
2011-07-04 19:45:53 +02:00
Jürg Lehni
e88043a1f4
Implement Path#roughBounds, based on an improved Path#getHandleBounds() that supports additional hidden join and stroke padding parameters.
2011-07-02 18:27:43 +02:00
Jürg Lehni
3eecb924c8
Fix bug in Segment#_transformCoordinates, where handles were not set when they were zero, change was false and no matrix was provided.
2011-07-02 06:24:27 +02:00
Jürg Lehni
0644d9d8b5
Move TODOs up to where they make sense.
2011-07-01 17:40:29 +02:00
Jürg Lehni
51d6ff945e
Improve Path#getHandleBounds() and fix bean access for #handleOut.
2011-07-01 17:39:39 +02:00
Jürg Lehni
aa9be1d9c5
Rename #controlBounds -> #handleBounds, to reflect terminology used elsewhere.
2011-07-01 17:23:10 +02:00
Jürg Lehni
9fa51a0457
Implement Item#controlBounds and Path#controlBounds, and test it in StrokeBounds example. This is a first step towards fast hit-testing.
2011-07-01 12:51:18 +02:00
Jürg Lehni
84bce71b1c
Remove unnecessary Segment#getHandleIn/OutIfSet.
2011-07-01 12:30:10 +02:00
Jürg Lehni
79c0ad8cc5
Update copyright notices.
2011-07-01 12:17:45 +02:00
Jürg Lehni
7211e68245
Add documentation to PathItem class.
2011-07-01 11:22:33 +02:00
Richard D. Worth
ac39873693
Whitespace. Removed all trailing whitespace from .js files
2011-06-30 06:01:51 -04:00
Jürg Lehni
0eb033e6bf
Only try to simplfy path if there are more than two segments in it.
2011-06-27 22:35:02 +02:00
Jürg Lehni
50c7649421
Improve Segment and Curve documentation.
2011-06-27 15:07:08 +02:00
Jürg Lehni
e35b171bec
Improve Curve documentation.
2011-06-27 14:58:17 +02:00
Jürg Lehni
cd2fce9bc7
Clean up documentation.
2011-06-27 12:31:39 +02:00
Jürg Lehni
4a344c8fad
Clean up forgotten @lends statements.
2011-06-22 23:58:50 +01:00
Jürg Lehni
7cd749e63d
Change all documentation to new convention of defining @class outside injection scope, fix some comments and a few errors with examples.
2011-06-22 23:56:05 +01:00
Jürg Lehni
2f2b3ed7e0
Fix selection behavior when segment lists are cleared, in which case we expect the path to remain selected.
2011-06-20 19:08:34 +01:00
Jonathan Puckey
a2a8939d5d
Path# rename #pointsToCurves to #simplify and #curvesToPoints to #flatten.
2011-06-20 19:17:07 +02:00
Jürg Lehni
37f5a64dce
Improve _bounds handling by introducing Item#_createBounds() that always uses LinkedRectangle class.
2011-06-20 17:34:43 +01:00
Jürg Lehni
995c5b4081
Fix error in miter calculation in Path#getStrokeBounds(), recently introduced by a fix in Curve#getNormal().
2011-06-20 15:56:08 +01:00
Jürg Lehni
c1fcd6f3bb
Documentation: Convert more Array return types to Type[].
2011-06-20 14:27:54 +01:00
Jonathan Puckey
e23282fe05
Documentation: convert Array return types to Type[].
2011-06-20 15:19:08 +02:00
Jürg Lehni
7a90f9260e
Have subclasses of Item call the base version of _changed().
2011-06-19 22:40:49 +01:00
Jürg Lehni
0df909dd71
Rename ChangeFlags -> ChangeFlag.
2011-06-19 22:21:14 +01:00
Jürg Lehni
f0bc3f115b
Have all visual changes include ChangeFlags.APPEARANCE.
2011-06-19 22:20:28 +01:00
Jürg Lehni
2594a41b7d
Remove the mention of optional parameters in documentation, as they are marked optional already.
2011-06-19 21:52:52 +01:00
Jürg Lehni
bbcec27031
Move support for _bounds caching to Item and start using it in PlacedSymbol.
2011-06-19 18:07:53 +01:00
Jürg Lehni
fe416e294d
Fix issue with a path not being selected when one of its segment is selected directly.
2011-06-17 19:00:41 +01:00
Jürg Lehni
ca16e43c1f
Implement getters / setters for #locked, #visible, #blendMode and #opacity, and call _changed() from setters.
2011-06-17 18:53:34 +01:00
Jürg Lehni
3226147e00
Use a version of Bootstrap that always produces beans and remove all beans: true instructions.
2011-06-17 18:42:29 +01:00
Jürg Lehni
5bc4f69856
Improve documentation for Path#removeSegments().
2011-06-17 17:54:37 +01:00
Jürg Lehni
7dcdb5ca2f
Improve documentation for Path#removeSegments().
2011-06-17 17:46:42 +01:00
Jürg Lehni
6f4a9d5c7b
Merge branch 'master' of github.com:scriptographer/paper.js
...
Conflicts:
test/tests/Item.js
2011-06-17 16:36:58 +01:00
Jonathan Puckey
ea9c9353e3
Merge branch 'master' of https://github.com/scriptographer/paper.js
2011-06-17 16:59:42 +02:00
Jonathan Puckey
6fc08c6417
Item: implement #addChild(item), #insertChild(index, item), #insertAbove(item) and #insertBelow(item) Deprecate: #moveAbove, #moveBelow, #appendTop, #appendBottom.
2011-06-17 16:58:41 +02:00
Jürg Lehni
503a031bdf
Allow CompoundPath to have named children.
2011-06-17 14:11:37 +01:00
Jürg Lehni
f4d15200ee
Remove Group#_clipped and solely use Item#_clipMask to handle clipping internally.
2011-06-17 13:56:02 +01:00
Jürg Lehni
1615b50b68
Fix thrown Error messages.
2011-06-17 11:26:35 +01:00
Jürg Lehni
6e16ab81f4
Fix a bug in Path#arcTo() where sometimes the arc was drawn on the wrong side when the extent was 180 degrees, thus the center point was lying on the line (from, to).
2011-06-16 23:50:14 +01:00
Jürg Lehni
169b58e550
Fix argument reading for PathItem#arcTo(to, clockwise).
2011-06-16 23:48:46 +01:00
Jürg Lehni
8d49d2377b
Fix documentation for PathItem#smooth().
2011-06-16 23:37:45 +01:00
Jürg Lehni
c2d425c916
Improve Error message thrown when no arc can be drawn.
2011-06-16 22:50:59 +01:00
Jürg Lehni
6e7d23faa4
Improve #arcTo() documentation.
2011-06-16 22:38:58 +01:00
Jürg Lehni
2c83eeb7de
Improve handling of Path#arcTo() when the arguments demand an infinitely big circle, by either drawing a line or bailing out.
2011-06-16 22:38:43 +01:00
Jürg Lehni
aa825302e4
Clean up documentation for PathItem, Path & CompoundPath, by moving shared documentation to PathItem, for methods that are supposed to be abstract in PathItem and shared between the two classes.
2011-06-16 22:07:00 +01:00
Jürg Lehni
cb463b74f5
Fix @extends tags in documentation: Only the immediately following class is required.
2011-06-16 21:43:31 +01:00
Jürg Lehni
9deabbee8d
Start adding documentation to PathItem.
2011-06-14 23:04:32 +01:00
Jürg Lehni
401c4d5dc4
Rearrange @constructor documentation sequence.
2011-06-14 23:01:35 +01:00
Jürg Lehni
ffa79f4fd1
Clean up white spaces in comments.
2011-06-14 22:59:45 +01:00
Jürg Lehni
a7d22b2165
Add comment about porting back Path#arcTo().
2011-06-14 21:32:14 +01:00
Jürg Lehni
8213dce4a9
Have newly added segments selected if path was fully selected before.
2011-06-14 15:40:03 +01:00
Jürg Lehni
a32b687bfd
Bigger refactoring of handling of segment selection: Have Path#_selectedSegmentState be the summed up value of all Segment's states, and compare it to segments.length * SelectionState.POINT in #fullySelected.
2011-06-14 15:37:25 +01:00
Jürg Lehni
ad78474ae4
Remove obsolete TODO.
2011-06-14 12:46:15 +01:00
Jürg Lehni
50bc64779f
Handle special case of infinitely big circle in Path#arcTo(), by cheating using an approximation of a really big circle.
2011-06-14 12:45:37 +01:00
Jürg Lehni
2be18b8013
Completely rewrite Path#arcTo() using Point class and vector geometry methods.
2011-06-14 12:19:14 +01:00
Jürg Lehni
8d0bb3d2ae
Path#arcTo(): Fix wrong constant names.
2011-06-14 09:32:53 +01:00
Jürg Lehni
b4a210e113
Path#arcTo(): Fix the case where through point lies on a line between from and to point.
2011-06-14 09:12:18 +01:00
Jürg Lehni
f0c22bc1dc
Shorten pre-calculations in Path#arcTo().
2011-06-14 09:00:55 +01:00
Jürg Lehni
f6b2672f08
Simplify Path#arcTo() arguments check.
2011-06-14 09:00:25 +01:00
Jürg Lehni
a3d1875971
More clean ups.
2011-06-13 19:09:10 +01:00
Jürg Lehni
de739b42a8
Clean up white spaces.
2011-06-13 19:05:17 +01:00
Jürg Lehni
064f17eaec
Fix default value for end in Path#removeSegments(), so the last segment gets removed too.
2011-06-13 19:00:39 +01:00
Jürg Lehni
4a23e35eee
Merge remote-tracking branch 'origin/master'
2011-06-12 18:42:24 +01:00
Jürg Lehni
c341ec220a
Fix white space.
2011-06-12 18:40:30 +01:00
Jürg Lehni
065777291e
Fix filtering of duplace points in path fitting code.
2011-06-12 18:40:24 +01:00
Jonathan Puckey
20fc389020
Documentation: add see tag to Path#closePath().
2011-06-10 13:33:14 +02:00
Jonathan Puckey
87c1b564d2
Document Path#lineBy(vector).
2011-06-10 13:32:37 +02:00
Jonathan Puckey
ac703f1baa
Path: add example of pointToCurves().
2011-06-10 00:07:25 +02:00
Jürg Lehni
928b7df01e
Fix typo introduced in previous refactoring.
2011-06-06 17:18:22 +01:00
Jürg Lehni
046f9cef6e
Add comments.
2011-06-05 23:14:36 +01:00
Jürg Lehni
2fe21586df
Further simplifications of path fitter code.
2011-06-05 23:14:28 +01:00
Jürg Lehni
3a4af3f854
Rename variables forgotten in previous refactoring.
2011-06-05 23:13:45 +01:00
Jürg Lehni
b035077d31
Simplify code.
2011-06-05 23:00:33 +01:00
Jürg Lehni
9e25047b91
Further clean ups.
2011-06-05 22:09:19 +01:00
Jürg Lehni
68eb14c00d
Clean up code.
2011-06-05 22:06:24 +01:00
Jürg Lehni
10e1417dc2
Check for denominator == 0 with tolerance.
2011-06-05 21:59:42 +01:00
Jürg Lehni
0366752a6f
Merge remote-tracking branch 'origin/master'
2011-06-05 21:56:17 +01:00
Jürg Lehni
73a188742e
Fix bug in singularity check.
2011-06-05 21:56:04 +01:00
Jürg Lehni
ee7147d58e
Rename forgotten variables in previous refactoring.
2011-06-05 21:51:01 +01:00
Jonathan Puckey
b385b859f9
Merge remote branch 'origin/master'
2011-06-05 22:46:22 +02:00
Jürg Lehni
6ea63fde43
Handle case of nearly singular matrix separately.
2011-06-05 21:45:29 +01:00
Jürg Lehni
27c7248a2d
Clean up and shorten code.
2011-06-05 21:44:34 +01:00
Jonathan Puckey
d2759c2371
Improve Segment constructor example.
2011-06-05 22:44:32 +02:00
Jonathan Puckey
9d4afcfe9c
Add another Path#add example.
2011-06-05 22:44:01 +02:00
Jonathan Puckey
5513687daa
Add Path#smooth examples.
2011-06-05 22:43:36 +02:00
Jürg Lehni
12e770c032
Merge remote-tracking branch 'origin/master'
2011-06-05 21:32:10 +01:00
Jürg Lehni
bcb5df9f04
Clean up.
2011-06-05 21:31:58 +01:00
Jürg Lehni
ca18b20785
Remove Douglas–Peucker algorithm again since it produced ackward results.
2011-06-05 21:29:19 +01:00
Jürg Lehni
42f5b5e26e
Implement Douglas–Peucker algorithm for point reduction before the curve fitting.
2011-06-05 21:28:49 +01:00
Jürg Lehni
aef8dcf2d3
Check for determinant singularity and handle separately.
2011-06-05 21:27:24 +01:00
Jürg Lehni
7d2742cd94
Rename PathFitter#process() -> #fit().
2011-06-05 21:26:01 +01:00
Jürg Lehni
4854e56e1d
Filter out adjacent duplicate points.
2011-06-05 21:25:38 +01:00
Jonathan Puckey
fe901fa96b
Add to and improve Path documentation.
2011-06-05 22:02:30 +02:00
Jürg Lehni
28c680ac94
Implement PathFitter and Path#pointsToCurves().
2011-06-05 19:27:18 +01:00
Jürg Lehni
caec7599be
Fix a bug with Segment constructor where two passed points with the first one having an x-coordinate of 0 would accidentaly be considered the two coordinate values for the point property.
2011-06-05 18:41:58 +01:00
Jonathan Puckey
e4eb463204
Path: document arcTo and curveTo.
2011-06-05 18:40:33 +02:00
Jonathan Puckey
14e2a61d25
Add examples to Path#arcTo docs.
2011-06-05 17:22:35 +02:00
Jonathan Puckey
ab09a44dc6
Add examples to Path#join documentation.
2011-06-05 16:12:31 +02:00
Jonathan Puckey
c10aa01de0
Fix a bug in Path#join.
2011-06-05 15:56:37 +02:00
Jonathan Puckey
5770ebc9ff
Merge remote branch 'origin/master'
2011-06-05 15:04:43 +02:00
Jonathan Puckey
deec7512cc
Path: fix return type in #getLocationAt documentation.
2011-06-05 15:04:34 +02:00
Jonathan Puckey
34b510bf1c
Path: add examples to #getPointAt, #getNormalAt and #getTangentAt.
2011-06-05 15:00:43 +02:00
Jonathan Puckey
bb956c890f
Add documentation stub for Path#arcTo(through, to)
2011-06-05 14:52:01 +02:00
Jonathan Puckey
4e0a857ee7
Fix a problem in Path#arcTo where it wasn't defaulting to a clockwise arc.
2011-06-05 14:51:37 +02:00
Jürg Lehni
b3d771a870
Remove Curve#transform() which is currently broken anyhow.
2011-06-05 13:27:39 +01:00
Jürg Lehni
e76c4e0de1
Implement Path#curvesToPoints() using the new PathFlattener class.
2011-06-05 13:21:00 +01:00
Jürg Lehni
74b9da9882
Define PathFlattener#evaluate() for curve evaluation at given offsets.
2011-06-05 13:20:20 +01:00
Jürg Lehni
c296eb0883
Fix wrong direction of tangent evaluation at t = 1.
2011-06-05 13:09:53 +01:00
Jürg Lehni
c2c5955717
Rename Curve#getCurvesValues() -> #getValues().
2011-06-05 12:40:07 +01:00
Jürg Lehni
cb3834f41c
Expose the previously private evalutate() function through Curve.evaluate(), make it work with curve value arrays, and use it the for various evaluation methods (#getPoint/Tangent/Normal).
2011-06-05 12:37:43 +01:00
Jürg Lehni
14816a872e
Define Curve constructor for 8 parameters and implement Curve#getPart() that returns a new sub curve.
2011-06-05 12:36:26 +01:00
Jürg Lehni
3a0f43050e
Rename length to offset.
2011-06-05 11:34:40 +01:00
Jürg Lehni
ef10c2797c
Add Curve#getPart but hide for now as more work is required.
2011-06-05 11:34:24 +01:00
Jürg Lehni
b5a0979f58
Access internal Curve coordinate properties directly rather than through beans.
2011-06-05 11:33:55 +01:00
Jürg Lehni
47085e44ca
Fix drawing of closed paths that was broken in recent commit.
2011-06-05 11:20:28 +01:00
Jürg Lehni
6095723e70
Fix single equal compare.
2011-06-04 21:46:48 +01:00
Jürg Lehni
90be683113
Clean up and add more comments.
2011-06-04 19:25:50 +01:00
Jürg Lehni
263fa8cbd9
Add comments.
2011-06-04 18:35:00 +01:00
Jürg Lehni
fafb6d1d76
Convert CurveFlattener to PathFlattener, which can handle drawing of parts accross curve boundaries.
2011-06-04 18:25:41 +01:00
Jürg Lehni
e097ff1303
Include copyright notice and clean up.
2011-06-04 16:12:55 +01:00
Jürg Lehni
5fa43efb79
Merge remote-tracking branch 'origin/master'
2011-06-04 16:08:52 +01:00
Jürg Lehni
6c74ace1ed
Implement dashed stroke support. Work in progress.
2011-06-04 16:08:40 +01:00
Jürg Lehni
e5290c3f47
More work on Path#draw().
2011-06-04 15:28:06 +01:00
Jürg Lehni
45a04891ee
Clean up.
2011-06-04 15:16:30 +01:00
Jürg Lehni
91886211b5
Simplify Path#draw() by defining a private drawSegment() that's used to close paths too.
2011-06-04 15:16:21 +01:00
Jonathan Puckey
a96b272f7a
Documentation edits.
2011-06-04 15:50:29 +02:00
Jürg Lehni
ce01d2cc59
Start implementing CurveFlattener, as required for dashing.
2011-06-04 12:40:58 +01:00
Jürg Lehni
bff3e14155
Implement a first crude version of Curve.isSufficientlyFlat()
2011-06-04 12:40:36 +01:00
Jürg Lehni
5581eefd0c
Define default value of t = 0.5 in Curve.subdivide().
2011-06-04 12:40:07 +01:00
Jonathan Puckey
5e05f38df0
Path docs: add return tag for #getLocationAt.
2011-06-03 23:06:05 +02:00
Jonathan Puckey
d77e9cfb4f
Path docs: add Positions on Paths and Curves group title and temporary Path Smoothing group title.
2011-06-03 23:05:22 +02:00
Jonathan Puckey
083099a919
Add Path#closed example.
2011-06-03 23:04:18 +02:00
Jonathan Puckey
7d1297fcf4
Path#draw: Fix drawing of selected path handles.
2011-06-03 11:33:34 +02:00
Jürg Lehni
29967153c3
Clean up TODO comments...
2011-06-01 10:49:43 +01:00
Jonathan Puckey
2b8f1b71ec
Documentation: use inline code tags for boolean and number values,
2011-05-31 14:28:42 +02:00
Jonathan Puckey
17fcb923ff
Documentation: rearrange @example tags, improve examples, rename boolean -> Boolean and misc smaller edits.
2011-05-30 19:42:17 +02:00
Jonathan Puckey
16f521b8a2
Path.Constructors docs: move @example tags to the end of the comments and shorten the lines of the examples.
2011-05-30 17:13:19 +02:00
Jürg Lehni
9d00541987
Clean up PORT comments.
2011-05-29 19:20:10 +01:00
Jonathan Puckey
742d7f809d
Segment: document #toString and #selected.
2011-05-29 16:57:48 +02:00
Jonathan Puckey
6b63bb8a36
Documention: add postscript methods to CompoundPath
2011-05-29 16:49:52 +02:00
Jonathan Puckey
41bf1f4543
CompoundPath: document #moveTo and #moveBy.
2011-05-29 16:13:30 +02:00
Jonathan Puckey
0b9c034e0d
Path: document #addSegments and #insertSegments
2011-05-29 16:06:23 +02:00
Jonathan Puckey
78ab493709
Documentation: add todo to Path#add
2011-05-29 16:05:47 +02:00
Jonathan Puckey
cd76c8c0e1
Documentation: remove ^n from method names, since this isn't necessary anymore.
2011-05-28 02:18:10 +02:00
Jonathan Puckey
1520cad144
Documentation: capitalize basic types in @ tags.
2011-05-27 21:21:49 +02:00
Jonathan Puckey
8e84c79aa6
Documentation: capitalize 'string' and 'number' types.
2011-05-27 20:15:15 +02:00
Jonathan Puckey
25c3534dc1
Documentation: remove part of the constructor explanation of CurveLocation until the mentioned functions have been added.
2011-05-27 20:06:57 +02:00
Jonathan Puckey
4015b022ad
Docs: use @true tag in boolean return descriptions and add Key.isDown param options.
2011-05-27 18:43:27 +02:00
Jonathan Puckey
373e14dd76
Improve CompoundPath documentation.
2011-05-27 13:54:34 +02:00
Jonathan Puckey
ca3230c1ad
Documentation: reorder functions, add group titles and todos.
2011-05-27 13:28:13 +02:00
Jürg Lehni
397d3676ed
Merge remote-tracking branch 'origin/master'
2011-05-26 21:00:05 +01:00
Jonathan Puckey
6b611add37
More documentation edits and function reordering.
2011-05-26 20:09:25 +02:00
Jonathan Puckey
65fa7fb01d
Path documentation: use Type[] for 'typed' arrays.
2011-05-26 16:50:13 +02:00
Jürg Lehni
8130ee458f
Rename #_countSelectedSegment() to #_updateSelection().
2011-05-26 11:52:28 +01:00
Jürg Lehni
3e7806ae50
Move #_countSelectedSegment().
2011-05-26 11:38:26 +01:00
Jürg Lehni
e31081f2fc
Use Path#_countSelectedSegment() in #removeSegments() as well.
2011-05-26 11:38:08 +01:00
Jürg Lehni
c67209f889
Optimize Curve#initialize for minifying.
2011-05-26 11:09:02 +01:00
Jürg Lehni
362eca7061
Further optimize Segment#initialize for minifying.
2011-05-26 11:08:07 +01:00
Jürg Lehni
d8fbca0d68
Shorten Segment#_changed().
2011-05-26 11:04:57 +01:00
Jürg Lehni
5b6bc1263c
Allow selection state of Segments to be changed before they are added to a Path (Part two of fixing selection cloning).
2011-05-26 10:59:22 +01:00
Jürg Lehni
2d218dbb19
Change and optimise the way SegmentPoints are created, so that selected state is actually copied over properly (Part one of fixing selection cloning).
2011-05-26 10:58:16 +01:00
Jonathan Puckey
26aa3c00d7
Add CurveLocation documentation.
2011-05-23 17:39:26 +02:00
Jonathan Puckey
0e63f11b72
Add Curve documentation.
2011-05-23 17:24:57 +02:00
Jonathan Puckey
a389be30cf
Add Path.Constructors documentation.
2011-05-23 14:33:22 +02:00
Jonathan Puckey
2a4f5b93f0
Path documentation: whitespace.
2011-05-23 13:37:40 +02:00
Jonathan Puckey
211635f206
Cleanup last commit.
2011-05-23 04:20:11 +02:00
Jonathan Puckey
6db1f6c54c
Documentation: ignore various classes.
2011-05-23 04:18:21 +02:00
Jonathan Puckey
349e4023f3
CompoundPath documentation: adjust constructor docs.
2011-05-23 01:53:57 +02:00
Jonathan Puckey
ae6606e11c
Add CompoundPath docs.
2011-05-23 01:49:01 +02:00
Jonathan Puckey
06a6d5cc70
Add documentation to Segment.
2011-05-23 00:42:22 +02:00
Jonathan Puckey
5cea863ccb
Add documentation to Path.
2011-05-23 00:26:08 +02:00
Jonathan Puckey
469f72d36f
Remove todo.
2011-05-21 21:39:27 +02:00
Jonathan Puckey
7cdacc5536
Optimize Segment#initialize for minification.
2011-05-21 19:21:13 +02:00
Jürg Lehni
2b5d648e96
Change SegmentPoint.create() to copy over selected state from a provided other point or object.
2011-05-21 14:27:29 +01:00
Jürg Lehni
b15eecc34d
Use new internal Item#_clone() to improve Path#clone() and PointText#clone().
2011-05-20 08:54:44 +01:00
Jürg Lehni
7401e42316
Implement #clone() for Item, Group and Path. Needs testing.
2011-05-19 21:56:23 +01:00
Jürg Lehni
2dcb09a662
Define Path#clone().
2011-05-19 21:34:19 +01:00
Jürg Lehni
09612c4623
Remove the versions of #clone() that follow the scheme provided by Base#clone() now.
2011-05-19 18:35:38 +01:00
Jürg Lehni
ac213e94b4
Fix bug introduced in recent change to #getStrokeBounds(): We need to pass matrix as optional argument to #getBounds().
2011-05-18 21:32:00 +01:00
Jonathan Puckey
0a385d56a7
Replace accidental beans access with direct access of internal property.
2011-05-18 20:22:57 +02:00
Jonathan Puckey
b4807b9b7c
Fix Path#getStrokeBounds: use Path#getBounds when no strokeColor or strokeWidth are set.
2011-05-18 20:08:10 +02:00
Jonathan Puckey
241d98a1cf
Merge remote branch 'origin/master'
2011-05-18 16:01:36 +02:00
Jonathan Puckey
8810563a8f
Improve Raster#getAverageColor.
2011-05-18 16:00:55 +02:00
Jürg Lehni
eafc0d202e
Add comment about #clockwise magic happening in #append*() methods.
2011-05-16 20:17:14 +01:00
Jürg Lehni
34110fa82d
Move #_setStyle() closer to the related styles hash.
2011-05-16 19:19:18 +01:00
Jürg Lehni
c8c47bf641
get styles directly from _style object rather than passing through getters on Item.
2011-05-16 18:57:47 +01:00
Jonathan Puckey
4ad47ed3aa
Fix accidental internal bean access to #fillColor and #strokeColor in Path#_transform.
2011-05-16 15:11:13 +02:00
Jürg Lehni
cfe968d30e
Rename Document -> Project, DocumentView -> ProjectView, paper.document -> paper.project and paper.documents -> paper.projects, to avoid name clashing with window.document.
2011-05-16 13:33:15 +01:00
Jürg Lehni
a601cfdd6d
Clear the indices and path references of the removed segments.
2011-05-16 01:37:31 +01:00
Jürg Lehni
3a15360efc
Rename ChangeFlags.PATH to GEOMETRY.
2011-05-16 00:01:06 +01:00
Jürg Lehni
ebdf5a2dfd
Shorten CompoundPath#moveBy().
2011-05-15 19:58:09 +01:00
Jürg Lehni
54161f81f1
Add expected parameters to function signature.
2011-05-15 19:57:48 +01:00
Jürg Lehni
c4c4f51eb9
Shorten getCurrentPath().
2011-05-15 19:31:25 +01:00
Jürg Lehni
7ba2fcad2a
Allow passing of Paths to CompoundPath constructor as arguments, without an array object.
2011-05-15 19:14:09 +01:00
Jürg Lehni
c9d0f982c2
Don't set _clockwise in Path#isClockwise(), as it should only be set once the use explicitely does so.
2011-05-15 19:02:50 +01:00
Jürg Lehni
4cee442a05
Rename items parameter to paths.
2011-05-15 18:05:47 +01:00
Jürg Lehni
3d76034600
Use Path#setClockwise() in CompoundPath constructor to reverse top path so that the others appear as holes cut out from it.
2011-05-15 18:05:00 +01:00
Jürg Lehni
813b70c70b
Update comment a bit to make code more clear.
2011-05-15 17:59:57 +01:00
Jürg Lehni
40c988b313
Add Path#is/setClockwise(), as a way to check and define a path's orientation.
2011-05-15 17:59:06 +01:00
Jürg Lehni
252a3635dc
Replace {@true} tags in documentation ({@true ([^}]*)} -> true $1, false otherwise.)
2011-05-15 15:06:10 +01:00
Jürg Lehni
c91cbe2175
Merge remote-tracking branch 'origin/master'
2011-05-15 14:37:34 +01:00
Jürg Lehni
057b71ff4c
Don't overuse variable chaining - use only were readibility does not suffer.
2011-05-15 14:29:00 +01:00
Jonathan Puckey
1a82ef4a34
Merge remote branch 'origin/master'
2011-05-15 14:09:57 +02:00
Jürg Lehni
51dbd85db5
Add experimental orientation detection for Paths.
2011-05-15 11:33:09 +01:00
Jonathan Puckey
42ae3ce42e
CompoundPath#draw: set param.compound to false when done drawing.
2011-05-14 20:36:58 +02:00
Jürg Lehni
0bab694a01
Rename Item#children to private Item#_children and add #getChildren getter.
2011-05-14 18:07:10 +01:00
Jonathan Puckey
2bfe42da05
Have the CompoundPath constructor reverse the segments of all paths passed to it except for the first one. Introduce 'keepDirection' option to allow importing of already existing CompoundPath items.
2011-05-14 13:03:18 +02:00
Jonathan Puckey
032d19b0d2
Fix bug in CompoundPath where toCssString was being called instead of getCanvasStyle, resulting in problems when gradients were used.
2011-05-12 15:30:56 +02:00
Jonathan Puckey
bbccb25184
Transform gradient when path is transformed.
2011-05-08 14:05:47 +01:00
Jürg Lehni
2f4f003873
Have Base.read() clone owned objects such as SegmentPoint or LinkedPoint.
2011-05-08 13:38:09 +01:00
Jürg Lehni
327515a9de
Add missing header.
2011-05-08 09:59:37 +01:00
Jürg Lehni
70d0dd9c0c
Move #moveTo() to the same scope as the other drawing commands, and add explaining comments.
2011-05-07 17:11:06 +01:00
Jürg Lehni
979bda52ab
We don't need the empty #initialize().
2011-05-07 17:05:42 +01:00
Jürg Lehni
8c7b253bc2
Add Base.splice() to handle lists of items with _index referneces and use it for paper.documents and Item#children.
2011-05-07 16:11:05 +01:00
Jürg Lehni
b44e796475
Make sure getters dont return undefined but null instead.
2011-05-07 16:10:38 +01:00
Jürg Lehni
81c1b2dcce
Clean up Path#_add() a bit.
2011-05-07 15:38:36 +01:00
Jürg Lehni
59e2783979
Use tripple equal operators for string compares now.
2011-05-07 14:32:27 +01:00
Jürg Lehni
4e6e855461
Change '// TODO: Port' comments to '// PORT:'.
2011-05-07 14:18:27 +01:00
Jürg Lehni
dabc2b97ed
Implement change-notification in a proper way, using ChangeFlags that tell it what exactly has changed, and clearing caches accordingly.
2011-05-07 13:39:17 +01:00
Jürg Lehni
53cc1cd908
Apply #position optimisation through caching to all items, not just PlacedSymbol.
2011-05-07 13:13:19 +01:00
Jürg Lehni
6af787e475
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.
2011-05-07 11:23:46 +01:00
Jürg Lehni
0fc7216f1c
Fix typos introduced in recent commit.
2011-05-06 13:40:43 +01:00
Jürg Lehni
c36db3a55c
Introduce private faster Matrix#_transform* methods that lack arguments checks, and use them internally.
2011-05-06 13:28:35 +01:00
Jürg Lehni
aed1bb0878
Use Numerical.TOLERANCE instead of hardcoded one.
2011-05-06 12:06:05 +01:00
Jürg Lehni
66602c9cec
Remove comment about necessity to reverse coordinate system.
2011-05-06 01:27:47 +01:00
Jürg Lehni
0b082289a6
Simplify Path#arcTo() a lot (get rid of necessity to reverse coordinate system in y-direction, etc).
2011-05-06 01:26:23 +01:00
Jürg Lehni
18ef19649c
Remove comment about unnecessary change.
2011-05-06 00:45:46 +01:00
Jürg Lehni
680ae49ec8
Clean up code a bit and add comment about possible further optimsiations.
2011-05-06 00:44:54 +01:00
Jürg Lehni
a3065a59d1
Simplify Path#arcTo().
2011-05-06 00:42:10 +01:00
Jürg Lehni
a4b37a6278
Simplify addJoin().
2011-05-06 00:39:44 +01:00
Jürg Lehni
a3da96e8be
Remove notify parameter again from _add().
2011-05-06 00:18:56 +01:00
Jürg Lehni
20cf32d599
Resolve question about wether last segment should be included in join or not.
2011-05-06 00:14:09 +01:00
Jürg Lehni
93fe0216d2
Add Path#addSegment(s) and #insertSegment(s) and define #add() and #insert() as a switch between these versions based on the amount and nature of parameters.
2011-05-05 12:35:14 +01:00
Jürg Lehni
7894a48ace
Add parameter to Path#_add() that controls wether path is notified of change.
2011-05-05 11:40:46 +01:00
Jürg Lehni
ee6d593620
Cache strokeBounds and bounds only if no transformation matrix is passed.
2011-05-05 11:21:09 +01:00
Jürg Lehni
1279e820aa
Use arc() instead of rect() to draw handles.
2011-05-05 11:01:20 +01:00
Jürg Lehni
bc80c58558
Add Base.formatNumber() to format numbers in the same way as Scriptographer (precision of up to 5 fractional digits) and use it in the various #toString() functions.
2011-05-04 19:42:50 +01:00
Jürg Lehni
a5099fd51d
Add support for insertion of multiple segments at once to Path#_add(), #add() and #insert(), and change code that relies on these methods.
2011-05-04 18:42:40 +01:00
Jürg Lehni
728bf0441c
Clean up Path#moveTo() and #lineTo() commands.
2011-05-03 09:12:07 +01:00
Jürg Lehni
52a73e86ce
Clean up code (for() -> for ()).
2011-05-03 08:54:13 +01:00
Jürg Lehni
3af24e6178
Replace hidden getter call with direct access of internal property.
2011-05-03 08:47:52 +01:00
Jürg Lehni
a0e211c691
Big refactoring of how curves are kept in sync with segments (direct references rather than indices), along with various tests.
2011-05-03 00:25:23 +01:00
Jonathan Puckey
2ee7081c14
Merge remote branch 'origin/master'
2011-05-02 12:25:32 +02:00
Jonathan Puckey
41120cf4d9
Various small code cleanups.
2011-05-02 12:23:42 +02:00
Jürg Lehni
98ab342235
Shorten #_transformCoordinates() a bit.
2011-05-02 08:59:51 +01:00
Jürg Lehni
26b70309a8
Improve various #toString() functions.
2011-05-02 08:57:55 +01:00
Jürg Lehni
0a4150a5c9
Add beginning of value caching (_length, _bounds) and change tracking to invalidate cached values.
2011-05-02 00:17:21 +01:00
Jürg Lehni
2cdb15f2d6
Fix recently renamed functions in commented out code.
2011-05-01 23:29:15 +01:00
Jürg Lehni
b0282b9bd4
Change Segment to be aware of its index in the segment list and have the curves list update automatically on each change to segments.
2011-05-01 13:27:53 +01:00
Jürg Lehni
0680a50fd2
Fix yet another two bugs in CurveLocation.
2011-05-01 13:18:36 +01:00
Jürg Lehni
08e779d560
Fix two bugs in CurveLocation.
2011-05-01 13:16:25 +01:00
Jürg Lehni
6bbfd55240
Clean up Path#setSegments and begin moving of logic to keep Path#curves in sync away from Path#getCurves() to Path#setClosed(). Requires more work, e.g. Path#_add().
2011-04-30 23:44:37 +01:00
Jürg Lehni
6cca355e20
Add Curve.create() as faster internal constructor.
2011-04-30 23:29:10 +01:00
Jürg Lehni
053fb2d955
Move Path#get/setSegments back to top and remove test-code for array object extension.
2011-04-30 23:24:39 +01:00
Jürg Lehni
781b315808
Add getter/setter for Path#closed.
2011-04-30 23:22:29 +01:00
Jürg Lehni
bf3bd13540
Simplify Path#cubicCurveTo().
2011-04-30 23:17:19 +01:00
Jürg Lehni
6d84dc3351
Segment#isSelected() only checks for selection state of point. We need to check _selectionState instead to mirror behaviour in #_setSelected().
2011-04-28 19:04:00 +01:00
Jürg Lehni
d098c6e8b2
Fix index issue in #removeSegments().
2011-04-28 19:03:05 +01:00
Jürg Lehni
121ec5a93f
Allow #removeSegments() to be called without arguments, in which case all segments are removed.
2011-04-28 19:02:34 +01:00
Jürg Lehni
ea510c2403
Separate Path#remove(), #remove(index) & #remove(from, to) into #removeSegment(index) and #removeSegments(from, to).
2011-04-28 15:42:16 +01:00
Jürg Lehni
4d999d57e2
Replace all type converting string compares with ===, !==.
2011-04-28 13:23:17 +01:00
Jürg Lehni
115ef45464
Remove unnecessary .0 since numbers are all the same in JavaScript.
2011-04-28 13:13:33 +01:00
Jürg Lehni
0d697403b5
Clean up Path#curveTo() code.
2011-04-28 13:12:21 +01:00
Jürg Lehni
f69153844b
Make #setContextStyles() a 'protected' function.
2011-04-28 13:04:12 +01:00
Jürg Lehni
a9ea10ca7f
Move version of #getBounds() that handles children to Item, to eliminate duplicated code.
2011-04-28 10:04:36 +01:00
Jürg Lehni
6a483fa8be
Rename CurveLocation related functions to *At(offset), and add optional isParameter argument that defines whether offset is a length or a description of curve index / curve parameter.
2011-04-27 21:40:52 +01:00
Jürg Lehni
ea6cf24aae
Rename length parameter to more appropriate offset, to reflect recent name changes.
2011-04-27 21:23:57 +01:00
Jürg Lehni
3501e14c51
Remove comment about pending port that has been backported to Scriptographer.
2011-04-27 21:13:32 +01:00
Jürg Lehni
c2fbcbcaa8
Use Curve#getLength(from, to) rather than cloning and dividing.
2011-04-27 20:52:24 +01:00
Jürg Lehni
346493fb7c
Replace calls to getters with their internal property in all cases where getter does not perform additional magic.
2011-04-27 20:48:41 +01:00
Jürg Lehni
016f4c15aa
Rename CurveLocation#getLength() and #getCurveLength() to #getOffset() and #getCurveOffset(), and seperate Path#getLength([location]) into #getLength() and #_getOffset().
2011-04-27 20:08:57 +01:00
Jürg Lehni
b0a1f4b1a9
Add missing Path#getPoint(length).
2011-04-27 19:28:39 +01:00
Jürg Lehni
c836012d3d
Add CurveLocation#getTangent() and #getNormal() and use them in Path's versions.
2011-04-27 19:26:03 +01:00
Jürg Lehni
bf0bc81892
Fix various minor bugs in CurveLocation: We cannot rely on most of its field to always be set and need to call getters instead.
2011-04-27 19:24:40 +01:00