Commit graph

2773 commits

Author SHA1 Message Date
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
bb546decae Various improvements to Color caching mechanisms. 2013-04-19 12:51:53 -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
517b2ee27f Inline Item.drawSelectedBounds() code. 2013-04-18 17:07:32 -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
d1c6b7134f Fix Raster#getAverageColor() to work with new transforms history code. 2013-04-18 16:50:18 -07:00
Jürg Lehni
c50b940ff3 Fix Item#rasterize() to work with new matrices history code. 2013-04-18 16:23:27 -07:00
Jürg Lehni
1333f59d54 Have CompoundPath always apply transformations by default. 2013-04-18 16:22:21 -07:00
Jürg Lehni
d2b43b043a Fix comment. 2013-04-16 19:41:45 -07:00
Jürg Lehni
96b886ae8d Avoid endless recursion when changing view from onFrame handler.
Closes #184.
2013-04-09 22:38:23 -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
2c3e8a32ab Handle nested matrices correctly when drawing blend modes or transparency.
Closes #194.
2013-04-09 20:01:10 -07:00
Jürg Lehni
f79e561512 Handle bounds correctly for groups with only empty children. 2013-04-09 19:24:41 -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
90cc10cc4b Calculate _globalMatrix for all drawn items and use it for the drawing of selections. 2013-04-09 18:52:47 -07:00
Jürg Lehni
e9aad895ae Import and export Item#data in SVG as well.
Closes #188.
2013-04-09 17:53:26 -07:00
Jürg Lehni
e2a118e43e Make sure color components cannot be anything else than numbers. 2013-04-09 17:43:18 -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
8da8f116d1 Restructure style related class organization. 2013-04-09 17:08:09 -07:00
Jürg Lehni
2d3f9c36eb Update JSDoc and fix documentation issues. 2013-04-09 17:07:41 -07:00
Jürg Lehni
b3b0fa649b Minor Style refactoring clean-ups. 2013-04-09 16:51:57 -07:00
Jürg Lehni
b4a99415d0 Merge PathStyle, CharacterStyle and ParagraphStyle into Style.
Closes #130.
2013-04-09 16:46:20 -07:00
Jürg Lehni
a4f36a59a6 Minor code simplification. 2013-04-09 14:04:25 -07:00
Jürg Lehni
8feb510ea1 Make sure highlight remains an optional component. 2013-04-09 09:34:39 -07:00
Jürg Lehni
9d0b9dc4c6 Allow implicit Gradient declaration in Color object literals. 2013-04-09 09:27:46 -07:00
Jürg Lehni
0d125e1a12 Make sure Gradient#stops and #radial are alway set. 2013-04-09 09:23:08 -07:00
Jürg Lehni
26efbdb451 Implement argument reading for Gradient objects. 2013-04-09 09:20:32 -07:00
Jürg Lehni
b9532f6a1a Rename Color#hilite -> Color#highlight. 2013-04-09 08:51:14 -07:00
Jürg Lehni
10c0a44940 Make sure _components are always defined before parsers are called. 2013-04-09 08:40:09 -07:00
Jürg Lehni
da7b32a18e Clean up code references to GradientColor. 2013-04-09 08:36:17 -07:00
Jürg Lehni
bf21e32082 Implement calling of _removeOwner() for gradients. 2013-04-09 08:36:02 -07:00
Jürg Lehni
9b50020721 Check for gradient Colors correctly. 2013-04-09 08:35:42 -07:00
Jürg Lehni
5550ecaf25 Bring back missing Color constructor documentation. 2013-04-09 08:29:39 -07:00
Jürg Lehni
fd0f4f0929 Remove GradientColor and move all documentation to Color. 2013-04-09 08:23:20 -07:00
Jürg Lehni
a99c91e729 Implement Color component parsers. 2013-04-09 08:17:57 -07:00
Jürg Lehni
d3bb68d0e0 Use faster Array construction. 2013-04-09 07:55:09 -07:00
Jürg Lehni
b3256684fb Make Color#toString() work for gradients. 2013-04-09 01:26:51 -07:00
Jürg Lehni
5209e97c8d Merge GradientColor into Color.
Work in progress.
2013-04-09 01:21:36 -07:00
Jürg Lehni
380fce3946 Simplify GradientColor code before merge with Color. 2013-04-08 23:29:15 -07:00
Jürg Lehni
9cdc4b9372 Switch back to only one Gradient constructor for both linear and radial Gradients. 2013-04-08 20:52:21 -07:00
Jürg Lehni
ca1a395dbd Invert Color#gray component. 2013-04-08 20:20:47 -07:00
Jürg Lehni
727db4c5f2 Further improve Color constructors. 2013-04-08 20:06:29 -07:00
Jürg Lehni
3ffb2e6a75 Refactor Color conversion code. 2013-04-08 19:42:17 -07:00
Jürg Lehni
062abab78b More work on Color refactoring.
Improve backward compatible constructors.
2013-04-08 13:50:12 -07:00
Jürg Lehni
01673d675d Fix issues with new Color serialization. 2013-04-08 13:10:49 -07:00
Jürg Lehni
cf21da75fc Improve Color constructor and simplify serialization. 2013-04-08 07:27:48 -07:00
Jürg Lehni
3a893600ca Handle overlapping HSB / HSL properties and make sure conversions are only performed when needed. 2013-04-08 07:12:50 -07:00
Jürg Lehni
8292112ecd More work on Color and testing. 2013-04-08 07:07:41 -07:00
Jürg Lehni
a48e6e5bf9 More work on Color refactoring. 2013-04-08 00:11:43 -07:00
Jürg Lehni
09824e6b91 More work on Color refactoring. 2013-04-07 23:01:49 -07:00
Jürg Lehni
136c028d29 Increase performance of Style getters / setters. 2013-04-07 17:36:35 -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
232ea221b4 First batch of large Color refactoring and simplification.
Work in progress.
2013-04-07 10:03:51 -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
4bc3882c82 Do not access internal _alpha property. 2013-04-06 18:14:45 +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
9adfc01c8d Handle both strings and objects in Base.importJson().
And keep returning strings from #exportJson().
2013-04-05 16:58:00 +02:00
Jürg Lehni
e63b3a0797 Use short-cut to Math.abs() 2013-03-23 17:05:48 -07:00
Jürg Lehni
d0c763f27d Use CanvasContext#save() and #restore() in Item#rasterize(). 2013-03-19 21:36:11 -07:00
Jürg Lehni
be8b46899d Simplify Matrix#applyToContext() 2013-03-19 21:35:41 -07: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
606389238d Have Color always serialize in non-compact mode. 2013-03-19 18:47:34 -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
9c38a76525 Add support for Item#data serialization. 2013-03-19 17:52:46 -07:00
Jürg Lehni
16b60d1b9e Allow all basic types to properly serialize themselves in non-compact form. 2013-03-19 17:52:17 -07:00
Jürg Lehni
a0066b61c3 Rearrange method sequence in basic types. 2013-03-19 17:51:50 -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
58247ea232 Fix bug in Raster#getSubImage and add test. 2013-03-17 18:57:16 +01:00
Jonathan Puckey
0d3f746c10 Have Raster constructor set Raster#_size to [0, 0] if it was not set. 2013-03-17 17:04:56 +01:00
Jonathan Puckey
5777c7a772 Fix problem where calling new Raster().setSize(size) threw an error. 2013-03-17 16:55:57 +01:00
Jonathan Puckey
f4c1f6a3c1 Remove todo. 2013-03-17 16:40:59 +01:00
Jonathan Puckey
9f466bbc97 Fix mistake in Raster#setPixel. 2013-03-17 16:39:23 +01:00
Jonathan Puckey
1cfe34089a Remove double space in docs. 2013-03-17 15:01:30 +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
2b7f526c62 Fix hit-testing documentation: change options.guide to options.guides. 2013-03-16 14:16:02 +01:00
Jonathan Puckey
b76f69b517 Improve Layer documentation. 2013-03-16 14:03:13 +01:00
Jonathan Puckey
7ee7a26ef4 Improve item documentation. 2013-03-16 14:02:59 +01:00
Jonathan Puckey
b23a4ede56 Improve Group documentation. 2013-03-16 13:44:58 +01:00
Jonathan Puckey
1393825bc2 Add object literal constructor docs to Rectangle. 2013-03-16 13:15:21 +01:00
Jonathan Puckey
c6bcd7d97a Improve Size documentation. 2013-03-16 13:04:33 +01:00
Jürg Lehni
780e842d74 Use === instead of ==. 2013-03-10 20:15:45 -07:00
Jonathan Puckey
28d21bf5b1 Improve Raster documentation. 2013-03-10 23:19:59 +01:00
Jonathan Puckey
d8b0da9103 Fix small bug in Raster constructor. 2013-03-10 22:15:28 +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
71b63b0e9d Fix documentation. 2013-03-10 19:06:37 +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
Jonathan Puckey
fd3fc7f2d7 Implement Item#setParent, making Item#parent writeable. Closes #186. 2013-03-10 15:35:33 +01:00
Jonathan Puckey
25d34be59b Implement Item#data. Closes #188. 2013-03-10 14:59:53 +01:00
Jürg Lehni
b8ca30a4cd Add support for GradientColor object literal constructor.
And introduce getter / setter for #gradient.
2013-03-05 20:41:36 -08:00
Jürg Lehni
1d1e6425fa Remove all left-overs of call chaining, except for where it's in use. 2013-03-05 20:39:07 -08:00
Jürg Lehni
0e72dbd2e0 Rename Color#getCanvasStyle() to #toCanvasStyle(). 2013-03-05 19:58:41 -08:00
Jürg Lehni
52af99de6b Fix issue with click events on items.
Closes #179.
2013-03-05 15:44:22 -08:00
Jürg Lehni
8185cc07e7 Clean up mouse-handling code and add support for Project#options.hitTolerance. 2013-03-05 15:44:03 -08:00
Jürg Lehni
80600d2a2b Fix issue with removeOnMove() calls sometimes removing items too early.
Closes #181.
2013-03-05 15:22:44 -08:00
Jürg Lehni
7ca22cd260 Clean up mouse handling code. 2013-03-05 14:57:41 -08:00
Jürg Lehni
31c06b4a61 Switch to short form of _type for GradientColor, similar to all other colors. 2013-03-05 11:00:50 -08: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
Jonathan Puckey
97451320b9 Fix Item#type documentation. 2013-03-04 10:54:08 +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
Jürg Lehni
7294c5499c Simplify Base.readNamed() methods. 2013-03-03 15:28:55 -08:00
Jürg Lehni
7782116e06 Fix issues with Rectangle constructor.
Reading from { from: , to: } now works as expected.
2013-03-03 15:24:30 -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
378d54b126 Add missing parameter to Symbol constructor docs. 2013-03-03 20:09:14 +01:00
Jonathan Puckey
3cdb11fe36 GradientStop & PathItem example documentation. 2013-03-03 19:47:32 +01:00
Jonathan Puckey
cd94ecd7ca Gradient & GradientColor documentation. 2013-03-03 19:07:09 +01:00
Jonathan Puckey
d4c0386e5b Tool example documentation. 2013-03-03 18:56:11 +01:00
Jonathan Puckey
419d9f21af View example documentation. 2013-03-03 18:46:34 +01:00
Jonathan Puckey
09e4bd0bb4 Improve Path.Constructors example documentation. 2013-03-03 18:34:39 +01:00
Jonathan Puckey
ef75bee1e5 Item documentation. 2013-03-03 18:05:41 +01:00
Jonathan Puckey
91dfc9b1ea Rectangle constructor docs: rename arguments from 'point1, point2' to 'from, to'. 2013-03-03 14:18:11 +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
ae14cedc7f Remove SVG constants, as we don't use them anymore. 2013-03-02 08:11:47 -08:00
Jürg Lehni
0599aabdb9 Handle reinsertion of items into the same children list.
Fixes failing test.
2013-03-01 23:06:29 -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
a63e8ac54c Avoid empty d attributes in SVG nodes, since they throw errors. 2013-03-01 21:29:45 -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
4be5d5086f Introduce project.option.hitTolerance, to control precision of internal hit-tests. 2013-03-01 20:25:46 -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
5140e8f003 Minor changes on documentation. 2013-03-01 20:24:26 -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
5afa1b1688 Allow direct passing of color arguments to gradient constructors as well as arrays. 2013-03-01 17:44:16 -08:00
Jürg Lehni
58fad6ed72 Switch from Gradient#type to separate LinearGradient / RadialGradient classes.
But remain backward compatible through direct calls to Gradient constructor.
2013-03-01 17:39:36 -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