Commit graph

2773 commits

Author SHA1 Message Date
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
Jürg Lehni
293294a55a Have #_getCachedBounds() return clones of cached items again.
Fixes issue with Tadpoles example.
2013-03-01 16:05:11 -08:00
Jürg Lehni
cd58162dd5 No need to clone _matrix, since _clone() does that for us. 2013-03-01 15:55:19 -08:00
Jürg Lehni
1cd4d278fc Fix issue with path clipping. 2013-03-01 15:30:57 -08:00
Jürg Lehni
5bbbaef618 Include clipMask in serialization. 2013-03-01 15:30:45 -08:00
Jürg Lehni
5527ab1da8 Support point translations for normals defs in SvgImport. 2013-03-01 14:52:20 -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
b79e32194c Fix issue with SVG tests.
Should really look closer at what's going on there.
2013-03-01 14:17:31 -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
b9c58d1732 Fix issue with text positioning.
HTML ignores white space before / after content.
2013-03-01 13:29:48 -08:00
Jürg Lehni
a38809d3e3 Handle viewBox correctly for normal nodes again. 2013-03-01 13:10:05 -08:00
Jürg Lehni
835ca80eff SVG nodeNames are case sensitive. 2013-03-01 12:59:43 -08:00
Jürg Lehni
f1fe2575a8 Remove SVG clipPaths from DOM. 2013-03-01 12:54:27 -08:00
Jürg Lehni
0499dd06f4 Support default black fill when importing SVG. 2013-03-01 12:32:24 -08:00
Jürg Lehni
08fbf0f5b4 Fix Symbol clipping. 2013-03-01 12:14:21 -08:00
Jürg Lehni
1c8e3a5db1 Fix an error in applyTextAttribute() handling. 2013-03-01 12:09:01 -08:00
Jürg Lehni
5501f48570 Move Item#toString() functionality to Base#toString().
For objects that define #_id and/or #_name.
2013-03-01 11:47:49 -08:00
Jürg Lehni
bec61c6829 Implement Symbol clipping and handle positioning correctly.
Complicated stuff...
2013-03-01 11:19:47 -08:00
Jürg Lehni
2706c32924 Implement a way for applyAttribute() methods to query other attributes / styles. 2013-03-01 11:18:50 -08:00
Jürg Lehni
6571c28256 Fold applyAttribute() into applyAttributes(). 2013-03-01 10:31:42 -08:00
Jürg Lehni
417cfde795 Simplify and clean up applyTextAttribute(). 2013-03-01 10:27:19 -08:00
Jürg Lehni
afeb8cbe70 No need to expand CSS 'font' shorthand property, since we're now iterating all style properties. 2013-03-01 10:21:19 -08:00
Jürg Lehni
01026c0896 Fix support for viewBox when importing SVG symbols. 2013-03-01 10:08:17 -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
9379b37d26 Remove accidentally checked in file. 2013-02-28 19:42:07 -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
1a37bb7252 Minor clean up. 2013-02-28 19:14:06 -08:00
Jürg Lehni
027c944d3e Add missing parameters again to viewBox. 2013-02-28 19:14:06 -08:00
Jürg Lehni
f142a9d015 Optimize code a bit by changing parameter sequence. 2013-02-28 19:14:06 -08:00
Jürg Lehni
c29a7e38a0 Improve SvgImport to support styles that come from CSS style sheet rules. 2013-02-28 19:14:05 -08:00
Jürg Lehni
84f3f041e3 Further simplify SVG attribute / style handling by merging in SvgStyles. 2013-02-28 19:14:05 -08:00
Jürg Lehni
8585556584 Use applyAttribute() lookup table in SvgImport instead of switch statement. 2013-02-28 19:14:05 -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
e392496f9d Remove Base.toFloat() and replace with direct parseFloat() calls. 2013-02-28 19:14:05 -08:00
Jürg Lehni
65a9795a8a Rename #from/#toJson() to #import/#exportJson() and move them to Project / Item.
To reflect naming of #import/#exportSvg().
2013-02-25 16:17:33 -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
326d8db4db Do not hittest locked items. 2013-02-24 18:04:20 -08:00
Jürg Lehni
82029652c8 Fix drawing of selected bounds for Path. 2013-02-24 16:26:46 -08:00
Jürg Lehni
0d98727328 Simplify drawing of seleced bounds by having Item#_boundsSelelected default to true for Raster, PlacedSymbol and TextItem.
One can now turn it off for these using item.bounds.selected = false;
2013-02-24 15:53:37 -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
a98e39374d Make PaperScript work again with latest Acorn.js 2013-02-24 15:41:06 -08:00
Jürg Lehni
afac35fabf Improve handling of bounds caching.
Cloning was done in the wrong place.
2013-02-24 14:56:51 -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
ac8c9cd114 Include ChangeFlag.GEOMETRY in Change.CONTENT.
Closes #173.
2013-02-21 00:09:40 -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
9d708f2690 Fix issue in Project#deselectAll(). 2013-02-15 18:21:06 -08:00
Jürg Lehni
23b51915eb Implement CompoundPath#firstSegment, #lastSegment, #firstCurve and #lastCurve. 2013-02-15 18:05:16 -08:00
Jürg Lehni
8f80fa16d2 Correct comment. 2013-02-15 18:01:29 -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
eebcbda9d3 Document 2nd argument in Raster#initialize() as well, and rename arguments. 2013-02-15 08:15:24 -08:00
Jürg Lehni
a688301106 Document Raster#initialize(). 2013-02-15 08:12:58 -08:00
Jürg Lehni
eca4aa8512 Expand shortened variable names. 2013-02-15 00:46:48 -08:00
Jürg Lehni
24a5016470 Reuse scopes associated with canvases to support multiple scripts per canvas.
As described in #171.
2013-02-15 00:15:44 -08:00
Jürg Lehni
8b4104fe19 Use Point#equals() instead of direct comparison. 2013-02-14 22:38:08 -08:00
Jürg Lehni
ace260a334 Determine size of Canvases that are positioned by CSS. 2013-02-14 22:28:50 -08:00
Jürg Lehni
bd5f0691e6 Do not serialize styles on Groups and Layers, since they just unify their children's own styles. 2013-02-14 21:54:52 -08:00
Jürg Lehni
c3b5035aed Fix importing of SVG groups with styles applied to them.
Closes #149.
2013-02-14 21:42:50 -08:00
Jürg Lehni
2607d2c075 Allow setting of styles on empty Groups.
As required by upcoming import SVG fix.
2013-02-14 21:36:58 -08:00
Jürg Lehni
a17068fd42 Style should not be inheriting form Item, but Base instead!
How could we oversee this one?
2013-02-14 21:32:32 -08:00
Jürg Lehni
741c0b7855 Fix error in parsing of empty SVG array attributes. 2013-02-14 21:09:44 -08:00
Jürg Lehni
3aa0166d57 Improve documentation for CharacterStyle#fontSize. 2013-02-14 20:25:40 -08:00
Jürg Lehni
8bdcbe1777 Support units other than 'px' in CharacterStyle#fontSize, but default to 'px' if no unit is specified. 2013-02-14 20:23:13 -08:00
Jürg Lehni
701c5fd9e7 In case of doubleclick mouse events, still fire normal clicks if no doubleclick handler stops event bubbling. 2013-02-14 20:22:47 -08:00
Jürg Lehni
2955b12dd7 Always read canvas attributes to determine view size.
Closes #96.
2013-02-14 20:00:47 -08:00
Jürg Lehni
4cd069b1af Clean up code and add comment about consumed canvas again. 2013-02-14 19:42:20 -08:00
Jürg Lehni
53b36111dd Merge pull request #150 from yscik/rasterize-opacity
Group opacity disregarded in rasterize
2013-02-14 19:40:45 -08:00
Jürg Lehni
334fe99503 Revert recent changes to Item#rasterize() so pull request #150 can be merged. 2013-02-14 19:40:30 -08:00
Jürg Lehni
80638372b6 Merge pull request #169 from a-puzo/master
Fixed bad centering when `view.center` and `view.zoom` are changed
2013-02-14 19:30:26 -08:00
Jürg Lehni
47a3490007 Take item matrix into account in Item#rasterize().
Closes #144.
2013-02-14 19:25:04 -08:00
Jürg Lehni
da08e74374 Clean up code from #156. 2013-02-14 12:50:51 -08:00
Jürg Lehni
6729646e7a Merge pull request #156 from ubershmekel/patch-2
Late load of paperjs should still run paperscripts
2013-02-14 12:49:51 -08:00
Jürg Lehni
ee03ce47e4 Simplify fix proposed in #164. 2013-02-14 12:41:50 -08:00
Jürg Lehni
88a33200c2 Merge pull request #164 from ispivey/fix-svg-getview-error
Update getView to handle DOM elements without getAttribute
2013-02-14 12:40:53 -08:00
Jürg Lehni
366ba2897b Do not blit rasters into separate canvas when they have opacity set.
Closes #166.
2013-02-14 12:28:11 -08:00
a-puzo
66547a4442 Correct view centering
Fixed bad centering when `view.center` and `view.zoom` are changed
2013-02-13 06:35:19 +04:00
Jürg Lehni
66c491a8fd Minor code clean up. 2013-02-12 17:23:56 -08:00
Jürg Lehni
7df4338ef5 Fix linear gradient orientation when shape substitution is applied. 2013-02-12 17:22:31 -08:00
Jürg Lehni
f554bdce2a Fix issues with SVG gradient export. 2013-02-12 17:05:54 -08:00
Jürg Lehni
e9fef8a53c Fix a couple of newly introduced bugs through CanvasProvider change. 2013-02-12 16:23:30 -08:00
Jürg Lehni
ea1e7fccb9 clearRect() needs + 1 for size. 2013-02-12 16:07:24 -08:00
Jürg Lehni
ca3cc7f46d Define CanvasProvider.getContext() next to getCanvas(), and support both types in release(). 2013-02-12 16:06:24 -08:00
Jürg Lehni
51150cb20d Support CanvasProvider.get(width, height) arguments. 2013-02-12 15:57:02 -08:00
Jürg Lehni
9600fdb512 Fix a recently introduce but in Raster#getCanvas(). 2013-02-12 15:54:56 -08:00
Jürg Lehni
357b7dbc54 Shorten CanvasProvider method names. 2013-02-12 15:53:27 -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
053aa15ded Rename Raster's ImageData code from *Data to *ImageData, to avoid clash with future Item#data. 2013-02-12 14:40:55 -08:00
Jürg Lehni
22218e0db0 Simplify Base.serialize(). 2013-02-12 14:16:25 -08:00
Jürg Lehni
80ffd41560 Add optional precision argument to Base.formatFloat(). 2013-02-12 14:16:06 -08:00
Jürg Lehni
85d2700eb1 Implement namespaces for SVG properties in SvgExport. 2013-02-11 19:46:05 -08:00
Jürg Lehni
ee73b4e15b Add some explaining comments to dictionary code. 2013-02-11 19:35:11 -08:00
Jürg Lehni
15554b8bf2 Simplify adding / referencing of JSON dictionary entries. 2013-02-11 19:31:58 -08:00
Jürg Lehni
366524d0a7 Implement JSON serialization for Gradient and GradientColor. 2013-02-11 19:22:18 -08:00
Jürg Lehni
e7bb334c6a Use JSON dictionary support to serialize Symbols and PlacedSymbol references. 2013-02-11 18:59:49 -08:00
Jürg Lehni
00dcd05549 Implement support for dictionary definitions and references in JSON serialization. 2013-02-11 18:59:05 -08:00
Jürg Lehni
aa6e2fae09 Improve Base#equals(). 2013-02-11 18:24:08 -08:00
Jürg Lehni
629e16144a Define #_type property for both Symbol and Gradient and use it in SvgExport. 2013-02-11 18:23:41 -08:00
Jürg Lehni
224563d5f7 Include more Item attributes for serialization. 2013-02-11 17:13:44 -08:00
Jürg Lehni
a043feae76 Implement serialization for TextItem. 2013-02-11 17:08:39 -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
6d39a91c87 Implement simple Project serialization. 2013-02-11 16:43:31 -08:00
Jürg Lehni
e829440803 Have Raster serialize itself.
The source property either contains the link to the external source, or the data url.
2013-02-11 16:43:10 -08:00
Jürg Lehni
e5180e6929 Implement Raster#getElement(), returning either the internal native canvas or image element.
And use it internally in various places.
2013-02-11 16:42:36 -08:00
Jürg Lehni
080a9b220a Handle Raster#onLoad() callback for inlined images.
Code can now switch back and forth between inlined images and external sources.
2013-02-11 16:35:46 -08:00
Jürg Lehni
cf6ba30258 Have Raster#image only return an image, not a canvas element. 2013-02-11 16:34:59 -08:00
Jürg Lehni
0954dc3823 Better deal with security exceptions and missing image data in Raster. 2013-02-11 16:34:31 -08:00
Jürg Lehni
435341f30b Fix name clash due to recent renaming. 2013-02-11 14:36:44 -08:00
Jürg Lehni
efaae62799 Reuse attrs variable. 2013-02-10 19:40:44 -08:00
Jürg Lehni
20011d912a Fix typo. 2013-02-10 19:40:15 -08:00
Jürg Lehni
e0d0eb175a Implement exporting of Gradients to SVG. 2013-02-10 19:38:35 -08:00
Jürg Lehni
199fc046bf Rename 'svg' variables to more meaningful 'node'. 2013-02-10 19:37:19 -08:00
Jürg Lehni
de4e928045 Clean up SvgExport code. 2013-02-10 19:02:53 -08:00
Jürg Lehni
f06701055d Implement exporting of Symbols to SVG. 2013-02-10 10:23:49 -08:00
Jürg Lehni
565fb86430 Give any item / object that needs to be exported as a definition / symbol its own unique id.
This will be useful in SVG and JSON exporter.
2013-02-10 09:37:40 -08:00
Jürg Lehni
49728665e6 Clear definitions lookup at the end of SVG import. 2013-02-09 13:59:04 -08:00
Jürg Lehni
0f846098c4 Support CompoundPath in SvgExport. 2013-02-09 13:38:22 -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
d70fdb69d3 Adapt to recent changes to Matrix#decompose() in SvgExport code. 2013-02-09 12:11:56 -08:00
Jürg Lehni
be3b257175 Restructure Matrix code sequence. 2013-02-09 12:11:19 -08:00
Jürg Lehni
0cf290ff2d More work on Matrix decomposition.
Have Matrix#decompose() return null if decomposition is not possible, separate Matrix#translation from decomposition code as it's always defined, and document methods and properties.
2013-02-09 12:09:55 -08:00
Jürg Lehni
2bb9153810 Fix TODO in Matrix#scale(). 2013-02-09 11:52:31 -08:00
Jürg Lehni
cd9fc39f54 Rename Matrix#setIdentity() to #reset() and document it. 2013-02-09 11:45:33 -08:00
Jürg Lehni
9aaa864f81 Streamline Matrix by removing unnecessary Matrix#setTo*() and Matrix.get*Instance() methods.
Use (new Matrix().*()) instead.
2013-02-09 11:42:55 -08:00
Jürg Lehni
3930a40c7e Implement Matrix#rotate() without relying on Matrix#getRotateInstance(). 2013-02-09 11:40:49 -08:00
Jürg Lehni
53474aa5c0 Put decomposed matrix values in sequence in which they would have to be applied again. 2013-02-09 11:21:16 -08:00
Jürg Lehni
15c8652747 Add support for Raster to SvgExport. 2013-02-09 09:44:25 -08:00
Jürg Lehni
aec13ffd43 Fix all tests for Matrix decomposition. 2013-02-08 23:25:10 -08:00
Jürg Lehni
e438ac8223 Implement proper matrix decomposition and use it in SvgExport. 2013-02-08 23:02:20 -08:00
Jürg Lehni
aec87f4ed1 Fix issues with matrix decomposition.
Work in progress...
2013-02-08 22:17:32 -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
d793d8a43d Clean up code. 2013-02-08 18:17:51 -08:00
Jürg Lehni
bd62b4b819 Do not export paper.load() any more.
Use paper.PaperScript.load() instead.
2013-02-08 18:17:37 -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
75adbd0adc Disable transformation detection for now, until issues with Matrix#getRotation() and Matrix#getScaling() are solved. 2013-02-08 14:36:49 -08:00
Ian Spivey
0df86550e6 Update getView to handle DOM elements without getAttribute, e.g. SVGDocument 2013-01-28 19:08:25 -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
8bab10cb5f Define Item#sendToBack() and #bringToFront(). 2013-01-20 17:08: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
1cc3adfd64 Deselect symbol definitions when setting them, to follow unit tests. 2013-01-20 15:58:15 -08:00
Jürg Lehni
18572276c5 Fix a bug with new _drawCount code.
Make sure items are considered selected right away if they are part of the DOM, even before they are getting drawn for the first time.
2013-01-20 15:56:58 -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
50ee598bca Introduce Project#_drawCount mechanism as a better and more efficient way to filter out selected items that are not currently part of the DOM. 2013-01-20 14:01:43 -08:00
Jürg Lehni
e22b3292ed Define a fallback for #drawSelected(), for classes that don't have it yet. 2013-01-20 14:01:43 -08:00
Jürg Lehni
7756e90ff9 Make sure cloned items do not receive the same name when placed inside the same parent, use numbered versions instead. 2013-01-20 14:01:43 -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
Yuval Greenfield
a3a211eead Late load of paperjs should still run paperscripts
See this problem html http://stackoverflow.com/questions/14110205/dynamically-loading-a-script-changes-its-behaviour/14114337 and note how jquery handle this at https://github.com/jquery/jquery/blob/master/src/core.js#L768
2013-01-02 01:57:30 +02: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
3319488f5a Fix reading of center point in Rectangle constructor. 2012-12-30 18:26:53 +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
d0fff09bb0 Allow creation of rectangles from {point, size} and {center, size} object literals. 2012-12-30 18:17:09 +01:00
Jürg Lehni
24b5f870bd Change Base.isObject() to also check for instances of plain Base objects, and rename it to Base.isPlainObject(). 2012-12-30 17:30:13 +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
fdb4bab479 Improve arguments reading in Line constructors.
Avoid parameter overriding.
2012-12-27 19:12:30 +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