Commit graph

4554 commits

Author SHA1 Message Date
Jürg Lehni
cc201655af Fix comment. 2013-10-20 01:54:53 +02:00
Jürg Lehni
e6ef5e7e17 Fix hit-test for compound paths again. 2013-10-20 01:54:20 +02:00
Jürg Lehni
ddeacb1763 More code clean up. 2013-10-20 01:41:31 +02:00
Jürg Lehni
caa50236dd Simplify winding algorithm by reusing orientation check. 2013-10-20 01:24:07 +02:00
Jürg Lehni
7c4518e4d0 Clean up some variable names. 2013-10-20 00:59:12 +02:00
Jürg Lehni
b4651a18c6 Implement #getItem() on Project and Item, similar to #getItems() but returning only the first match. 2013-10-19 13:02:53 +02:00
Jürg Lehni
1a645a1adb Implement function callbacks for item matching. 2013-10-19 12:38:36 +02:00
Jürg Lehni
4fb6a5d949 Implement #getItems(match) on Project and Item as a simple and efficient query interface. 2013-10-19 12:27:13 +02:00
Jürg Lehni
49a8ea24af No need for Object.getPrototypeOf().
Simply point _filtering directly at the original object.
2013-10-19 12:08:04 +02:00
Jürg Lehni
d59ed6d7c0 Implement a way to use fast _filtered inheritance trick and still use #hasOwnProperty() checks in Base#_set() 2013-10-19 12:05:53 +02:00
Jürg Lehni
0b7e128426 Only rely on _drawCount for drawing related things, and caching where it allows.
Project#selectedItems was out of sync until the next draw loop.
2013-10-18 21:52:22 +02:00
Jürg Lehni
5db6db3b76 Improve selection serialization to JSON and fix issue in deserialization. 2013-10-18 21:12:25 +02:00
Jürg Lehni
782f5c8f7e Fix issue with reading selected segment points from JSON when there are no handles.
The segment short form was misunderstood by the constructor.
2013-10-18 20:58:06 +02: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
1fc9f882ca Fix a minor bug in CompoundPath#contains(), improve comments and clean up code. 2013-10-18 19:49:05 +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
f8106ae18f Improve code handling special winding cases. 2013-10-18 15:20:32 +02:00
Jürg Lehni
75a209c002 Handle more special cases in winding algorithm. 2013-10-18 15:15:54 +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
eae526f38c Update Numerical.solveQuadratic() / solveCubic() to optionally filter results to be in a given range. 2013-10-18 13:52:01 +02:00
Jürg Lehni
523b9ea592 Fix syntax error. 2013-10-18 11:50:36 +02:00
Jürg Lehni
89704243b1 Simplify Numerical.solveQuadratic() 2013-10-18 11:48:23 +02:00
Jürg Lehni
a07538b205 Use same tolerance in Curve.isLinear() as in Curve#isLinear(). 2013-10-17 20:19:34 +02:00
Jürg Lehni
2a3ede67bb Define more tests for Path#contains(). 2013-10-17 20:18:56 +02:00
Jürg Lehni
085fa3e1c6 Set named arguments at the end, since some depend on geometry to be defined (e.g. #clockwise). 2013-10-17 14:03:05 +02:00
Jürg Lehni
8852cad04f Fix SVGExport tests to work with new Shape code. 2013-10-17 13:12:51 +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
83be3cb023 Fix SVGImport tests to work with new Shape import. 2013-10-17 13:02:35 +02:00
Jürg Lehni
9976033655 Implement serialization of selection. 2013-10-17 12:04:11 +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
c2a34d9f1f Implement an easier approach in serialization to handle the default value of leading. 2013-10-17 11:53:34 +02:00
Jürg Lehni
1eb6b49e8a Allow serialization values to mark themselves as _default.
Solves unnecessarily serialized leading values.
2013-10-17 11:47:46 +02:00
Jürg Lehni
efe8bab129 Revert previous Style change. 2013-10-17 11:40:44 +02:00
Jürg Lehni
7a3448712b Remove duplicate test and clean up code. 2013-10-17 11:32:11 +02:00
Jürg Lehni
2324fbc565 Define correct style default for leading. 2013-10-17 11:14:34 +02:00
Jürg Lehni
922f224cbd Finally remove the _gradientMatrix hack. 2013-10-16 23:47:21 +02:00
Jürg Lehni
9956a6ff51 Implement Shape#toPath(), analogue to Path#toShape().
This way is much simpler though.
2013-10-16 23:44:50 +02:00
Jürg Lehni
51cf1cfec6 Clean up Path#toShape(). 2013-10-16 23:35:50 +02:00
Jürg Lehni
772f8175e4 Remove path to shape guess-work from SVGExport. 2013-10-16 23:21:29 +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
0129080a08 SVG: Add parallelogram to example.
We should really have a test-case in place...
2013-10-16 17:11:15 +02:00
Jürg Lehni
751dfe52ea SVG: Define additional orthogonal check when determining shape type.
Closes #283.
2013-10-16 17:06:29 +02:00
Jürg Lehni
be5a73a61d SVG: Implement support for Shape. 2013-10-16 16:47:00 +02:00
Jürg Lehni
8ab6c61b0d Rename Shape#type to Shape#shape, to avoid clash with Item#type. 2013-10-16 16:46:22 +02:00
Jürg Lehni
3c0d1f26db Replace accidental semi-colon. 2013-10-16 16:14:37 +02:00
Jürg Lehni
953bba4c7b SVG: Use Shape instead of Path constructors for primitive shapes. 2013-10-16 16:12:46 +02:00
Jürg Lehni
392cef3961 Add missing colon. 2013-10-16 16:11:08 +02:00
Jürg Lehni
b581c84d8b Move CompoundPath#reduce() to Item#reduce(). 2013-10-16 16:10:28 +02:00