Commit graph

1101 commits

Author SHA1 Message Date
Jonathan Puckey
1666a36210 Have Item#_getBounds return a normal rectangle when called with includeStroke flag, since Item#getStrokeBounds is read only. 2011-04-28 12:38:57 +02:00
Jonathan Puckey
eed054af17 Item: implement getStrokeBounds, move getBounds functionality into _getBounds with an includeStroke flag. Also simplify the _getBounds code. 2011-04-28 12:33:03 +02:00
Jürg Lehni
d71450c0b1 Make sure selected argument is always a boolean. 2011-04-28 10:05:43 +01:00
Jürg Lehni
a9ea10ca7f Move version of #getBounds() that handles children to Item, to eliminate duplicated code. 2011-04-28 10:04:36 +01:00
Jürg Lehni
6b6f27cb6e Add TODOs about not returning -1 for undefined. 2011-04-27 17:53:59 +01:00
Jonathan Puckey
0700c51a85 Simplifications in Item#isDescendant & Item#isAncestor. 2011-04-27 16:16:05 +02:00
Jonathan Puckey
55fc2bc99c Some minor changes to Item. 2011-04-27 16:10:23 +02:00
Jürg Lehni
bdfe35d93a Consistently name local context variables 'ctx', to save line size and acknowledge the fact that Canvas contexts have a funny API design. 2011-04-26 15:39:16 +01:00
Jonathan Puckey
be8ee90f75 Document: use a hash for Document#_selectedItems to speed up adding to and removing from it. 2011-04-21 20:43:42 +02:00
Jonathan Puckey
cf541901dd Rename getSelected methods to isSelected. 2011-04-21 19:51:49 +02:00
Jonathan Puckey
73b97dbfba Implement segment point selection. 2011-04-21 18:06:06 +02:00
Jonathan Puckey
732caec7bf Speed up drawing of selected items. 2011-04-21 15:48:21 +02:00
Jonathan Puckey
517793c48a Implement Item#get/setDocument and Document#selectedItems. 2011-04-21 15:47:00 +02:00
Jonathan Puckey
1d92aea8e2 Fix Item#setSelected. 2011-04-20 16:00:08 +02:00
Jonathan Puckey
3fcfe3adbb Implement drawing of selection of PlacedSymbol & Raster items. 2011-04-18 18:46:39 +02:00
Jonathan Puckey
be9f312110 Implement a first version of drawing path selection. 2011-04-17 18:46:35 +02:00
Jonathan Puckey
8a113a1c84 Item: clean up white space. 2011-04-12 14:37:52 +02:00
Jonathan Puckey
d02885cba7 Implement Item#isParent and add tests for it. 2011-04-11 19:42:03 +02:00
Jürg Lehni
b5fdecf3d1 Rename ObservedRectangle to LinkedRectangle, ObservedPoint to LinkedPoint, and add more comments about what it is they are doing. 2011-03-22 17:27:46 +00:00
Jürg Lehni
7ae504e51f Add support for Item#removeOnMove(). 2011-03-20 00:11:02 +00:00
Jürg Lehni
1267f41559 Add beginning of ObservedRectangle support and test it in animatedStar example. 2011-03-16 23:32:46 +01:00
Jürg Lehni
d5fa3d7ae6 Merge remote-tracking branch 'origin/master'
Conflicts:
	src/item/Raster.js
2011-03-13 18:34:05 +01:00
Jürg Lehni
9d4af0ce9e Clean up recently caused Base.read() mess by introducing _readNull property,m setting it to true on Color and reverting to previous behavior for Point, Size and Rectangle, where dimensions of 0 are read by default if nothing is provided. 2011-03-13 18:31:00 +01:00
Jürg Lehni
1cd6daada1 Use _item instead of item as internal reference to PathStyle's item. 2011-03-13 18:29:59 +01:00
Jonathan Puckey
d7399926a0 Allow for Raster#setPixel(x, y, color). 2011-03-11 14:23:30 +01:00
Jonathan Puckey
b643fdfc1f Implement Item#removeOn and Item#getId. 2011-03-09 19:35:03 +01:00
Jürg Lehni
c7cefcba3a Merge remote-tracking branch 'origin/master' 2011-03-09 18:17:50 +00:00
Jürg Lehni
427e969d3d Add data access to Raster, untested. 2011-03-09 18:17:12 +00:00
Jonathan Puckey
dae2d6acb1 Remove todo in PlacedSymbol. 2011-03-09 17:09:23 +01:00
Jonathan Puckey
526711ffd4 Fix and improve performance of Raster#getPixel. 2011-03-09 13:38:58 +01:00
Jürg Lehni
72469dc65f Clean up PlacedSymbol constructor, make sure it declares parameters. 2011-03-08 17:21:05 +00:00
Jürg Lehni
456e9f2815 Use variable definition chaining in Raster. 2011-03-08 12:55:34 +00:00
Jürg Lehni
6a67052090 Update copyright / licensing comments. 2011-03-08 01:41:50 +00:00
Jürg Lehni
e1a7aff2f0 Add copyright notice and license file. 2011-03-07 00:50:44 +00:00
Jürg Lehni
87981efeb5 Massive refactoring of transform() / getBounds() code: getBounds() / getStrokeBounds() now supports an optional Matrix parameter which is used to on the fly transform all coordinates and stroke definitions before bounds are calculated. This even supports the correct determination of rotated ellipse bounds for round strokes in symbols. 2011-03-06 21:26:38 +00:00
Jürg Lehni
2d4cf2cc72 Replace beans access to Item#position with getter calls. 2011-03-06 21:12:11 +00:00
Jürg Lehni
deb78b78cf Define fast Rectangle.create() and use it internally where applicable. 2011-03-06 18:45:56 +00:00
Jürg Lehni
162dab66a7 Clean up code. 2011-03-06 15:15:21 +00:00
Jürg Lehni
78c7f645ab Merge remote-tracking branch 'origin/master' 2011-03-06 14:45:57 +00:00
Jürg Lehni
8be1041011 Make style setter calls chainable. 2011-03-06 14:44:54 +00:00
Jonathan Puckey
40b7571489 Move BlendMode into util and add missing var. 2011-03-06 15:44:51 +01:00
Jonathan Puckey
54c1f3d8b1 Fix Raster#setSize. 2011-03-06 15:08:41 +01:00
Jonathan Puckey
336c9e1441 Fix bug in setHidden where Item#visible was being interpreted as a bean. 2011-03-06 14:50:57 +01:00
Jürg Lehni
0a690788ef Allow chaining of Item transform functions. 2011-03-06 11:42:08 +00:00
Jürg Lehni
5392268b83 Remove Raster/PlacedSymbol specific code form Matrix#transformBounds() and use Rectangle#setCenter() instead to center the bounds rectangle on the origin. 2011-03-05 21:05:07 +00:00
Jürg Lehni
3f0a45a7c2 Allow Rasters to be created directly from id strings. 2011-03-05 14:17:32 +00:00
Jürg Lehni
cc134de058 Remove trailing collon. 2011-03-05 13:51:23 +00:00
Jürg Lehni
836ee492ae More beans related refactoring. 2011-03-05 02:40:38 +00:00
Jürg Lehni
e87e7b2582 Move get/setContext to get/setCanvas. 2011-03-05 01:59:01 +00:00
Jürg Lehni
a365bf45a4 Apply the same optimisation from previous commit to Layer. 2011-03-05 01:53:32 +00:00
Jürg Lehni
02bf012aa5 Simplify #appendTop / Bottom and #moveAbove / Bellow by using generator functions. 2011-03-05 01:50:56 +00:00
Jürg Lehni
ce74516228 Remove more beans access, this time related to various PathStyle getters / setters. 2011-03-05 01:36:27 +00:00
Jürg Lehni
c313e702c9 Clean up a whole lot of beans access, and in the process of the refactoring improve canvas, context, size and bounds handling in Raster and PlacedSymbol. 2011-03-05 01:26:12 +00:00
Jürg Lehni
b1027dbb38 Use better variable name. 2011-03-05 00:24:32 +00:00
Jürg Lehni
1d858147ec Stop using style beans internally. 2011-03-05 00:23:16 +00:00
Jürg Lehni
1d866ecb6c Clean up internal properties and beans in Color related classes. 2011-03-05 00:16:26 +00:00
Jürg Lehni
44ab8ed3a0 Refer to currentStyle through getters and setters, not through beans. 2011-03-05 00:03:28 +00:00
Jürg Lehni
be6d60102c Make sure Item#children is always checked for != null and simplify many of the DOM methods. 2011-03-04 21:34:14 +00:00
Jürg Lehni
e66dd46b9c Start improving Item#clone() / #copyTo(). 2011-03-04 20:57:16 +00:00
Jürg Lehni
93c3920505 Add definition of Base.capitalize() and remove dependencies of String#capitalize(). 2011-03-04 19:46:41 +00:00
Jürg Lehni
92bf51a7cc Simplify the way the paper namespace is created and populated. 2011-03-04 13:34:31 +00:00
Jürg Lehni
2b6dede883 Clean up white-spaces and line lengths. 2011-03-03 22:45:17 +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
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
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
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
b29a87653d Replace % 2 with & 1 (modulo 2). 2011-03-03 12:46:31 +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
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
ab9d07501e Simplify code a bit, by chainging variable declarations. 2011-03-02 16:08:11 +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
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
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
285f81f363 Support PlacedSymbol opacity. 2011-02-28 18:31:51 +01:00
Jonathan Puckey
74f797a9dd Clean up whitespace. 2011-02-28 18:30:08 +01:00
Jonathan Puckey
12859d7a24 Item: pass on param object to Item#draw. 2011-02-28 16:41:24 +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
Jonathan Puckey
461aa87211 Group: add todo. 2011-02-26 15:55:58 +01:00
Jonathan Puckey
422b8911b8 Fix PlacedSymbol#transformContent. 2011-02-26 13:33:13 +01:00
Jonathan Puckey
71bf8dba88 Item: remove logging statement. 2011-02-26 02:04:18 +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
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
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
f1cd24eef8 More work on Raster, including getAverageColor, get/setPixel, get/setSize. 2011-02-24 01:28:11 +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
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
357a8af6ec Clean up white spaces. 2011-02-21 03:32:39 +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
cb40d3f6f4 Implement Symbol and PlacedSymbol. Add Document#symbols array. 2011-02-20 18:34:38 +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
c2849b3692 Change PathStyle, CompoundPath and Path to work with new Color classes. 2011-02-19 17:25:16 +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
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
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
9a9005a604 Correct comments about transform flags. 2011-02-15 22:57:12 +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
30fef4d147 Group: use internal _clipped variable, so we don't collide with getters/setters. 2011-02-14 22:51:31 +01: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
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
604ff7824c Add comment about ideally not relying on parent.children.indexOf for getIndex(). 2011-02-13 18:51:49 +00:00
Jürg Lehni
08d4826441 Reformating code to follow Scriptotgrapher coding conventions. 2011-02-13 16:26:24 +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
c0e2101c32 Clean up src directory and move Bootstrap.js into lib. 2011-02-12 17:59:39 +01:00