Jürg Lehni
6450430b68
Implement new strategy regarding Project#activeLayer:
...
- By default, no layer is created for any project.
- Project#activeLayer is a getter for the hidden #_activeLayer property. When it is called and no layer exists, one is created on the fly.
- Creating any other items creates a layer if none exists (was already the case).
2014-09-27 22:31:49 +02:00
Jürg Lehni
8b4f59962e
Allow better code compression by removing repeated variable access on this.
2014-09-27 22:00:46 +02:00
Jürg Lehni
762113230a
Implement Item#parentToLocal() and #localToParent()
...
As outlined in #530
2014-09-25 17:53:08 +02:00
Jürg Lehni
7d69ef1864
Fix documentation of bean properties that are not read-only.
...
@bean can only be used when the property is read-only or both getters and setters are present in the scope.
2014-08-26 10:01:30 +02:00
Jürg Lehni
6b4f728a72
Bring back support for paper.setup('id') again, and document it properly.
...
Closes #510 .
2014-08-20 16:53:31 +02:00
Jürg Lehni
48cb05a181
Replace tabs with 4 white-spaces.
2014-08-16 19:24:54 +02:00
Jürg Lehni
3ac9a4f369
Use local parent short-cut variable.
2014-08-15 15:38:28 +02:00
Jürg Lehni
c90a7c9f38
Only use the unmerged setting for #strokeScaling, as otherwise it'll be used on layers and groups already.
...
Closes #500
2014-07-29 23:39:51 +02:00
Jürg Lehni
12254f5fe8
Fix two documentation errors in Raster.
...
Closes #495
2014-07-26 12:07:36 +02:00
Jürg Lehni
56704b9206
Fix a bug in Item#_removeNamed() for items without parents.
...
Closes #490 .
2014-07-25 21:08:14 +02:00
Jürg Lehni
d3d9e4bada
Improve some injection blocks.
2014-07-25 20:05:26 +02:00
Jürg Lehni
3093a8ec43
Introduce matrix.chain(mx) as a shortcut to Matrix.clone().concatenate(mx)
...
Simplifies quite a few lines of code.
2014-07-08 15:43:17 +02:00
Jürg Lehni
66360bf58a
Fix minor documentation bug.
2014-07-08 15:43:17 +02:00
Jürg Lehni
5384a63238
Improve Item. _clearBoundsCache() fix.
2014-05-15 21:33:30 +02:00
Jürg Lehni
a7f57315a6
Fix Item._clearBoundsCache() recursion, correctly this time.
2014-05-15 21:30:06 +02:00
Jürg Lehni
a1c1fc8ed8
Fix an issue in _clearBoundsCache where circular recursion could happen in certain circumstances.
2014-05-15 21:24:09 +02:00
Jürg Lehni
f39b7603de
Remove pixelRatio handling from CanvasProvider and move it to Item#draw()
2014-05-15 17:14:37 +02:00
Jürg Lehni
af5e1609dd
Fix an issue where CompoundPath wouldn't draw correctly if children had styles that forced non-direct compositing.
2014-05-15 17:09:58 +02:00
Jürg Lehni
c0a911d3c7
Rename Raster#ppi to#resolution, and deprecate #ppi.
2014-05-15 15:36:24 +02:00
Jürg Lehni
9d7ec13724
Update prepro.js to version that can evaluate whole expressions, and fix a newly introduced issue with it.
2014-05-14 15:14:03 +02:00
Jürg Lehni
aac98f2b25
Some code clean-up.
2014-05-13 13:54:31 +02:00
Jürg Lehni
6896535663
Bring back accidentally removed ctx.beginPath();
2014-05-13 13:51:09 +02:00
Jürg Lehni
846c806034
Implement non-scaling strokes through Style#strokeScaling.
...
Closes #418 .
2014-05-13 13:38:51 +02:00
Jürg Lehni
e1ed7f3294
Prevent drawing selected compound path children twice.
2014-05-12 18:57:09 +02:00
Jürg Lehni
6aaeb81869
Simplify Item#_isUpdate() code a bit.
2014-05-07 17:27:53 +01:00
Jürg Lehni
bb6e1e686f
Improve some comments.
2014-05-07 17:22:25 +01:00
Jürg Lehni
56389a3929
Make sure _updateVersion also works for items and children of items with opacity == 0.
...
Closes #469 .
2014-05-07 16:57:39 +01:00
Jürg Lehni
312e670b22
Update Item#_updateVersion in Item#draw() before bailing out when items are invisible.
...
Closes #469 .
2014-05-05 20:13:36 +02:00
Jürg Lehni
8317aacc1b
Split Item#hitTest() into separate private function that does need to do arguments reading, for improved performance also when iterating over children.
2014-04-29 20:06:48 +02:00
Jürg Lehni
fce31599a5
Use _dontMerge for #getSelectedColor() on both item and layer, and have style getters on item pass on _dontMerge to the style object.
2014-04-29 19:40:46 +02:00
Jürg Lehni
bd07305435
Move selection drawing code to separate function and fix slowdowns in determining of selection color.
...
Closes #466 & #464 .
2014-04-29 18:52:33 +02:00
Jonathan Puckey
1d905f5c58
Path: add docs for Style Tests group and move Path#isInserted() to Hierarchy Tests group.
2014-04-28 18:41:40 +02:00
Jonathan Puckey
ba98c91509
Fix SVGElement parameter type in docs.
2014-04-28 18:23:14 +02:00
Jürg Lehni
e851090c81
Fix bug in item object literal constructor when providing parent as property after other values that depend on hierarchy being defined already.
2014-04-28 15:12:55 +02:00
Jürg Lehni
42945825e8
Fix all argument assignment TODOs.
2014-04-28 14:22:50 +02:00
Jonathan Puckey
af84a52af8
Move around Item#isInserted() code so it shows up in the Tests group section in the docs.
2014-04-27 23:59:01 +02:00
Jonathan Puckey
12d7756892
Add more matching docs.
2014-04-27 23:40:43 +02:00
Jürg Lehni
9ccba17fbe
Clean up white-space, comments and jshint errors.
2014-04-14 18:29:26 +02:00
Jürg Lehni
d0d4b29856
Fix bugs in bounds caching algorithm.
2014-04-13 18:31:01 +02:00
Jürg Lehni
6af797bbad
Optimize handling of property object in Item constructor.
...
Only check for values if it is a plain object, and avoid inserting into DOM twice if parent is specified.
2014-04-13 18:12:19 +02:00
Jürg Lehni
ee729622e0
Correctly handle Raster#setImage(null)
2014-04-13 18:11:34 +02:00
Jürg Lehni
ea81df6572
Fix spelling mistakes.
2014-04-13 17:03:44 +02:00
Jürg Lehni
db2bdf84af
Allow the JS optimizer to better do its thing by creating local references to repeatedly used class variables.
2014-04-13 16:44:49 +02:00
Jürg Lehni
397c81e060
Switch from options.type to options.class in Item#hitTest(), to reflect recent change in Item#getItems().
2014-04-13 16:43:20 +02:00
Jürg Lehni
a931a2530c
Implement options.curves
option for hit-testing curves regardless of stroke settings.
2014-04-11 14:57:58 +02:00
Jürg Lehni
1f7cb30fa5
Correctly transform Item#pivot when #matrix is applied to an item's contents.
...
Closes #452 and defines unit tests to cover this bug.
2014-04-11 13:18:27 +02:00
Jürg Lehni
eea4e533a4
Support type: Class
filters in hit-testing code too.
2014-04-10 22:27:03 +02:00
Jürg Lehni
61c2b11938
Serialize #applyMatrix before #matrix, because in deserialization its setting will affect how #matrix is read.
...
Closes #451 .
2014-04-09 11:57:25 +02:00
Jürg Lehni
60f6eca6c4
Do not keep the view's matrix baked into _globalMatrix, since we might allow multiple views soon.
2014-04-07 17:35:17 +02:00
Jürg Lehni
f002c633a7
Remove trailing white spaces and ensure newlines at the end.
2014-04-06 13:48:03 +02:00
Jürg Lehni
09d0f5f389
Correctly handle paths with only one segment in hit-testing code.
...
Closes #430 .
2014-04-04 12:08:20 +02:00
Jürg Lehni
c0d11ea98e
Fix hit-testing of PlacedSymbols.
...
Closes #428
2014-04-03 09:21:12 +02:00
Jürg Lehni
ee7c604ec0
Remove unused matrix parameter in PlacedSymbol#_hitTest()
2014-04-03 09:19:36 +02:00
Jürg Lehni
748256abb9
Fix broken documentation for Item.
2014-04-02 21:04:39 +02:00
Jürg Lehni
59da291d54
Remove tabs in examples in favor of 4 spaces.
...
To remove all these annoying JSHint complaints.
2014-04-02 21:03:35 +02:00
Jürg Lehni
fa9786b344
Switch to new simpler convention for control of beans creation in straps.js
2014-04-02 20:53:18 +02:00
Jürg Lehni
4d52867b4a
Fix spelling mistakes and white-spaces.
2014-04-02 20:52:13 +02:00
Jürg Lehni
0dca10d192
Take view#matrix into account when calculating and handling global matrices.
...
But make sure Item#globalMatrix returns a transformation without View#matrix factored in. Closes #440 .
2014-03-31 19:28:00 +02:00
Jürg Lehni
e0120b8f58
Fix spelling mistakes.
2014-03-31 18:13:54 +02:00
Jürg Lehni
92331a62c3
transformations will always be defined at this point of the code.
2014-03-31 18:13:36 +02:00
Jonathan Puckey
400bc69159
Remove unnecessary commas.
...
Found using jscritic.com.
2014-03-28 14:02:39 +01:00
Jonathan Puckey
01dbfe705c
Fix accidental leaking of variables to the global scope.
...
Found using jscritic.com
2014-03-28 13:46:51 +01:00
Jürg Lehni
7233c82084
Fix wrong call of _clearBoundsCache() on child.
...
Closes #426 .
2014-03-20 17:20:26 +01:00
Jürg Lehni
aeeba4d58d
Implement ChangeFlag.INSERTION notification to know when an item was inserted in a new parent inside the DOM.
2014-03-18 15:28:29 +01:00
Jürg Lehni
946e0d5b2c
Fix spelling mistakes.
2014-03-18 15:25:25 +01:00
Jürg Lehni
e998083156
Rename Shape#shape to Shape#type.
2014-03-18 12:47:54 +01:00
Jürg Lehni
09d90a21bc
Support legacy #type filtering again in #getItems(), and offer an alternative through instanceof checks with #class and #constructor property.
2014-03-18 12:39:55 +01:00
Jürg Lehni
62f7b0d73e
Simplify and merge Item#getItems() code with Project#getItems()
2014-03-18 11:47:50 +01:00
Jürg Lehni
833d71f7ea
Remove Item#type and replace it with Item#className, the non-hyphenated version of #type.
2014-03-18 11:42:38 +01:00
Jürg Lehni
f115072e8c
Rename HIERARCHY change-flag to more precise CHILDREN.
2014-03-17 18:59:10 +01:00
Jürg Lehni
0aa73d90c5
Change the way context dependent font sizes are handled by delegating handling to view.
...
Closes #425
2014-03-17 16:41:57 +01:00
Jürg Lehni
438de7013a
Correctly handle groups as clipping masks.
...
Closes #370 .
2014-03-17 14:51:47 +01:00
Jürg Lehni
0fe52a7d39
Implement an optimization in _changed() notifications where not all curves need to updated if only segments change that already have told their curves about the change.
2014-03-17 14:35:33 +01:00
Jürg Lehni
d594b4264d
Define settings.applyMatrix and inherit at Item creation time.
2014-03-04 09:30:04 +01:00
Jürg Lehni
7dbf6ceaff
Move Project#options to PaperScope#settings and define reasonable defaults.
2014-03-04 09:29:28 +01:00
Jürg Lehni
36e3cbddf2
Remove inheritance of Item#applyMatrix setting again.
...
Implementation cannot be solved well, since hierarchy is not known at creation time of item.
2014-03-02 21:00:08 +01:00
Jürg Lehni
80a725d08a
Rename Item#transformContent to the more correct Item#applyMatrix
2014-03-02 16:04:17 +01:00
Jürg Lehni
fb1420eee0
Internalize Item#applyMatrix() code in #transform() and add short-cut method to it in Matrix#apply()
2014-03-02 15:50:45 +01:00
Jürg Lehni
6fdb9f60bd
Merge branch 'refs/heads/master' into apply-matrix
2014-03-02 01:27:50 +01:00
Jürg Lehni
7bf9cc88e4
Merge pull request #387 from mgrabovsky/master
...
Fix typo in comment
2014-03-02 01:05:21 +01:00
Jürg Lehni
4ba17127aa
Make sure that #transformContent can only be set to true on items that actually support it.
2014-03-01 23:24:33 +01:00
Jürg Lehni
1a836a168f
Merge branch 'refs/heads/master' into apply-matrix
...
Conflicts:
src/item/Item.js
2014-03-01 22:55:54 +01:00
Jürg Lehni
a8578326ea
Inherit #transformContent setting from parent, if not explicitely defined.
2014-03-01 22:52:00 +01:00
Jürg Lehni
dad7821ee9
Include Item#transformContent in serialization and cloning.
2014-03-01 22:51:01 +01:00
Jürg Lehni
7cf4591a1e
Define Item#style before calling #addChild() in #initialize(), to avoid issues with layers.
2014-03-01 22:49:46 +01:00
Jürg Lehni
a3114e5c28
Do not preserve matrix transformations in empty groups when applied to inexisting content.
2014-03-01 22:48:44 +01:00
Jürg Lehni
c1ccdf6cb7
Take into account the view's resolution in Item#rasterize()
2014-02-26 16:20:19 +01:00
Jürg Lehni
ec0877962b
Expose the view's pixel-ratio and resolution through View#pixelRatio and View#resolution
2014-02-26 16:19:48 +01:00
Jürg Lehni
ccfd51a65a
Improve performance of Path constructors and handling of { insert: false } Item creation.
2014-02-26 16:15:51 +01:00
Jürg Lehni
737466d15c
Fix all faulty {@true} doc statements.
2014-02-26 15:39:00 +01:00
Jürg Lehni
bf50bd649a
Fix issue in Item#rasterize() when resolution is not 72 DPI.
...
Closes #412 .
2014-02-26 11:54:14 +01:00
Jürg Lehni
86e4d2a6b9
Implement Curve#remove() and Path#reduce().
...
Also have Item#reduce() recursively call #reduce() on reduced children.
2014-02-20 02:50:39 +01:00
Jürg Lehni
74a153dd88
Some code clean-up.
...
More to come.
2014-02-17 20:59:38 +01:00
Jürg Lehni
568bb06853
Add comments about missing #importSVG() documentation.
2014-02-12 09:39:34 +01:00
Matěj Grabovský
890eda9197
Fix typo in comment
2014-01-15 18:04:51 +01:00
Jürg Lehni
5a131930fb
Add _dontNotify parameter to Matrix#reset() and use it in Item#applyMatrix()
2014-01-06 00:18:40 +01:00
Jürg Lehni
6ad2105110
Replace delete in favor of setting to undefined to prevent V8 deoptimization.
2014-01-05 19:16:48 +01:00
Jürg Lehni
706fe2c77d
Rearrange Base.read argument sequence.
...
options are used more often than length.
2014-01-05 18:31:24 +01:00
Jürg Lehni
b66c41e1c9
Remove need for arguments[1] in Item#transform()
2014-01-05 18:05:47 +01:00
Jürg Lehni
8d08d3c014
Remove the need for arguments[0] in bounds getters.
2014-01-05 18:01:38 +01:00
Jürg Lehni
e3f3a9c9d2
Merge branch 'refs/heads/master' into v8-optimizations
2014-01-05 17:42:59 +01:00
Jürg Lehni
1ee5b2c126
Fix references to Bootstrap.js in comments.
2014-01-05 17:41:38 +01:00
Jürg Lehni
6cb25fafe3
Use changes in latest Straps.js to remove as many hidden parameters as possible.
...
Hidden parameters through arguments[] are bad news for JS optimizer engines.
2014-01-05 17:40:54 +01:00
Jürg Lehni
ea63d4c288
Merge branch 'refs/heads/master' into v8-optimizations
...
Conflicts:
src/core/Base.js
src/style/Color.js
2014-01-05 05:01:13 +01:00
Jürg Lehni
e22fa3a664
Update copyright notice.
2014-01-04 01:47:16 +01:00
Jürg Lehni
ad34bbf7aa
Bail out of Item#transform() immediately if there is nothing to do.
2014-01-02 21:47:00 +01:00
Jürg Lehni
c197f531a4
Implement options.asString for Item#exportJSON()
2013-12-30 23:34:19 +01:00
Jürg Lehni
81651a7379
Prevent V8 "assignment to parameter in arguments object" deoptimizations.
...
Some getter-like functions still need fixing, but this might require a fix in Straps.js first.
2013-12-17 23:28:55 +01:00
Jürg Lehni
3dbad9c477
Replace delete in favor of setting to undefined to prevent V8 deoptimization.
2013-12-17 23:27:48 +01:00
Jürg Lehni
e2b06b8e54
Filter out insert property in Item#set()
2013-12-16 22:03:33 +01:00
Jürg Lehni
a51f8d4ee8
Rename Item#anchor -> Item#pivot
2013-12-13 20:50:58 +01:00
Jürg Lehni
25d8b1f0d2
Clean up code and comments in various places.
2013-12-11 17:10:09 +01:00
Jürg Lehni
3ff4a6d801
Use Point.read() for center parameter in Item#rotate
2013-12-11 17:09:03 +01:00
Jürg Lehni
da427e969b
Make hit-tests work again with projects that don't have a view.
...
Fixes broken tests.
2013-12-11 17:08:36 +01:00
Jürg Lehni
97f7204eab
Write documentation for Item#anchor.
2013-12-11 16:23:30 +01:00
Jürg Lehni
42788a5bf7
Keep support for Item#registration for now as well, since there are some scripts on the mailing list that use it.
2013-12-11 15:08:56 +01:00
Jürg Lehni
78a2685324
Rename Item#registration to Item#anchor
2013-12-11 14:59:51 +01:00
Jürg Lehni
e2b48ebf33
Allow layers to select children again, since it breaks examples otherwise.
2013-12-10 23:55:41 +01:00
Jürg Lehni
9501fd1924
Make hit-test tolerance dependent of view#matrix
2013-12-10 22:53:03 +01:00
Jürg Lehni
9177bac125
Use same stroke tolerance approach for hit-testing joins and caps as well.
2013-12-10 14:23:05 +01:00
Jürg Lehni
7c28c7e9e3
Do not factor in view matrix into Item#globalMatrix.
...
Instead concatenate it when drawing selections.
2013-12-10 13:18:21 +01:00
Jürg Lehni
48c8946f9e
Implement correct hit-testing tolerance using transformed 2D stroke padding rather than unscaled numerical tolerance.
...
But we still need to factor in the View zoom as well...
2013-12-10 12:52:42 +01:00
Jürg Lehni
3d868ae400
Fix issue with cached internal bounds and #transformContent == true.
2013-12-10 12:51:49 +01:00
Jürg Lehni
48b7b740ad
Allow the creation of internally used items with no ids.
2013-12-10 11:07:14 +01:00
Jürg Lehni
642111a7a2
Fix error in #getGlobalMatrix()
2013-12-09 19:33:50 +01:00
Jürg Lehni
b7943239eb
Implement cached getInternalRoughBounds as well.
2013-12-09 19:33:34 +01:00
Jürg Lehni
7278ee4374
Make JSON serialization work for Shapes.
2013-12-09 17:27:41 +01:00
Jürg Lehni
94d5a09b7b
Do not inherit selection behavior from Group in Layer.
2013-12-09 15:10:09 +01:00
Jürg Lehni
e238d23194
Implement caching of internal, untransformed bounds.
2013-12-09 10:53:19 +01:00
Jürg Lehni
81fe98d1bb
Make cachedBounds mechanism work for Symbols.
2013-12-09 09:05:29 +01:00
Jürg Lehni
f8f60ec603
Fix slow-down in bounds caching.
2013-12-09 08:58:37 +01:00
Jürg Lehni
2cd3de8188
Improve versioning of _globalMatrix
2013-12-09 07:51:28 +01:00
Jürg Lehni
064d632d65
More matrix related clean-ups.
2013-12-08 22:12:36 +01:00
Jürg Lehni
238f577e6f
Clean up _getCachedBounds() code.
2013-12-08 22:06:32 +01:00
Jürg Lehni
516b9d040f
Apply matrices before calculating boolean path operations.
2013-12-08 21:39:56 +01:00
Jürg Lehni
24ce35cc6e
Make sure items removed from DOM remove all their events and reinstall them again when reinserted.
...
Closes #254 .
2013-12-08 20:40:30 +01:00
Jürg Lehni
97fcd6ff38
Implement Item#getGlobalMatrix(), #globalToLocal() and #localToGlobal()
...
Closes #270 .
2013-12-08 20:04:10 +01:00
Jürg Lehni
6e5d8939d5
Rename View#draw() -> View#update() and remove checkRedraw argument.
...
We always check for changes, since change propagation should work reliably.
2013-12-08 19:15:58 +01:00
Jürg Lehni
c75d48cf98
Fix comments.
2013-12-08 18:45:11 +01:00
Jürg Lehni
afe00add32
Implement option.type filtering in #hitTest() functions.
2013-12-08 16:32:42 +01:00
Jürg Lehni
61f2f5c978
Put constructors into separate ctor variables when handling dontLink parameters before creating objects.
...
This hopefully solves the mysterious issue #360 on Chrome.
2013-12-07 20:03:23 +01:00
Jürg Lehni
acc0e80d78
Implement registration point for all items.
...
Allowing any item to use another point than the center as its anchor point for item.position.
2013-12-07 19:46:12 +01:00
Jürg Lehni
2401b38b03
Fix issue with group.position not updating when content changes.
2013-12-07 19:17:59 +01:00
Jürg Lehni
758c9b6146
Improve caching of decomposed transformation values.
2013-12-07 12:47:16 +01:00
Jürg Lehni
9ca92165ee
Expose rotation and scaling transformations through Item#rotation and Item#scaling properties, by moving the setters from Matrix to Item.
2013-12-07 12:16:11 +01:00
Jürg Lehni
3d94ff6968
Only decompose matrix if there are bounds to be reused.
2013-12-07 05:50:08 +01:00
Jürg Lehni
1ba77f9d40
Implement Item#skew() and clean up Item transformation functions documentation.
2013-12-07 05:21:27 +01:00
Jürg Lehni
2d307f0e7c
Only preserve bounds if there is no shearing in the transformation.
...
Closes #358 .
2013-12-07 05:19:49 +01:00
Jürg Lehni
7e9989c6b9
Improve comment about globalMatrix.isInvertible() check.
2013-12-06 13:41:57 +01:00
Jürg Lehni
92590b160c
Implement Canvas Path caching again using Context#currentPath.
2013-12-06 12:49:46 +01:00
Jürg Lehni
550749d057
Avoid issues with _matrix being undefined when items are created and added in a certain sequence.
...
Closes #279 .
2013-12-03 23:14:34 +01:00
Jürg Lehni
fc02c58ddb
Implement asynchronously loading Rasters from disk and remote locations for Node.js
...
Closes #328 .
2013-12-03 23:07:54 +01:00
Jürg Lehni
dcad9d44ed
Copy over parent style in Item#reduce().
...
Only really needed for CompoundPath...
2013-11-30 14:02:54 +01:00
Jürg Lehni
93d10983ee
Update to latest Prepro.js and switch from global options object to __options, to avoid name clashes.
2013-11-29 20:26:38 +01:00
Jürg Lehni
1149399690
Add missing DOCS comments.
2013-11-29 18:50:04 +01:00
Jürg Lehni
7e65426158
Implement Item#data cloning.
...
Closes #340 .
2013-11-28 22:27:14 +01:00
Jürg Lehni
593e0d8d7f
Remove Base.merge() and use a new Straps.js feature instead.
...
A more clever Base() constructor that allows merging.
2013-11-28 22:20:00 +01:00
Jürg Lehni
c0e8285c07
Fix setting #radius on Shape.Circle.
2013-11-28 18:03:41 +01:00
Jürg Lehni
18db7c0d56
Fix issue with items with frame events never being removed from _frameItems list.
2013-11-27 12:38:56 +01:00
Jürg Lehni
97d94e8401
Allow Path#transformContent to be set to false too.
2013-11-26 23:12:55 +01:00
Jürg Lehni
b96f9ff57b
Rearrange method sequence in Item.
2013-11-26 19:27:09 +01:00
Jürg Lehni
56f25e8742
Implement change propagation in matrices.
2013-11-26 19:03:58 +01:00
Jürg Lehni
da9e1f8de7
Define Project#isEmpty()
2013-11-24 22:53:41 +01:00
Jürg Lehni
af4410953f
Various clean-ups regarding the handling of activeLayer, JSON deserialization, DOM insertion and and layer reusing.
...
JSON deserialization does no longer insert items into DOM twice now, and should therefore be faster.
2013-11-24 16:25:13 +01:00
Jürg Lehni
5439f6ba45
We need to take pixel ratio into account when directly blitting blend-modes onto canvas.
2013-11-06 13:11:54 +01:00
Jürg Lehni
d6be004ee6
Setting a matrix on an item with #transformContent = true should immediately apply it.
2013-11-04 11:43:17 +01:00
Jürg Lehni
b8ab0f36f9
Remove unused local variable and comment.
2013-11-02 20:37:23 +01:00
Jürg Lehni
132f54d362
Define Item#clear() as an alias for Item#removeChildren(), or Path#removeSegments() for paths.
2013-11-01 17:52:27 +01:00
Jürg Lehni
c76dae5b06
Implement a new strategy for importing JSON, where it is imported into the item itself, not its children list, if the class match.
2013-11-01 11:26:11 +01:00
Jürg Lehni
2a9fe48cc9
Add options.matchShapes support to #exportSVG and improve documentation of various import / export functions.
2013-10-30 16:18:59 +01:00
Jürg Lehni
5d7c7a2409
Improve documentation of #hitTest()
2013-10-30 16:18:15 +01:00
Jürg Lehni
2a88042315
Handle importing of SVG gradients for shapes, and drawing of canvas gradients correctly.
...
Closes #312 .
2013-10-30 01:25:13 +01:00
Jürg Lehni
eecf68b7c3
Clear ctx.shadowColor after ctx.fill() to avoid application to both fill and stroke.
...
Closes #314 .
2013-10-30 00:00:04 +01:00
Jürg Lehni
1871e2f7c4
Improve comments.
2013-10-29 21:18:09 +01:00
Jürg Lehni
fd96447ac1
Share ellipse reading code between Shape.Ellipse and Path.Ellipse.
2013-10-29 21:15:28 +01:00
Jürg Lehni
aca9968164
Simplify Shape#_contains() code.
2013-10-29 21:09:11 +01:00
Jürg Lehni
4333334014
Simplify Shape#hitTest() code.
2013-10-29 21:06:58 +01:00
Jürg Lehni
6fba727600
Add DOCS comments.
2013-10-29 21:00:24 +01:00
Jürg Lehni
f8d960d834
option.tolerance should always be defined in _hitTest()
2013-10-29 21:00:17 +01:00
Jürg Lehni
ae4ddaeae5
Implement correct hit-tests for rounded rectangle Shape items.
2013-10-29 20:58:30 +01:00
Jürg Lehni
c43752dc3e
Use #hasFill() and #hasStroke() more broadly and avoid drawing strokes when strokeWidth is set to 0.
2013-10-29 20:05:39 +01:00
Jürg Lehni
94623f6d3f
Keep radius and size in sync in Path.Rectangle.
2013-10-29 19:42:33 +01:00
Jürg Lehni
b86b66d43d
Improve documentation.
2013-10-29 19:25:10 +01:00
Jürg Lehni
7f8d9d9e90
Support options.tolerance in Shape#hitTest()
2013-10-29 19:17:42 +01:00
Jürg Lehni
9d60662a28
Check for the occurrence of 'radius' rather than 'center' when deciding to read a center / radius pair for ellipses.
2013-10-29 18:53:55 +01:00
Jürg Lehni
c3aed5277d
Use center and radius in all ellipse code, rather than bounding rect.
...
Simplifies things.
2013-10-29 18:10:30 +01:00
Jürg Lehni
04286bc1e0
Fix issue with param.trackTransforms
...
We can only pop() if we push()
2013-10-29 17:56:43 +01:00
Jürg Lehni
b2188be567
Make sure _globalMatrix is not set to false values in Item#rasterize().
2013-10-29 17:37:45 +01:00
Jürg Lehni
d649b1bb21
Define insert argument for Path#toShape() and Shape#toPath()
2013-10-29 16:45:50 +01:00
Jürg Lehni
5a462f42b7
Improve some comments / docs.
2013-10-29 09:42:59 +01:00
Jürg Lehni
c579433b3d
Fix bug in Raster.onLoad()
...
It was executing in wrong scope on websites with multiple scopes.
2013-10-29 09:42:58 +01:00
Jürg Lehni
160fe25cd1
Improve documentation of #importSVG() methods.
2013-10-29 09:42:58 +01:00
Jürg Lehni
b4651a18c6
Implement #getItem() on Project and Item, similar to #getItems() but returning only the first match.
2013-10-19 13:02:53 +02:00
Jürg Lehni
1a645a1adb
Implement function callbacks for item matching.
2013-10-19 12:38:36 +02:00
Jürg Lehni
4fb6a5d949
Implement #getItems(match) on Project and Item as a simple and efficient query interface.
2013-10-19 12:27:13 +02:00
Jürg Lehni
0b7e128426
Only rely on _drawCount for drawing related things, and caching where it allows.
...
Project#selectedItems was out of sync until the next draw loop.
2013-10-18 21:52:22 +02:00
Jürg Lehni
1fc9f882ca
Fix a minor bug in CompoundPath#contains(), improve comments and clean up code.
2013-10-18 19:49:05 +02:00
Jürg Lehni
5d0fd8f970
Implement Style#windingRule and use it in Path#contains().
2013-10-18 14:54:13 +02:00
Jürg Lehni
73d2c34088
Implement item-level #equals() method and clean up other equals methods.
2013-10-17 13:08:54 +02:00
Jürg Lehni
9976033655
Implement serialization of selection.
2013-10-17 12:04:11 +02:00
Jürg Lehni
c2a34d9f1f
Implement an easier approach in serialization to handle the default value of leading.
2013-10-17 11:53:34 +02:00
Jürg Lehni
1eb6b49e8a
Allow serialization values to mark themselves as _default.
...
Solves unnecessarily serialized leading values.
2013-10-17 11:47:46 +02:00
Jürg Lehni
9956a6ff51
Implement Shape#toPath(), analogue to Path#toShape().
...
This way is much simpler though.
2013-10-16 23:44:50 +02:00
Jürg Lehni
c4c7a37993
Implement Path#toShape(), Segment#isColinear(), Segment#isOrthogonal() and Segment#isArc().
2013-10-16 23:10:03 +02:00
Jürg Lehni
be5a73a61d
SVG: Implement support for Shape.
2013-10-16 16:47:00 +02:00
Jürg Lehni
8ab6c61b0d
Rename Shape#type to Shape#shape, to avoid clash with Item#type.
2013-10-16 16:46:22 +02:00
Jürg Lehni
b581c84d8b
Move CompoundPath#reduce() to Item#reduce().
2013-10-16 16:10:28 +02:00
Jürg Lehni
9eb1c104da
Implement Shape#clone()
2013-10-16 15:04:50 +02:00
Jürg Lehni
b35296ef3e
Improve Shape.Ellipse to support center & radius parameters, and update documentation.
2013-10-16 15:04:37 +02:00
Jürg Lehni
c945bf7908
Docs: Various smaller clean ups.
2013-10-16 14:20:13 +02:00
Jürg Lehni
2263afea59
Start implementing rounded rectangles in Shape.Rectangle.
2013-10-14 19:57:28 +02:00
Jürg Lehni
a3d0e0d462
Clean up throw statements.
...
Never throw plain strings.
2013-10-14 16:05:50 +02:00
Jürg Lehni
b9ba2364fe
Move Shape#isEmpty() to right place.
2013-10-14 09:15:34 +02:00
Jürg Lehni
198305b75c
Remove doc comment since Item#isEmpty() is already documented, and move it to an inline comment.
2013-10-14 09:14:59 +02:00
Oliver Jones
df7f1fe874
Override default isEmpty method for Shape
...
Fixes (new Group([new Shape.Rectangle(...)])).bounds throwing ReferenceError when using Item's isEmpty
2013-10-12 19:28:45 +01:00
Jürg Lehni
c68a7d33da
Switch from options.browser and options.node to options.environment
2013-10-10 23:09:00 +02:00
Jürg Lehni
24e46bee60
Merge branch 'refs/heads/boolean-fix'
2013-10-08 20:50:47 +02:00
Jürg Lehni
367aa8ea28
Do not allow numeric values for Item#name.
...
Closes #298 .
2013-10-08 20:38:16 +02:00
Jürg Lehni
921a68e4a2
Rename _removeFromNamed to _removeNamed.
2013-10-08 20:25:26 +02:00
Jürg Lehni
5f8c00fe8d
Start implementing Item#globalToLocal() and #localToGlobal()
2013-09-22 18:04:27 -07:00
Jürg Lehni
19c7788617
Fix documentation irregularities.
2013-08-23 19:45:28 -07:00
Jürg Lehni
40f2547e5f
Correctly detect image size on all browsers.
...
Closes #268 .
2013-08-15 11:32:47 -07:00
Jürg Lehni
590c89840c
Merge Raster#setImage() and #setCanvas().
2013-08-14 12:29:56 -07:00
Jürg Lehni
cc565b3fe2
Rename Raster#getSubImage() to #getSubCanvas(), and use insert: false combined with #insertAbove() to correctly insert newly created rasters.
2013-08-14 12:21:47 -07:00
Jürg Lehni
5981ddf89f
Implement Raster#getSubRaster() and document both #getSubImage() and #getSubRaster().
2013-08-14 12:14:28 -07:00
Jürg Lehni
1a1c2674fd
Take Item#matrix into account when drawing gradients.
...
Closes #267 .
2013-08-14 11:27:04 -07:00
Jürg Lehni
46f6261d38
Merge pull request #265 from duckmaestro/master
...
Fix to #263 : _children undefined inside call to myShape.isEmpty().
2013-08-08 17:24:10 -07:00
Jürg Lehni
6b19f25f4b
Fix typos in comments.
2013-08-08 15:21:35 -07:00
Clifford Champion
2d3200c8d7
Fix to #263 : _children undefined inside call to myShape.isEmpty().
2013-07-27 23:47:49 -07:00
Jürg Lehni
5e8ec2066b
Clean up comment.
2013-07-21 16:52:18 -07:00
Jürg Lehni
16735e23af
Simplify code for #insertAbove/Below(), by introducing a private helper.
...
Making overriding in Layer simpler.
2013-07-21 16:41:45 -07:00
Jürg Lehni
5e210c583a
Switch to returning items instead of booleans in #insertAbove/Below() and adjust documentation accordingly.
2013-07-21 16:29:13 -07:00
Jürg Lehni
edfb3a51ab
Improve documentation of insertion methods.
2013-07-21 16:26:16 -07:00
Jürg Lehni
e68563af53
Have #insertAbove/Below() return a boolean.
2013-07-21 16:26:03 -07:00
Jürg Lehni
e0809d26f2
Merge code for Item#insertAbove() / #insertBelow() and fix issue with wrong indices.
...
The previous code was faulty when item was not already in the children list.
2013-07-21 16:22:16 -07:00
Jürg Lehni
949752556b
Fix avoiding of name clashes in cloning.
2013-07-21 15:54:03 -07:00
Jürg Lehni
aa4d990c90
Move and unify handling of Item#_set(props) to new Item#_initialize(), and add support for props.insert = false.
2013-07-21 15:45:22 -07:00
Jürg Lehni
5e2654b490
Allow Item#_changed() to function before #_project is set.
2013-07-21 15:44:18 -07:00
Jürg Lehni
b7aea1e527
Use insert: false option in creation of all clones.
...
Still needs implementing in Item constructor.
2013-07-19 18:42:13 -07:00
Jürg Lehni
20a17f2939
Implement insert parameter in Item#clone() to control DOM insertion.
...
Defaults to true. Also insert in the right place now, above the original.
2013-07-19 18:27:00 -07:00
Jürg Lehni
588abe7189
Only test for fill in Item#_hitTest() if options.fill is set.
2013-07-19 17:55:31 -07:00
Jürg Lehni
f466473bfb
Add support for shadows.
...
Closes #36 .
2013-07-19 17:48:29 -07:00
Jürg Lehni
94c192495a
Add support for canvas compositing modes to Item#blendMode.
...
Closes #159 .
2013-07-19 15:23:16 -07:00
Jürg Lehni
175091a69f
Allow combinations of blendMode and opacity.
...
Closes #259 .
2013-07-19 11:46:13 -07:00
Jürg Lehni
47768779b7
Fix blurriness in Item#rasterize().
...
Closes #258 .
2013-07-18 20:06:22 -07:00
Jürg Lehni
affb44e0dd
Prevent double execution of onLoad event on Raster.
2013-07-03 19:02:29 -07:00
Jürg Lehni
e87307af41
Fix issue with Image.onLoad() events.
...
naturalWidth/Height seems unreliable.
2013-07-03 18:49:05 -07:00
Jürg Lehni
fdfb7abe58
Update exportSVG() documentation.
2013-06-27 18:14:51 -07:00
Jürg Lehni
09f04a597f
Write documentation for Shape constructors.
2013-06-27 18:04:02 -07:00
Jürg Lehni
41746d2d25
Docs: Write documentation for #import/export JSON/SVG, for both Item and Project.
2013-06-27 18:03:49 -07:00
Jürg Lehni
0c9914285f
Return Raster#size as a LinkedSize.
2013-06-27 16:06:11 -07:00
Jürg Lehni
9311b38894
Define Shape#size and #radius.
2013-06-27 16:05:44 -07:00
Jürg Lehni
3d5ae373a8
Remove static create() methods from LinkedPoint/Size/Rectangle, and give them initialize() methods instead that also name the classes in debugging.
2013-06-25 09:41:55 -07:00
Jürg Lehni
1866e4ff15
Remove need for all special arguments in minification, and restructure code to avoid warnings.
2013-06-24 10:15:54 -07:00
Jürg Lehni
f56794bad4
Remove global variable leakage.
2013-06-24 04:52:13 -07:00
Jürg Lehni
a4535edbb9
Bring back _class names, since code minification breaks reliance on constructor.name.
...
Closes #248 .
2013-06-23 20:18:32 -07:00
Jürg Lehni
dff39dff78
Use local bounds for hit-testing.
...
Fixes issue #247 .
2013-06-23 19:49:36 -07:00
Jürg Lehni
9f7167a47f
Clean up Item#hitTest() code.
2013-06-23 19:01:48 -07:00
Jürg Lehni
58f697abfc
Fix hit-testing for guides.
2013-06-23 19:01:36 -07:00
Jürg Lehni
76426c4cb3
Take #visible state into account when hit-testing.
...
Closes #243 .
2013-06-23 17:55:14 -07:00
Jürg Lehni
719b9d5e24
Move logic that determines if item can be directly composited into separate per-item #_canComposite() method.
2013-06-19 08:22:08 -07:00
Jürg Lehni
3d78e3729d
Fix issue with PaperScript and array[i++] expressions.
2013-06-18 18:18:39 -07:00
Jürg Lehni
b532390d9c
Remove Clip class again.
...
Group can handle that.
2013-06-18 15:58:58 -07:00
Jürg Lehni
177229f99f
Define Group#transformContent as a boolean to control #applyMatrix() behavior.
...
And use it for SVG Import.
2013-06-18 15:57:30 -07:00
Jürg Lehni
f758fb306b
Rename #_applyMatrix to #_transformContent.
...
And swap names with private function...
2013-06-18 15:50:11 -07:00
Jürg Lehni
d7d6da0af8
Pass right value for dontNotify.
2013-06-18 15:47:14 -07:00
Jürg Lehni
f433423789
Respect _applyMatrix setting when calling #applyMatrix() in Group#_changed.
...
Required for Clip to work correctly.
2013-06-18 15:39:46 -07:00
Jürg Lehni
75acdf1025
Add support for direct drawing of native blendModes for items that allow it.
...
Bypassing compositing into separate canvases completely.
2013-06-18 14:18:57 -07:00
Jürg Lehni
ad6124cf98
Take strokeWidth into account in Item#hasStroke()
2013-06-18 14:08:48 -07:00
Jürg Lehni
f4f97cda88
Fix a bug with wrong offsets when rendering nested clips and blend-modes.
...
And streamline blend-mode and opacity rendering code.
2013-06-18 12:35:57 -07:00
Jürg Lehni
414ac1d092
Fix offset in direct blitting of nested Clip items.
2013-06-18 12:20:21 -07:00
Jürg Lehni
f350f34eb4
Apply clipping fix not only to blend modes but any operation that draws into a separate canvas.
2013-06-17 16:22:23 -07:00
Jürg Lehni
ab2bfe2d40
Rename nativeDash to dash.
2013-06-17 15:52:16 -07:00
Jürg Lehni
d6db007765
Fix documentation warning.
2013-06-13 15:57:12 -07:00
Jürg Lehni
ae474131cc
Implement stroke hittesting for Shape.Rectangle.
2013-06-13 10:40:54 -07:00
Jürg Lehni
48fa889e0d
Start implementing proper hit-testing for Shapes with strokes.
...
Support for Shape.Rectangle is still missing.
2013-06-13 10:31:21 -07:00
Jürg Lehni
40dbe7ec74
Fix drawing of Shape.Ellipse items.
2013-06-13 10:30:54 -07:00
Jürg Lehni
7f6ac3d8af
Changing HIERARCHY also changes GEOMETRY.
...
Fixes #237 .
2013-06-13 08:47:45 -07:00
Jürg Lehni
5250281ab1
Fully support object literal arguments in Shape constructors.
2013-06-12 20:13:39 -07:00
Jürg Lehni
95ecab8a6f
Improve handling of merged CompoundPath style through #getStyle().
...
Only access _style directly in core code if you really know what you're doing!
2013-06-12 20:12:08 -07:00
Jürg Lehni
33eb750586
Simplify Path#hasFill() and implement #hasStroke() as well.
2013-06-12 19:57:05 -07:00
Jürg Lehni
fe10c99d1b
Implement standard behavior of #_hitTest() for items without children, based on #_contains().
...
This should cover the minimum of what's needed for PointText.
2013-06-12 19:30:23 -07:00
Jürg Lehni
34ad9045cc
Fix wrong default fillColor on TextItems.
2013-06-12 17:30:35 -07:00
Jürg Lehni
b581f8b33e
Implement Style#selectedColor and Item#selectedColor as a way to control appearance of selections.
...
Closes #219 .
2013-06-12 14:17:34 -07:00
Jürg Lehni
8c596927fb
Store _removeSets per project, not globally.
2013-06-12 13:50:05 -07:00
Jürg Lehni
94e07e77f0
Redraw clipItem when drawing into separate canvas for blend-modes.
...
Closes #228 .
2013-06-11 20:41:20 -07:00
Jürg Lehni
20f7c567aa
Use Base objects for drawing params, so we can use param.extend() on them for easier overriding.
2013-06-11 20:40:44 -07:00
Jürg Lehni
d76d573eb2
Reset transformation matrix when blitting off-screen canvas.
...
Closes #233 .
2013-05-29 13:52:47 -07:00
Jürg Lehni
0e2ae48b02
Fix regressions in Raster caused by faulty merge.
2013-05-28 13:54:47 -07:00
Jürg Lehni
73351cbda7
Store data in _data rather than on the image itself.
2013-05-28 08:10:51 -07:00
Jürg Lehni
c75a98c406
Clean up @trankek's fix for node a bit.
...
Fix prepro.js conditionals.
2013-05-28 08:05:40 -07:00
Jürg Lehni
e0856a0d31
Merge branch 'master' of https://github.com/tranek/paper.js into tranek-master
...
Conflicts:
src/item/Raster.js
2013-05-28 08:00:01 -07:00
Jürg Lehni
6fa6c022c9
Rename options.server to options.node
2013-05-28 00:01:55 -07:00
Jürg Lehni
cd7db56249
Remove all create() constructors for basic types since new constructors are now faster.
...
Woop!
2013-05-27 23:57:31 -07:00
Jürg Lehni
4e6f52c20c
Remove need for _needsRedraw() calls by replacing it with a boolean flag.
2013-05-27 23:40:23 -07:00
Jürg Lehni
fd3f698fe9
Apply "pending" matrix in group when it receives content.
2013-05-27 23:13:20 -07:00
Jürg Lehni
9b0d32651f
Move main Item insertion code from #insertChild() to #insertChildren().
...
Handles insertion and change notification much more efficiently.
2013-05-27 20:06:30 -07:00
Jürg Lehni
73388d6f9c
Fix documentation warning.
2013-05-27 18:30:57 -07:00
Jürg Lehni
e516e6f651
Only reset matrices in Groups when it could actually be applied to the content.
...
That way, empty groups in SVGImport still keep their transformation state.
2013-05-27 15:42:16 -07:00
Jürg Lehni
10d5de3ed6
Implement a better way to name and export class constructors.
...
This change also simplified the way classes are exported to PaperScope objects.
2013-05-27 12:48:58 -07:00