Jürg Lehni
304ecbc3be
Define compoundChildren hitTest option to get matching children instead of parent.
2013-10-18 15:40:41 +02:00
Jürg Lehni
5d0fd8f970
Implement Style#windingRule and use it in Path#contains().
2013-10-18 14:54:13 +02:00
Jürg Lehni
4f27be8f12
Include new, improved point in path algorithm based on winding number.
...
It's also possible to switch to using the canvas's native isPointInPath() through options.nativeContains
2013-10-18 14:22:59 +02:00
Jürg Lehni
73d2c34088
Implement item-level #equals() method and clean up other equals methods.
2013-10-17 13:08:54 +02:00
Jürg Lehni
3958d35f28
Change behavior of Path#fullySelected.
...
Setting it on empty paths does the same as Path#selected.
2013-10-17 12:03:46 +02:00
Jürg Lehni
51cf1cfec6
Clean up Path#toShape().
2013-10-16 23:35:50 +02:00
Jürg Lehni
c4c7a37993
Implement Path#toShape(), Segment#isColinear(), Segment#isOrthogonal() and Segment#isArc().
2013-10-16 23:10:03 +02:00
Jürg Lehni
b581c84d8b
Move CompoundPath#reduce() to Item#reduce().
2013-10-16 16:10:28 +02:00
Jürg Lehni
b325aebc77
Docs: More smaller fixes.
2013-10-16 15:03:29 +02:00
Jürg Lehni
3af179e2cf
Docs: Improve Path constructors.
2013-10-16 14:19:25 +02:00
Jürg Lehni
a3d0e0d462
Clean up throw statements.
...
Never throw plain strings.
2013-10-14 16:05:50 +02:00
Jürg Lehni
9103c19e6f
Fix issues with #dashOffset when emulating native dashes.
...
Closes #303 .
2013-10-08 10:50:59 +02:00
Jürg Lehni
19c7788617
Fix documentation irregularities.
2013-08-23 19:45:28 -07:00
Jürg Lehni
6b19f25f4b
Fix typos in comments.
2013-08-08 15:21:35 -07:00
Jürg Lehni
aa4d990c90
Move and unify handling of Item#_set(props) to new Item#_initialize(), and add support for props.insert = false.
2013-07-21 15:45:22 -07:00
Jürg Lehni
b7aea1e527
Use insert: false option in creation of all clones.
...
Still needs implementing in Item constructor.
2013-07-19 18:42:13 -07:00
Jürg Lehni
20a17f2939
Implement insert parameter in Item#clone() to control DOM insertion.
...
Defaults to true. Also insert in the right place now, above the original.
2013-07-19 18:27:00 -07:00
Jürg Lehni
ef4eee1064
Pass true for isParameter in Curve#divide() calls.
...
Closes #252 .
2013-07-04 19:39:55 -07:00
Jürg Lehni
8f254202e8
Use new @operator tag to mark math operator methods.
2013-06-28 05:59:07 -07:00
Jürg Lehni
f9925a71ea
Improve documentation for Path#split(), Curve#divide() and Curve#split().
...
Closes #189 .
2013-06-27 17:18:57 -07:00
Jürg Lehni
c123468d7a
Clean up Path#join() code.
2013-06-27 16:06:24 -07:00
Jürg Lehni
2b236a3da8
In Path#join, add first segment of second path again at the end after joining, if it was closed.
...
Closes #249 .
2013-06-27 15:43:26 -07:00
Jürg Lehni
6d38401f0c
Use faster direct Curve constructor instead of Base.create().
2013-06-25 09:58:18 -07:00
Jürg Lehni
52c889428b
Remove Curve.create() in favor of direct constructor.
2013-06-25 09:54:13 -07:00
Jürg Lehni
1866e4ff15
Remove need for all special arguments in minification, and restructure code to avoid warnings.
2013-06-24 10:15:54 -07:00
Jürg Lehni
a4535edbb9
Bring back _class names, since code minification breaks reliance on constructor.name.
...
Closes #248 .
2013-06-23 20:18:32 -07:00
Jürg Lehni
dff39dff78
Use local bounds for hit-testing.
...
Fixes issue #247 .
2013-06-23 19:49:36 -07:00
Jürg Lehni
f758fb306b
Rename #_applyMatrix to #_transformContent.
...
And swap names with private function...
2013-06-18 15:50:11 -07:00
Jürg Lehni
75acdf1025
Add support for direct drawing of native blendModes for items that allow it.
...
Bypassing compositing into separate canvases completely.
2013-06-18 14:18:57 -07:00
Jürg Lehni
ab2bfe2d40
Rename nativeDash to dash.
2013-06-17 15:52:16 -07:00
Jürg Lehni
f8367bb0dd
More clean-ups.
2013-06-15 05:24:34 -07:00
Jürg Lehni
79785afa2a
Minor clean-ups and optimizations of stroke hit-test code.
2013-06-15 05:21:17 -07:00
Jürg Lehni
8c09d19f7c
Fix wrong calculation of rough bounds for square caps.
...
And add some comments to stroke hit-testing code.
2013-06-15 05:15:48 -07:00
Jürg Lehni
26971672b2
Only check segments for miters that are within the limit.
2013-06-15 05:08:12 -07:00
Jürg Lehni
be1098e006
Further improve stroke hit-testing.
...
Properly detect all miter joins.
2013-06-15 05:06:09 -07:00
Jürg Lehni
1cab9aad90
Improve stroke hit-testing.
2013-06-15 03:12:57 -07:00
Jürg Lehni
38f832a888
Remove console.log()
2013-06-15 02:25:44 -07:00
Jürg Lehni
8b9fb3741d
Implement proper stroke hit-testing for all variations of joins and caps.
2013-06-15 02:24:59 -07:00
Jürg Lehni
e4ba0d80b6
Simple code improvement in #isClockwise().
2013-06-14 23:18:29 -07:00
Jürg Lehni
4ffcdc3971
Clean up code.
2013-06-14 23:13:54 -07:00
Jürg Lehni
1ae7832ab3
Move calculation of square joins and caps to static methods.
...
These will be of use when correctly implementing hit-testing of strokes.
2013-06-14 23:11:50 -07:00
Jürg Lehni
ca0e931498
Clean up and simplify getStrokeBounds() code.
...
Handling of bevel and miter joins can be merged nicely.
2013-06-14 22:57:14 -07:00
Jürg Lehni
610e396d94
Make Curve#_getCrossings() a static method and have it work on curve values directly.
2013-06-13 23:16:00 -07:00
Jürg Lehni
38f31be6b2
Clean up and simplify Path#_hitTest() code.
2013-06-13 14:30:52 -07:00
Jürg Lehni
95ecab8a6f
Improve handling of merged CompoundPath style through #getStyle().
...
Only access _style directly in core code if you really know what you're doing!
2013-06-12 20:12:08 -07:00
Jürg Lehni
33eb750586
Simplify Path#hasFill() and implement #hasStroke() as well.
2013-06-12 19:57:05 -07:00
Jürg Lehni
7a2f577b75
Implement Path#contains() correctly for open paths.
2013-06-12 00:35:34 -07:00
Jürg Lehni
f45a66d2ee
Filter out curves with zero length in Path#contains() algorithm.
...
Fixes #227
2013-06-12 00:19:54 -07:00
Jürg Lehni
20f7c567aa
Use Base objects for drawing params, so we can use param.extend() on them for easier overriding.
2013-06-11 20:40:44 -07:00
Jürg Lehni
18383875eb
Fix global variable leakage.
2013-06-11 17:46:50 -07:00
Jürg Lehni
03a7503789
Fix issue in getPathData() with closed CompoundPaths.
2013-06-11 15:26:44 -07:00
Jürg Lehni
dd38e4aae6
Merge pull request #231 from NorthNick/master
...
Path.arcBy bug fix
2013-05-28 07:53:58 -07:00
Jürg Lehni
cd7db56249
Remove all create() constructors for basic types since new constructors are now faster.
...
Woop!
2013-05-27 23:57:31 -07:00
Jürg Lehni
10d5de3ed6
Implement a better way to name and export class constructors.
...
This change also simplified the way classes are exported to PaperScope objects.
2013-05-27 12:48:58 -07:00
Jürg Lehni
c533dda7b5
Finally found a better and faster alternative for this.base() calls, by setting base on the function object instead.
...
base can be accessed on named functions very easily, leading to another measurable speed increase. Finally all performance reasons against straps.js are eliminated!
2013-05-27 10:04:05 -07:00
Jürg Lehni
369b329b23
Change straps.js to directly use initialize() as constructor function rather than redirecting calls to it.
...
Should yield some interesting performance improvements.
2013-05-27 09:11:50 -07:00
Jürg Lehni
80f9f6061c
Change the way the Line class handles direction vectors and infinite lines.
...
The beginning of performance improvements in the Line class.
2013-05-26 15:44:52 -07:00
NickNorth
3e520efe5f
arcBy recursively calls itself rather than arcTo.
2013-05-26 20:09:26 +01:00
Jürg Lehni
7c2e57e105
Remove Item#applyMatrix boolean, go back to previous way of directly applying transformations to children in Group and Layer, and introduce new Clip class for non-transformed nested matrices.
2013-05-13 18:57:17 -07:00
Jürg Lehni
7b8e27ddd9
Further simplify getNearestPoint() algorithm.
2013-05-07 00:07:18 -07:00
Jürg Lehni
d70c9b0464
Minor syntax fixes.
2013-05-05 23:19:22 -07:00
Jürg Lehni
25e5582a35
Define CompoundPath#reverse() and #clockwise, and replace reversePath() with it.
2013-05-03 21:41:22 -07:00
Jürg Lehni
bd3031cdff
Move fix for faulty _curves list after calls to Path#reverse() to the right place.
2013-05-03 21:33:17 -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
898e216668
Implement Path#getArea() and CompoundPath#getArea().
2013-04-25 17:37:19 -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
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
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
e1807214f4
Large refactoring of Style handling for notable speed improvements.
2013-04-19 19:31:29 -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
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
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
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
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
218732e320
Implement a row of simple optimizations to increase performance of Item constructors.
2013-04-07 17:36:09 -07:00
Jürg Lehni
a0b903e49c
Simply call slice() instead of slice(0).
2013-04-06 18:39:17 +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
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
177f799bde
Rename Path.Star parameter from numPoints to points.
2013-03-10 18:09:05 +01: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
8a69fcd1e5
Actually use precision setting in Path#getPathData().
2013-03-03 16:51:31 -08:00
Jonathan Puckey
7643085378
Path example documentation.
2013-03-03 20:48:03 +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
03521796ef
Setting Path#selected to false should deselect all handles too.
2013-03-01 20:25:09 -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
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
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
6b7c6b6c4c
Implement Item#bounds.selected to control drawing of selected item bounds.
2013-02-24 15:41:31 -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
24d467e292
Implement support for native dash strokes, through both setLineDash() and mozDash.
2013-02-12 15:32:21 -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
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
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
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
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
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
4185b63d99
Und recent renaming of #getNearest*() methods.
2012-12-30 19:43:35 +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
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
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
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
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