Commit graph

5609 commits

Author SHA1 Message Date
Jürg Lehni
08970abd6d Let paper.install() override existing values... 2011-03-03 18:31:18 +00:00
Jürg Lehni
cbe29fd02b Rename Color#getCssString() to #toCssString(), to go with #toString(). 2011-03-03 17:36:53 +00:00
Jürg Lehni
2f63a65ded Clean up code. 2011-03-03 17:35:59 +00:00
Jürg Lehni
46a0589547 Use Error constructor correctly. 2011-03-03 17:29:40 +00:00
Jürg Lehni
484d74160b Set private properties directly in initialize(), no need to call setters. 2011-03-03 17:27:56 +00:00
Jürg Lehni
0efc23b25c Remove 2nd redundant definition of Gradient#getStops(). 2011-03-03 17:26:30 +00:00
Jürg Lehni
7e52355f93 Rename Doc -> Document since paper code is namespaced now and does not clash with global Document prototype. 2011-03-03 17:23:27 +00:00
Jürg Lehni
fe1a01ecb6 Move paper.populate() functionality back to build.js. 2011-03-03 17:11:14 +00:00
Jürg Lehni
9a9cb91f72 Use the faster Point/Size.create() constructors across the basic classes for higher performance. 2011-03-03 17:07:12 +00:00
Jürg Lehni
dca26949ff Add Size.create(), in analogy to Point.create(). 2011-03-03 17:06:35 +00:00
Jürg Lehni
5508e6eab6 Change scoped compilation of paper so that only a populated paper object is returned to the global scope, but nothing is installed yet. 2011-03-03 16:57:29 +00:00
Jürg Lehni
59dc0ae6d0 Make sure paper.* objects are only installed in the passed object if there is not already something under the same name. 2011-03-03 16:38:04 +00:00
Jürg Lehni
e9881c02fc Merge remote-tracking branch 'origin/master' 2011-03-03 16:33:01 +00:00
Jürg Lehni
5ed30d7089 Make sure all files end on empty line. 2011-03-03 16:32:55 +00:00
Jürg Lehni
dc75e14c59 Make sure utility objects stay in paper scope. 2011-03-03 16:32:39 +00:00
Jürg Lehni
aed8b0a6bc Add utility objects to build. 2011-03-03 16:32:15 +00:00
Jürg Lehni
d088dc629e Rename Paper to paper, implement it as an object literal and add paper.populate() and paper.install() methods that do the bootstraping. 2011-03-03 16:21:17 +00:00
Jonathan Puckey
00bf9aa88c Fall back to Item#bounds if the Item doesn't have Item#strokeBounds in Item#draw. 2011-03-03 17:05:12 +01:00
Jürg Lehni
6923e168ab Scope the compilation of the whole library and inject produced classes into global scope for now, add options later. 2011-03-03 14:09:20 +00:00
Jürg Lehni
80a5e4513e Add preprocessor and build scripts for production of single file Paper.js version, based on previous work for Bootstrap. 2011-03-03 13:45:21 +00:00
Jonathan Puckey
2f9531810c Implement todos about using strokeBounds instead of bounds. 2011-03-03 14:43:37 +01:00
Jürg Lehni
941c3c7346 Declare all classes as local variables, so they can be scoped. 2011-03-03 13:33:41 +00:00
Jürg Lehni
c84df5a346 Use Segment.read() correctly in Path#initialize(). 2011-03-03 13:16:14 +00:00
Jürg Lehni
3a46ac3b54 Allow read() methods to receive an optional length parameter. 2011-03-03 13:15:55 +00:00
Jürg Lehni
ecbd52cdf7 Fix Path.Line() constructor with 4 arguments. 2011-03-03 13:10:29 +00:00
Jürg Lehni
e089e080c2 Make Path#_add() handle both addition and insertion, and use it consequently so segment.path always gets correctly set. 2011-03-03 13:10:17 +00:00
Jürg Lehni
9a2462d147 No need to explicitely call Point#toString() in Segment#toString(). 2011-03-03 13:03:57 +00:00
Jürg Lehni
d4d6d652ec Rename Path#addSegment() to #_add(), to make sure it's supposed to be a private method. 2011-03-03 12:51:47 +00:00
Jürg Lehni
53b091b871 Rename #transformContent() to #_transform(), to make sure it's supposed to be a private method. 2011-03-03 12:47:55 +00:00
Jürg Lehni
1f29f6f104 Improve formating. 2011-03-03 12:46:50 +00:00
Jürg Lehni
b29a87653d Replace % 2 with & 1 (modulo 2). 2011-03-03 12:46:31 +00:00
Jürg Lehni
231343c6a2 Fix context orientation bug correct proberly, by flipping shear values instead of scale values. 2011-03-03 12:34:55 +00:00
Jürg Lehni
490ef78b53 Fix error in CompoundPath#closePath(): Forgot to pass 'this' to getCurrentPath(). 2011-03-03 12:26:28 +00:00
Jürg Lehni
1d37c7b76f Use 'that' variable for private instance method. 2011-03-03 12:25:41 +00:00
Jürg Lehni
26ebe2f2c0 Refacture CompoundPath to only use injection scope for methods that require getCurrentPath(). 2011-03-03 12:23:46 +00:00
Jürg Lehni
07fcc000cf Move the new refactored CanvasDraw functionality to static Item.draw() and #draw() instance methods on each prototype. 2011-03-03 12:19:43 +00:00
Jürg Lehni
54bb4d5527 Merge remote-tracking branch 'origin/master' 2011-03-03 10:55:39 +00:00
Jürg Lehni
964dc462e9 Add comments to Path#strokeBounds and scafolding for #controlBounds too. 2011-03-03 10:55:35 +00:00
Jonathan Puckey
136fe67917 Small change to CanvasDraw. 2011-03-03 02:25:09 +01:00
Jonathan Puckey
8ff04b6614 Unify canvas drawing commands in CanvasDraw.js and rework compositing code. 2011-03-03 02:22:21 +01:00
Jürg Lehni
91ec37de9c Add foundations for Path#strokeBounds support. 2011-03-02 17:27:20 +00:00
Jürg Lehni
620cb2c754 Various clean-ups in Path. 2011-03-02 17:23:45 +00:00
Jürg Lehni
dbbefa9526 index on master: fd4b7b7 Include DocumentView.js in all examples and tests. 2011-03-02 16:22:26 +00:00
Jürg Lehni
ab9d07501e Simplify code a bit, by chainging variable declarations. 2011-03-02 16:08:11 +00:00
Jürg Lehni
5d680b1987 Reformat code and add comment about clearRect dimensions. 2011-03-02 16:07:44 +00:00
Jürg Lehni
f9346a3b7a Simplify code by merging setTransform() / transform() call to one. 2011-03-02 16:06:06 +00:00
Jürg Lehni
8cb3efb28e Simplify calculation of total in getAverageColor(). 2011-03-02 08:53:38 +01:00
Jürg Lehni
98de3cbb2a Simplify getAverageColor() loop. 2011-03-02 08:52:39 +01:00
Jürg Lehni
8c96d91400 Fix errors introduced by bad merge. 2011-03-02 08:52:13 +01:00
Jürg Lehni
3f972be500 Merge remote-tracking branch 'origin/master'
Conflicts:
	src/basic/Matrix.js
	src/item/Raster.js
2011-02-28 23:27:03 +01:00
Jürg Lehni
a93156ec45 Break long lines at 80 chars. 2011-02-28 20:24:15 +01:00
Jürg Lehni
caa6e8f88e Add comment about necessity to write more comments (nudge nudge, wink wink). 2011-02-28 20:23:03 +01:00
Jürg Lehni
aca79fc6a9 Simplify and optimise bounds calculations in Raster#transformContent(). 2011-02-28 20:22:11 +01:00
Jürg Lehni
0305c91e8c Change array format. 2011-02-28 20:21:21 +01:00
Jürg Lehni
d442ab1d71 Replace * 0.5 optimisations with more obvious / 2, as there is no need for such optimisation here. 2011-02-28 20:20:44 +01:00
Jürg Lehni
c3d02bbd16 Add explanatory comments to Raster#transformContent(). 2011-02-28 20:17:59 +01:00
Jürg Lehni
763fc95776 Fix odd issue of Rasters rotating the wrong way, which seems to be caused by Canvas not using the same Matrix orientation as Paper.js (scaleX (m00) and scaleY (m11) need to be flipped). 2011-02-28 20:15:40 +01:00
Jürg Lehni
700f4aeb6a Add #set() function to Point, Rectangle and Size (Matrix has it already). 2011-02-28 20:14:10 +01:00
Jonathan Puckey
14b8452bad Fix mistakes in Tool.js 2011-02-28 19:29:32 +01:00
Jonathan Puckey
1261dc03df Doc: point to the correct performance test url. 2011-02-28 18:41:46 +01:00
Jonathan Puckey
eee5e63a72 BlendMode: support DocumentView and return if an item's bounds is null. 2011-02-28 18:36:06 +01:00
Jonathan Puckey
0e011dee2a Support DocumentView in Group#draw. 2011-02-28 18:35:12 +01:00
Jonathan Puckey
fe9853852a Implement new Doc(size) constructor, Doc#views / Doc#activeView and support DocumentView in Doc#redraw. 2011-02-28 18:34:39 +01:00
Jonathan Puckey
285f81f363 Support PlacedSymbol opacity. 2011-02-28 18:31:51 +01:00
Jonathan Puckey
4fa293ec6d Have Tool convert points from view coordinates to artwork coordinates. 2011-02-28 18:31:03 +01:00
Jonathan Puckey
74f797a9dd Clean up whitespace. 2011-02-28 18:30:08 +01:00
Jonathan Puckey
84e31925b6 Implement DocumentView. 2011-02-28 18:28:16 +01:00
Jonathan Puckey
a7429205ed Allow Matrix#applyToContext to optionally reset the matrix transformation. 2011-02-28 18:27:57 +01:00
Jonathan Puckey
12859d7a24 Item: pass on param object to Item#draw. 2011-02-28 16:41:24 +01:00
Jonathan Puckey
c6d606db0a Path: After calling Path#add(segment), return the added segment. Add todo to Path#insert. 2011-02-27 15:50:41 +01:00
Jonathan Puckey
9496ac70bd Clean up Path.RegularPolygon constructor. 2011-02-26 19:21:52 +01:00
Jonathan Puckey
eebe7e2731 Implement Path.RegularPolygon constructor and add tests for it. 2011-02-26 19:19:02 +01:00
Jürg Lehni
506e7c036c Merge remote-tracking branch 'origin/master' 2011-02-26 17:27:12 +01:00
Jürg Lehni
b1b923ab27 Add comment about problems with Base.clone(). 2011-02-26 17:27:07 +01:00
Jürg Lehni
6d25dbbd22 Add beginning of path length calculations, work in progress. 2011-02-26 17:26:54 +01:00
Jonathan Puckey
461aa87211 Group: add todo. 2011-02-26 15:55:58 +01:00
Jonathan Puckey
9e6fd5a7e7 Speed up CanvasProvider. 2011-02-26 15:29:51 +01:00
Jonathan Puckey
1a6c5c8c6f Doc: Change comment about using canvas.width = canvas.width instead of context.clearRect. 2011-02-26 14:38:50 +01:00
Jonathan Puckey
422b8911b8 Fix PlacedSymbol#transformContent. 2011-02-26 13:33:13 +01:00
Jonathan Puckey
22bccf3a31 Tool: Fix issue with onMouseMove being called while the user is dragging the mouse. 2011-02-26 13:00:55 +01:00
Jonathan Puckey
51f4ee718c As in Scriptographer, we don't worry if there wasn't a moveTo before the first lineTo. 2011-02-26 12:44:09 +01:00
Jonathan Puckey
71bf8dba88 Item: remove logging statement. 2011-02-26 02:04:18 +01:00
Jonathan Puckey
8828ed7e25 CompoundPath - check for this.blendMode != 'normal'. 2011-02-26 01:02:17 +01:00
Jonathan Puckey
bebc8bc8cc Another attempt at fixing Item#transformContent. The bounds are correctly calculated now, but Item#rotate rotates the items in the wrong direction and rotating by a point doesn't work well. 2011-02-26 00:58:54 +01:00
Jonathan Puckey
f79e6a0454 PlacedSymbol & Raster: fix transformContent and support BlendMode. 2011-02-25 19:38:55 +01:00
Jonathan Puckey
049504a67a Changed BlendMode library from code ported from Pixastic to code ported from Gavin Kistner's Context Blender Javascript Library. 2011-02-25 18:37:46 +01:00
Jonathan Puckey
c47a18ea58 BlendMode: add todo about using Item#strokeBounds instead of Item#bounds. 2011-02-25 13:57:01 +01:00
Jonathan Puckey
1c364601b4 Added todo about supporting BlendMode for PlacedSymbols. 2011-02-25 13:28:35 +01:00
Jonathan Puckey
ec0b1dec1d PlacedSymbol: add missing param object to PlacedSymbol#definition#draw call. 2011-02-25 13:13:46 +01:00
Jonathan Puckey
c9d04d33f8 Implement BlendMode class. 2011-02-25 12:47:52 +01:00
Jonathan Puckey
d9b75a7232 Implement Item#reverseChildren() and add tests for it. 2011-02-24 19:31:07 +01:00
Jonathan Puckey
d77741db4f Implement item#rasterize(resolution). 2011-02-24 19:22:19 +01:00
Jonathan Puckey
014d1053a7 Fix Item#isDescendant / Item#isAncestor, implement Item#isGroupedWith and add tests. 2011-02-24 18:09:48 +01:00
Jonathan Puckey
6cea290dd8 Item: add todo's for missing functionalities. 2011-02-24 17:42:32 +01:00
Jonathan Puckey
4d83631230 Segment: remove todo. 2011-02-24 17:14:59 +01:00
Jonathan Puckey
f65625b591 Change CompoundPath#moveBy to be relative to the previous position in lack of an argument. 2011-02-24 17:13:41 +01:00
Jonathan Puckey
ad82be1bec Add CompoundPath#bounds 2011-02-24 17:11:02 +01:00
Jonathan Puckey
95f9028091 Add Point#clone docs to Point.js. 2011-02-24 14:31:32 +01:00
Jonathan Puckey
ebbf8cf039 Add missing introduction to Point.js 2011-02-24 14:30:06 +01:00
Jonathan Puckey
a3ec524722 Add documentation from Point.java to Point.js, remove TODO about adding back center support to Scriptographer for Point#rotate, since it is already there. 2011-02-24 14:28:44 +01:00
Jonathan Puckey
d37a794b64 Simplify Raster#initialize, set _size in Raster#setCanvas and add todo. 2011-02-24 14:15:30 +01:00
Jonathan Puckey
ff2ac484da Raster: add todo and perform small cleanup. 2011-02-24 13:56:27 +01:00
Jonathan Puckey
d564be8a7e Implement new Raster(canvas) / Raster#getSubImage / Raster.drawImage / Raster.ppi. 2011-02-24 13:52:27 +01:00
Jonathan Puckey
f88fcd3049 Implement Point#transform(matrix). 2011-02-24 13:48:24 +01:00
Jonathan Puckey
73df06150a Fix RGBColor#setGray. 2011-02-24 12:58:16 +01:00
Jonathan Puckey
2712bd0419 Fix mistake in Raster. 2011-02-24 02:39:33 +01:00
Jonathan Puckey
41f3f47dd3 Fix small mistakes in Raster. 2011-02-24 01:51:49 +01:00
Jonathan Puckey
83b8a3e815 Optimize CanvasProvider to only expect a Size object. 2011-02-24 01:36:38 +01:00
Jonathan Puckey
c929bacde8 Clean up Group#draw and save/restore context state when drawing group with opacity. 2011-02-24 01:33:36 +01:00
Jonathan Puckey
dc51384a1a Allow CanvasProvider to receive sizes too. 2011-02-24 01:29:51 +01:00
Jonathan Puckey
f1cd24eef8 More work on Raster, including getAverageColor, get/setPixel, get/setSize. 2011-02-24 01:28:11 +01:00
Jürg Lehni
0d53167926 Simplify calculation of bezier polynomial derivative, by dividing all factors by 3. 2011-02-22 10:39:05 +01:00
Jürg Lehni
614f9998de More optimisations in Path#getBounds(). 2011-02-22 10:35:48 +01:00
Jürg Lehni
a08e3dc366 Optimise Path#getBounds() by merging internal f() and bounds() functions and thus reducing calls. 2011-02-22 10:33:46 +01:00
Jürg Lehni
452b1e2792 Add explanations to Path#getBounds(). 2011-02-22 10:25:18 +01:00
Jürg Lehni
e1bcd70059 Simplify Raster#draw(). 2011-02-22 02:27:40 +01:00
Jonathan Puckey
689ddf7555 Raster: implement getPixel and create beans for Raster#canvas and Raster#context that create a canvas object / context when called for the first time. 2011-02-21 19:52:41 +01:00
Jonathan Puckey
cd5b2a7198 PlacedSymbol/ Raster: Use Matrix#applyToContext in draw functions. Also clean up Raster a bit. 2011-02-21 19:04:51 +01:00
Jonathan Puckey
5a786c300b Implement Matrix#applyToContext. 2011-02-21 19:03:57 +01:00
Jonathan Puckey
53b0f8a329 Update comments about implementing getAverageColor(path). 2011-02-21 18:49:44 +01:00
Jonathan Puckey
9324b9918d Implement part of Raster.js 2011-02-21 18:43:56 +01:00
Jonathan Puckey
d0c2c5dd1d Add todo about speeding up canvas clearing. 2011-02-21 03:52:28 +01:00
Jonathan Puckey
b9d37e1b9b Only draw a CompoundPath if it is visible. 2011-02-21 03:52:03 +01:00
Jonathan Puckey
357a8af6ec Clean up white spaces. 2011-02-21 03:32:39 +01:00
Jonathan Puckey
4c84379b5b Remove unused variable. 2011-02-21 03:26:46 +01:00
Jonathan Puckey
514fe1f0e6 Implement group opacity by drawing onto a second canvas first. 2011-02-21 03:22:42 +01:00
Jonathan Puckey
6fcdb86e1c Implement CanvasProvider that provides reusable canvas elements. 2011-02-21 03:17:09 +01:00
Jonathan Puckey
3cd680c5f0 Merge remote branch 'origin/master' 2011-02-21 01:17:26 +01:00
Jonathan Puckey
5e271359b9 Add todo. 2011-02-21 01:16:53 +01:00
Jürg Lehni
77f1e22727 Merge remote-tracking branch 'origin/master' 2011-02-21 00:28:48 +01:00
Jürg Lehni
8cdd7fe2b2 Remove unnecessary call of new Point(). 2011-02-21 00:28:36 +01:00
Jürg Lehni
dc410b6894 Merge rotateAround() and rotate(). 2011-02-21 00:28:13 +01:00
Jonathan Puckey
14943f428f Remove logging statement. 2011-02-21 00:27:02 +01:00
Jonathan Puckey
5dcf416a7a Merge remote branch 'origin/master' 2011-02-21 00:26:03 +01:00
Jonathan Puckey
0458e3d916 Check for null in Color#read. 2011-02-21 00:25:45 +01:00
Jürg Lehni
2ebe4a18da Add Point#isInside(). 2011-02-21 00:24:17 +01:00
Jürg Lehni
04d2ed29c6 Move private createPoint() to Point.create(). 2011-02-21 00:23:36 +01:00
Jonathan Puckey
245c1e9b90 Merge remote branch 'origin/master' 2011-02-20 23:51:56 +01:00
Jürg Lehni
9aabf30800 Optimise Point code more by using an internal createPoint method that bypasses initialize completely. 2011-02-20 23:41:39 +01:00
Jonathan Puckey
4c4b8246ee Make sure the whole canvas is cleared. 2011-02-20 23:31:33 +01:00
Jonathan Puckey
51ab66b0f8 Remove trailing comma in ToolEvent. 2011-02-20 21:22:31 +01:00
Jonathan Puckey
f83309d6b7 Optimize Path#draw. 2011-02-20 20:47:13 +01:00
Jonathan Puckey
cb40d3f6f4 Implement Symbol and PlacedSymbol. Add Document#symbols array. 2011-02-20 18:34:38 +01:00
Jürg Lehni
3374e50def Yet another optimisation in Path#transformContent(): Only transform handles if they are not [0, 0]. 2011-02-20 11:20:23 +01:00
Jürg Lehni
98837cbe98 Further optimise Path#transformContent() by reusing arrays and thus reducing memory footprint. 2011-02-20 11:15:40 +01:00
Jürg Lehni
c89d04dca6 Optimise Path#getBounds() by not relying on Point#add() but instead doing the calculations in direct math in the per-coordinate loop. 2011-02-20 02:05:40 +01:00
Jürg Lehni
6c4121db4b Optimise Path#transformContent() by using Matrix#transform() version that handles arrays of multiple point values for much improved performance. 2011-02-20 01:55:43 +01:00
Jürg Lehni
ed752ed744 Pass ctor.dont to all constructor calls that are followed with explicit initialize() calls afterwards, to make sure it is only called once. 2011-02-20 01:45:53 +01:00
Jonathan Puckey
c0a93a8b66 Setters already handle point conversion. 2011-02-19 22:52:00 +01:00
Jonathan Puckey
10623ddb62 Implement Gradient, GradientColor, GradientStop. 2011-02-19 22:50:37 +01:00
Jonathan Puckey
95fa61f1ba Group: remove unneeded ctx commands. 2011-02-19 18:10:26 +01:00
Jonathan Puckey
a1bec86333 Have Layer extend Group. 2011-02-19 18:09:14 +01:00
Jonathan Puckey
57b7b364bc Nullify cssString cache when color/alpha values change. 2011-02-19 18:01:08 +01:00
Jonathan Puckey
2b1dee1bd4 Add opacity support in Path#draw. 2011-02-19 17:33:23 +01:00
Jonathan Puckey
c2849b3692 Change PathStyle, CompoundPath and Path to work with new Color classes. 2011-02-19 17:25:16 +01:00
Jonathan Puckey
c386f38b86 GrayColor: fix comment. 2011-02-19 17:22:20 +01:00
Jonathan Puckey
068c4dc1ca Add missing Color.js. 2011-02-19 17:10:26 +01:00
Jonathan Puckey
b944b82abe GrayColor: fix comments. 2011-02-19 17:08:08 +01:00
Jonathan Puckey
66105dd4ac Implement Color, RGBColor & GrayColor. 2011-02-19 17:05:39 +01:00
Jonathan Puckey
bd5c906047 Fix error in CompoundPath. 2011-02-19 14:12:05 +01:00
Jonathan Puckey
8af671bb41 Merge remote branch 'origin/master' 2011-02-19 14:07:26 +01:00
Jürg Lehni
451eaaa3c6 Add a TODO comment. 2011-02-19 13:07:24 +01:00
Jürg Lehni
6093151a3b Make sure that setting styles explicitely to null works. 2011-02-18 08:04:20 +00:00
Jürg Lehni
d02b5cd56a Yet another optimisation, by using the Base.each() sidecar (bind object) to fill Item fields, and inject it straight away upon returning from it. 2011-02-18 07:58:59 +00:00
Jürg Lehni
31b595fa9e Rename itemProps to itemFields, for more consistency. 2011-02-17 23:47:04 +00:00
Jürg Lehni
2c06ec965c Simplify PathStyle further, by removing the _get/_setChildrenStyle methods and moving their functionality into the closure injection code. 2011-02-17 23:37:21 +00:00
Jürg Lehni
4e05faaa11 Use the same simplifications in PathStyle as in CompoundPath, and rely on Base.each as well to provide the scope for closure injection. 2011-02-17 23:34:45 +00:00
Jürg Lehni
b14c9ae21b For the closure injection to work properly we need an iterator function that provides a scope to the referenced key value. Rely on Base.each() for this, which even in a scaled down Bootstrap will be available and not harmful, as it won't rely on modified native prototypes. 2011-02-17 23:34:03 +00:00
Jürg Lehni
bc33ae8084 Add missing #closePath() to both Path and CompoundPath. 2011-02-17 23:01:18 +00:00
Jürg Lehni
4c2e1ee5c9 Optimise and simplfy CompoundPath code, by moving scope into extend() call, and only compiling one fields object inside it that is return at the end. 2011-02-17 22:58:56 +00:00
Jürg Lehni
e6dc189310 Simplify injection separation by using multiple arguments to extend(). 2011-02-17 22:46:28 +00:00
Jürg Lehni
5850ef3cfc Seperate Path definition into two parts, one that requires scoped private functions and values, and one that does not, to keep related things closer together and save indentation space. 2011-02-17 20:08:37 +00:00
Jürg Lehni
19121c33b2 Simplify injection of Path constructors. 2011-02-17 20:04:02 +00:00
Jonathan Puckey
637e85b31b Group: fix clipping. 2011-02-17 16:50:06 +01:00
Jonathan Puckey
2a1e00d127 Group: Implement clipping support. 2011-02-17 16:37:29 +01:00
Jonathan Puckey
deb1699f13 Tidy up code. 2011-02-17 16:00:03 +01:00
Jonathan Puckey
36de01a6ae Move Path Constructors into seperate file. 2011-02-17 15:55:26 +01:00
Jonathan Puckey
1953c17f41 CompoundPath: move getCurrentPath into the outer scope and implement smooth and simplify. 2011-02-17 14:33:25 +01:00
Jonathan Puckey
0c1f29ce29 Implement CompoundPath and move most of PathItem into Path. 2011-02-17 13:36:40 +01:00
Jonathan Puckey
7e404703c8 Add Group#getBounds(). 2011-02-17 00:34:01 +01:00
Jonathan Puckey
3ae20c8a4b Item: undo mistaken changes to transform comments. 2011-02-16 22:35:53 +01:00
Jonathan Puckey
13b8ddccc8 PathStyle: small cleanup. 2011-02-16 22:15:19 +01:00
Jonathan Puckey
4000853c2f Implement PathStyle and Document#currentStyle. 2011-02-16 22:09:51 +01:00
Jonathan Puckey
9adb668d2a Group: add missing beans property. 2011-02-16 22:06:24 +01:00
Jonathan Puckey
3e2b4adc27 Layer: implement moveAbove / moveBelow / nextSibling / previousSibling 2011-02-16 18:55:12 +01:00
Jürg Lehni
8a0a0712cd Add Layer#index to override Item#index. 2011-02-16 00:18:58 +00:00
Jürg Lehni
b0b9594f1e Add support for single-parameter calls to scale() and shear(), both in Matrix and Item (supporting optional center parameter too). 2011-02-15 23:23:40 +00:00
Jürg Lehni
99bde74a10 Improve Matrix constructor to read from arrays too. 2011-02-15 23:15:28 +00:00
Jürg Lehni
9d1458e6ae Rely on new Array.isArray() now for array checks. 2011-02-15 23:15:13 +00:00
Jürg Lehni
b8816a07f5 Reformat to fit 80 chars boundary. 2011-02-15 23:10:48 +00:00
Jürg Lehni
9a9005a604 Correct comments about transform flags. 2011-02-15 22:57:12 +00:00
Jürg Lehni
3d64b017c5 Remove comment about having Point.read() return consumed arguments indices, as after analysing the situation it seem too complex to imeplement easly: Point.read internally relies on Point#initialize for all the heavy lifting, and this would have to report back how many indices were consumed somehow... 2011-02-15 22:56:53 +00:00
Jürg Lehni
f0d4374dc4 Improve translate() calls by directly calling Point objects and thus not relying on Point.read() internally. 2011-02-15 22:53:05 +00:00
Jürg Lehni
27f291ec80 Clean up comments. 2011-02-15 22:51:02 +00:00
Jürg Lehni
14bfb4c78e Make Matrix#toString() behave the same as in Scriptographer. 2011-02-15 22:35:25 +00:00
Jürg Lehni
c6b5b11b1e Use dragstart event instead of mousedown, to go with drag and dragend. 2011-02-15 22:32:05 +00:00
Jonathan Puckey
2b626be502 Item: use internal _clipMask variable, so we don't collide with getters/setters. 2011-02-15 12:05:39 +01:00
Jonathan Puckey
24e93bcaf5 Tool#setDocument: remove mousemove functionality for now, since it is interfering with tool.fixedDistance.
Remove events when a tool has been attached to another document before.
When not passed a document in the constructor, use the global Paper.document.
Only redraw the document when the corresponding mousehandler exists.
2011-02-15 00:01:56 +01:00
Jonathan Puckey
3c22aedfbb ToolEvent: fix small mistake. 2011-02-14 23:41:47 +01:00
Jonathan Puckey
30fef4d147 Group: use internal _clipped variable, so we don't collide with getters/setters. 2011-02-14 22:51:31 +01:00
Jonathan Puckey
4395caf41f Tool: add support for Tool#onMouseMove(event) and add RoundedRectangles example 2011-02-14 22:43:14 +01:00
Jonathan Puckey
e36ea0c2e3 Tool: add support for Tool#eventInterval 2011-02-14 22:23:05 +01:00
Jonathan Puckey
a633b2a066 Tool: use dragend instead of mouseup, since mouseup is not fired when the mouse is released outside of the canvas area. 2011-02-14 20:08:19 +01:00
Jürg Lehni
a154819350 Switch to using indexOf() in Segment#index for now. 2011-02-14 10:35:40 +00:00
Jürg Lehni
1d0321bc69 Change Size constructor to reflect logic in Point constructor. 2011-02-14 10:32:42 +00:00
Jürg Lehni
91e8a3b652 Update Bootstrap to fix issues with beans (requiring definition of setter when getter is redefined in sub-class), and remove setBounds in PathItem that was introduced for that reason. 2011-02-14 10:28:27 +00:00
Jürg Lehni
a6e9ee56d4 Cleanup Path constructors by using simple constructor functions instead of Base.extend() classes, use Path.Oval for Path.Circle and optimise Path.Oval through ovalSegments array with real segments (no use to call Segment.read each time). 2011-02-14 02:05:54 +00:00
Jürg Lehni
12d82ece56 Define beans in Matrix. 2011-02-14 01:52:53 +00:00
Jürg Lehni
ed55dc39fb Fix PathItem constructor by no redefining arguments variable that results in arguments array changing as well on some browsers. 2011-02-14 01:47:56 +00:00
Jürg Lehni
38f4dd353d Make Item#bounds setter work for PathItem, and add two TODO comments about Bootstrap shortcommings that cause it to break. 2011-02-14 01:24:22 +00:00
Jürg Lehni
87f146fb44 Have Item#setPosition use Point.read() for point conversion. 2011-02-14 01:17:43 +00:00
Jürg Lehni
50f285798c Fix Item#setPosition and Item#setBounds to actually work (unfinished porting work). 2011-02-14 01:14:43 +00:00
Jürg Lehni
3af5d549f6 Add comments about possible optimisations in PathItem#transformContent(). 2011-02-14 01:14:03 +00:00
Jürg Lehni
ee8c30b518 Implement Matrix, Item#position, Item#bounds (setter too), Item#transform(), Item#scale(), Item#rotate(), Item#transalte() and Item#shear(). Some of it work in progress. 2011-02-14 01:05:16 +00:00
Jürg Lehni
6ef5183731 Fix Rectangle#center (use + instead of -). 2011-02-13 19:22:48 +00:00
Jürg Lehni
20746ad3a7 Clea up white spaces. 2011-02-13 19:21:56 +00:00
Jürg Lehni
420ffaa7ea No need to check for existance of handleIn/Out, as they are always defined. 2011-02-13 18:56:06 +00:00
Jürg Lehni
7370326cb2 Add space after beans: true. 2011-02-13 18:52:17 +00:00
Jürg Lehni
604ff7824c Add comment about ideally not relying on parent.children.indexOf for getIndex(). 2011-02-13 18:51:49 +00:00
Jürg Lehni
eeb7d377e6 Add optional index argument to static read() functions, so points, rectangle, sizes and segments can be read from any index in the arguments array. 2011-02-13 18:15:55 +00:00
Jürg Lehni
08d4826441 Reformating code to follow Scriptotgrapher coding conventions. 2011-02-13 16:26:24 +00:00
Jürg Lehni
4f4261488e Fix issues with _angle caching in Point. 2011-02-13 16:24:39 +00:00
Jürg Lehni
0ac19a8e82 Optimise read() functions to only convert if argument is not of desired type already. 2011-02-13 16:05:19 +00:00
Jürg Lehni
d67055b09b Add documentation to PathItem#bounds. 2011-02-13 15:59:22 +00:00
Jürg Lehni
515439c4df Optimize PathItem#bounds by using less coordinate lookups. 2011-02-13 15:55:43 +00:00
Jürg Lehni
71d1ff3cb3 Make PathItem#getBounds() work for closed paths too. 2011-02-13 15:51:54 +00:00
Jürg Lehni
d59d514a55 Fix bug in PathItem#bounds (wrongly used variable name twice), now works properly for open paths. 2011-02-13 15:49:36 +00:00
Jürg Lehni
e08359f49d Beginning of PathItem#bounds and tests to go along with it, not functional yet. 2011-02-13 15:40:30 +00:00
Jürg Lehni
a30e4057e3 Fix PathItem constructor to support passing of segments both as array and arguments. 2011-02-13 15:39:24 +00:00
Jürg Lehni
771d9d0efe Fix a couple of bugs in shape drawing code, and switch to consistently use this.currentSegment rather than this._segments[this._segments.length - 1], to use the internal check for a starting point. 2011-02-13 15:12:25 +00:00
Jürg Lehni
a579b8bd3d Make sure Segment#handleIn and #handleOut are always defined, even when not provided, and change compareSegments() to also reflect this change by relying on Segment.read for conversion of comparison values. 2011-02-13 15:09:24 +00:00
Jürg Lehni
4b2341b3c2 Add gettter/setters for Path#segments, and fix bug in Segment#previous. 2011-02-13 13:52:51 +00:00
Jonathan Puckey
e2c77a866d Nullify path parent when removed. 2011-02-12 19:45:11 +01:00
Jonathan Puckey
7fdf439ef2 Group: allow passing of array of items to constructor and pass on ctx in draw function. Add tests for Group. 2011-02-12 19:12:23 +01:00
Jonathan Puckey
c1d2cab5d9 Segment.js: fix toString and remove methods. Add test for segment.remove(). 2011-02-12 19:10:19 +01:00
Jonathan Puckey
9b5e18c795 PathItem: replace this.segments.push(segment) to this.addSegment(segment) 2011-02-12 19:08:34 +01:00
Jonathan Puckey
c0e2101c32 Clean up src directory and move Bootstrap.js into lib. 2011-02-12 17:59:39 +01:00
Jonathan Puckey
67f2b146b0 Implement Path#copyTo(itemOrDocument) and Path#clone() 2011-02-12 17:43:51 +01:00
Jonathan Puckey
38ada4abc1 Improve Item#isDescendant(item) and introduce Item#isAncestor(item). 2011-02-12 16:41:57 +01:00
Jonathan Puckey
e9e987f304 Fix Item#isDescendant(item). 2011-02-12 16:36:48 +01:00
Jonathan Puckey
d7fc9cf481 Introduce Paper object that keeps track of documents and which documenti is active. Newly created items are automatically appended to the children list of the active document's activeLayer. 2011-02-12 16:20:10 +01:00
Jonathan Puckey
62409a18d4 Layer.js: pass on ctx in draw function 2011-02-11 18:49:04 +01:00
Jonathan Puckey
d85217c40d Fix small error in Doc.js 2011-02-11 18:46:49 +01:00
Jonathan Puckey
31c51ea9eb Add a layer to the document's children list when created and support activeLayer. 2011-02-11 18:38:44 +01:00
Jonathan Puckey
c9c27f7be2 Initial support for Layer and Group 2011-02-11 18:37:36 +01:00
Jonathan Puckey
d63cac7561 Implement more of Item 2011-02-11 18:36:03 +01:00
Jonathan Puckey
34b9258e8e Have PathItem constructor call this.base() and don't draw item when it is hidden 2011-02-11 18:30:48 +01:00
Jonathan Puckey
b47e896389 Implement Bootstrap.js changes:
Fix Firefox support for beans through __defineGetter/Setter__.
Fix redefinition of properties on Safari through call to delete first.
2011-02-11 18:08:35 +01:00
Jonathan Puckey
0221dd7fb7 Have predefined shape constructors use bean properties 2011-02-11 14:41:32 +01:00
Jonathan Puckey
0f21520800 Implement getters and setters 2011-02-11 14:40:36 +01:00
Jonathan Puckey
59a4c1183b Switch Bootstrap.js version to one with beans support 2011-02-11 14:20:34 +01:00
Jonathan Puckey
e234b3735c Have the predefined shape constructors return a path instead of inheriting from it 2011-02-11 11:49:24 +01:00
Jonathan Puckey
0d1f0bf5a1 Add insert function for PathItem 2011-02-09 01:12:03 +01:00
Jonathan Puckey
440db1c1e3 Remove try/catch clauses and add missing check for existance of onMouseUp 2011-02-09 01:07:29 +01:00
Jonathan Puckey
7e285abe7a Add initial support for mouse events. 2011-02-08 13:15:55 +01:00
Jonathan Puckey
cb5a8aa2fc Rename Doc#draw to Doc#redraw 2011-02-08 13:15:27 +01:00
Jonathan Puckey
cbb10922c5 Include the full Bootstrap library for now to support mouse events. 2011-02-08 13:14:52 +01:00
Jonathan Puckey
5a309f67dc Remove SegmentList.js for now. 2011-02-07 19:53:27 +01:00
Jonathan Puckey
b19ba2014c Initial commit 2011-02-07 19:28:09 +01:00