Jürg Lehni
1a0eead28c
Various code and comment clean-ups in new bool-op code.
2014-02-19 23:18:14 +01:00
Jürg Lehni
093aae0836
Merge remote-tracking branch 'origin/master' into bool-new-2
2014-02-19 14:35:52 +01:00
Jürg Lehni
ea89498e48
Remove debug logging.
2014-02-19 14:31:32 +01:00
Jürg Lehni
ad801fa786
Use parameter tolerances in Path#slipt()
...
Required because CurveLocation objects as returned by Path#getLocationAt() have some imprecision in their #parameter values. Fixes #401 .
2014-02-15 23:37:41 +01:00
hkrish
87ded4dcff
Merge master
2014-02-15 00:02:02 +01:00
hkrish
ccb9f518b8
Fix monotoneCurve calculation for open paths
2014-02-10 22:11:29 +01:00
hkrish
24cbf3b079
Correct winding contribution calculation for horizontal curves
2014-01-16 20:02:26 +01:00
Jürg Lehni
6cb25fafe3
Use changes in latest Straps.js to remove as many hidden parameters as possible.
...
Hidden parameters through arguments[] are bad news for JS optimizer engines.
2014-01-05 17:40:54 +01:00
Jürg Lehni
ea63d4c288
Merge branch 'refs/heads/master' into v8-optimizations
...
Conflicts:
src/core/Base.js
src/style/Color.js
2014-01-05 05:01:13 +01:00
Jürg Lehni
e22fa3a664
Update copyright notice.
2014-01-04 01:47:16 +01:00
Jürg Lehni
35890383d8
Merge branch 'refs/heads/paperscript-refactoring' into v8-optimizations
2013-12-29 15:54:54 +01:00
hkrish
1bacbc32e9
Link previous & next curves while returning monotone curves
2013-12-29 13:03:39 +01:00
Jürg Lehni
38d67d843d
Move Path#getStyle() to better location and simplify code.
2013-12-28 20:56:44 +01:00
hkrish
a8a4a6fd03
Return horizontal curves as well, with monotonic curves
2013-12-26 18:03:23 +01:00
hkrish
0134596f66
_getMonotoneCurves method which returns and caches curves that are monotonic in Y direction
2013-12-25 20:38:48 +01:00
Jürg Lehni
81651a7379
Prevent V8 "assignment to parameter in arguments object" deoptimizations.
...
Some getter-like functions still need fixing, but this might require a fix in Straps.js first.
2013-12-17 23:28:55 +01:00
Jürg Lehni
3dbad9c477
Replace delete in favor of setting to undefined to prevent V8 deoptimization.
2013-12-17 23:27:48 +01:00
Jürg Lehni
d176acfc53
Include point property in stroke hit-results.
2013-12-11 17:10:32 +01:00
Jürg Lehni
68bce5b062
Implement options.selected for hit-testing segments and handles.
2013-12-10 19:34:25 +01:00
Jürg Lehni
52891830e4
Fix typo in new segment / handle hit-testing code.
2013-12-10 18:59:04 +01:00
Jürg Lehni
9177bac125
Use same stroke tolerance approach for hit-testing joins and caps as well.
2013-12-10 14:23:05 +01:00
Jürg Lehni
48c8946f9e
Implement correct hit-testing tolerance using transformed 2D stroke padding rather than unscaled numerical tolerance.
...
But we still need to factor in the View zoom as well...
2013-12-10 12:52:42 +01:00
Jürg Lehni
d65ede7df8
Correctly take strokePadding and transformation matrices into account in roughBounds, through new Path._getPenPadding()
2013-12-10 11:43:05 +01:00
Jürg Lehni
b7943239eb
Implement cached getInternalRoughBounds as well.
2013-12-09 19:33:34 +01:00
Jürg Lehni
44e913201d
Switch back to instanceof checks.
...
As people are started to subclass Paper.js classes...
2013-12-09 15:04:44 +01:00
Jürg Lehni
e238d23194
Implement caching of internal, untransformed bounds.
2013-12-09 10:53:19 +01:00
Jürg Lehni
17e4078e3b
Fix a newly introduced bug in drawSegments()
2013-12-08 22:16:27 +01:00
Jürg Lehni
fc4e88c039
Change the way segments, points and handles are selected and deselected.
...
There is no interdependency anymore, except for selecting a segment selects the point and both handles, and selecting a curve selects both points and handles.
Closes #355
2013-12-08 18:06:31 +01:00
Jürg Lehni
2884894d0f
Implement hit-testing tolerance for fill tests.
...
Closes #278 .
2013-12-08 12:15:10 +01:00
Jürg Lehni
054356c78d
Fix drawing of closed path with only one segment.
2013-12-07 16:16:04 +01:00
Jürg Lehni
f166b08257
Simplify addCap() function.
2013-12-07 16:11:02 +01:00
Jürg Lehni
eb1f62b908
Improve strokeBounds fix for paths with only one segment.
2013-12-07 16:07:51 +01:00
msand
e431154e0e
Fix indent.
2013-12-07 16:09:50 +02:00
msand
73b1b9843a
Wrote failing test for strokeBounds on paths with a single segment and strokeColor. Implemented fix for failing test.
2013-12-07 15:59:45 +02:00
Jürg Lehni
a50adb1020
Implement constructors for Path and CompoundPath that can handle SVG-style path-data.
2013-12-06 18:09:44 +01:00
Jürg Lehni
92590b160c
Implement Canvas Path caching again using Context#currentPath.
2013-12-06 12:49:46 +01:00
Jürg Lehni
6b448ad320
Fix more edge cases in #contains().
...
This should fix issue #346 for good.
2013-12-01 23:13:11 +01:00
Jürg Lehni
1149399690
Add missing DOCS comments.
2013-11-29 18:50:04 +01:00
Jürg Lehni
5beb0f17ed
Fix hit-testing on paths with a matrix that is not the identity.
2013-11-26 23:13:11 +01:00
Jürg Lehni
8e44049f42
Clean up smooth() code.
2013-11-26 17:32:52 +01:00
Jürg Lehni
d079e179ac
Fix Path#arcBy(to, boolean)
2013-11-25 01:04:51 +01:00
Jürg Lehni
1049214126
Remove ctx.currentPath caching again, since it has the current affine transformation factored in and is thus useless to us.
2013-11-06 12:53:10 +01:00
Jürg Lehni
5630b7e415
Implement caching of drawn Canvas Path objects for better performance.
...
Already supported on recent Chrome and Safari.
2013-11-04 11:46:20 +01:00
Jürg Lehni
132f54d362
Define Item#clear() as an alias for Item#removeChildren(), or Path#removeSegments() for paths.
2013-11-01 17:52:27 +01:00
Jürg Lehni
0ded3ae0ba
Implement PathItem#cubicCurveBy() and #quadraticCurveBy()
...
Closes #284 .
2013-10-30 01:43:55 +01:00
Jürg Lehni
eecf68b7c3
Clear ctx.shadowColor after ctx.fill() to avoid application to both fill and stroke.
...
Closes #314 .
2013-10-30 00:00:04 +01:00
Jürg Lehni
f8d960d834
option.tolerance should always be defined in _hitTest()
2013-10-29 21:00:17 +01:00
Jürg Lehni
c43752dc3e
Use #hasFill() and #hasStroke() more broadly and avoid drawing strokes when strokeWidth is set to 0.
2013-10-29 20:05:39 +01:00
Jürg Lehni
fc9cad009f
Implement CompoundPath#_getWindings() and move #_contains() code for both Path and CompoundPath to PathItem.
2013-10-29 17:57:25 +01:00
Jürg Lehni
d649b1bb21
Define insert argument for Path#toShape() and Shape#toPath()
2013-10-29 16:45:50 +01:00
Jürg Lehni
f7c21144a1
Improve handling of strokes in Path#hitTest().
...
Have it match stroke locations when option.stroke is set even when the path has no stroke.
2013-10-18 20:27:47 +02:00
Jürg Lehni
b91c8f93f8
Remove Curve. _getEdgeSum() again, and inline code in Path.isClockwise()
2013-10-18 19:51:54 +02:00
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