Commit graph

3104 commits

Author SHA1 Message Date
Jürg Lehni
b072df0486 Put isEnd value directly into conditional. 2013-06-17 08:56:42 -07:00
Jürg Lehni
ccd0bf8f6b Simply delegate to Point#getLength() as we already have it. 2013-06-17 08:28:37 -07:00
Jürg Lehni
9463f0078a Fix documentation since Line#vector will be documented as a simple accessor. 2013-06-17 08:28:02 -07:00
Jürg Lehni
18ad8a235d Clean up code to follow Paper.js coding conventions. 2013-06-17 08:26:51 -07:00
Jürg Lehni
be6bbb802d Move calculations of values to where they are needed. 2013-06-17 08:22:28 -07:00
Jürg Lehni
5ff990a84a Fix global variable leakage, and join sequential variable definitions. 2013-06-17 08:10:57 -07:00
hkrish
2693516844 Implement correct method for calculating curvature on a Path 2013-06-17 15:16:11 +05:30
Jürg Lehni
f8367bb0dd More clean-ups. 2013-06-15 05:24:34 -07:00
Jürg Lehni
79785afa2a Minor clean-ups and optimizations of stroke hit-test code. 2013-06-15 05:21:17 -07:00
Jürg Lehni
8c09d19f7c Fix wrong calculation of rough bounds for square caps.
And add some comments to stroke hit-testing code.
2013-06-15 05:15:48 -07:00
Jürg Lehni
26971672b2 Only check segments for miters that are within the limit. 2013-06-15 05:08:12 -07:00
Jürg Lehni
be1098e006 Further improve stroke hit-testing.
Properly detect all miter joins.
2013-06-15 05:06:09 -07:00
Jürg Lehni
d318057897 Implement Segment#getLocation() 2013-06-15 05:05:10 -07:00
Jürg Lehni
1cab9aad90 Improve stroke hit-testing. 2013-06-15 03:12:57 -07:00
Jürg Lehni
eb32bad57e Fix imprecision in #getNearestLocation() 2013-06-15 03:12:29 -07:00
Jürg Lehni
38f832a888 Remove console.log() 2013-06-15 02:25:44 -07:00
Jürg Lehni
8b9fb3741d Implement proper stroke hit-testing for all variations of joins and caps. 2013-06-15 02:24:59 -07:00
Jürg Lehni
e4ba0d80b6 Simple code improvement in #isClockwise(). 2013-06-14 23:18:29 -07:00
Jürg Lehni
4ffcdc3971 Clean up code. 2013-06-14 23:13:54 -07:00
Jürg Lehni
1ae7832ab3 Move calculation of square joins and caps to static methods.
These will be of use when correctly implementing hit-testing of strokes.
2013-06-14 23:11:50 -07:00
Jürg Lehni
ca0e931498 Clean up and simplify getStrokeBounds() code.
Handling of bevel and miter joins can be merged nicely.
2013-06-14 22:57:14 -07:00
Jürg Lehni
1dee05900f Move getArea code to other statics block. 2013-06-13 23:16:44 -07:00
Jürg Lehni
610e396d94 Make Curve#_getCrossings() a static method and have it work on curve values directly. 2013-06-13 23:16:00 -07:00
Jürg Lehni
d6db007765 Fix documentation warning. 2013-06-13 15:57:12 -07:00
Jürg Lehni
01e48b3322 Improve and clean up fat-line bug fix. 2013-06-13 15:53:28 -07:00
Jürg Lehni
38f31be6b2 Clean up and simplify Path#_hitTest() code. 2013-06-13 14:30:52 -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
d67ce8a103 Fix syntax. 2013-06-13 09:13:42 -07:00
Jürg Lehni
d87937dc03 Fix issue on IE occuring when nodes are removed from DOM. 2013-06-13 09:08:11 -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
463a00bd1e Fix negative bounds height on PointText. 2013-06-12 19:21:46 -07:00
Jürg Lehni
2196ef2a74 Streamline various #equals() methods. 2013-06-12 18:57:12 -07:00
Jürg Lehni
4a8469b740 Define Base.isPlainValue() and use it to implement more flexible #equals() for Color and Rectangle. 2013-06-12 18:55:14 -07:00
Jürg Lehni
294bfc9c9a Improve IE Function#name fix and move it to straps.js, since constructor.name is used there too.
Cache result and improve RegExp.
2013-06-12 18:36:18 -07:00
Jürg Lehni
6fe60cff9d Fix trailing comas. 2013-06-12 17:42:38 -07:00
Jürg Lehni
34ad9045cc Fix wrong default fillColor on TextItems. 2013-06-12 17:30:35 -07:00
Jürg Lehni
cb0dcf1719 Fix accidental global leakage. 2013-06-12 17:27:20 -07:00
Jürg Lehni
d1932124d7 Implement #equals() in Point, Size and Rectangle without argument reading.
Closes #235
2013-06-12 15:28:29 -07:00
Jürg Lehni
1394c36907 Find an elegant way to implement all variations of Rectangle(object) constructors. 2013-06-12 15:08:22 -07:00
Jürg Lehni
7c5478cd93 Define first solution for correctly handling Rectangle(object) constructors.
Work in progress.
2013-06-12 14:57:47 -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
9977ec5c28 Rename #toCss() to #toCSS() 2013-06-12 14:04:59 -07:00
Jürg Lehni
8c596927fb Store _removeSets per project, not globally. 2013-06-12 13:50:05 -07:00
Jürg Lehni
f59882b757 Handle Tool._removeSets also when there is no corresponding event handler installed.
Closes #204.
2013-06-12 13:46:14 -07:00
Jürg Lehni
f8c36b8276 Adopt Function#name regular expression to accommodate different scenarios of white-spaces. 2013-06-12 08:49:15 -07:00
Jürg Lehni
7a2f577b75 Implement Path#contains() correctly for open paths. 2013-06-12 00:35:34 -07:00
Jürg Lehni
f45a66d2ee Filter out curves with zero length in Path#contains() algorithm.
Fixes #227
2013-06-12 00:19:54 -07:00
Jürg Lehni
3d99b5e931 Fix ADM support to avoid error messages. 2013-06-12 00:07:56 -07:00
Jürg Lehni
b99d54f8c3 Add support for AMD (e.g. require.js)
Fixes #223.
2013-06-11 23:50:59 -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
a7750c3e67 Support null arguments in Point#equals(). 2013-06-11 20:14:45 -07:00
Jürg Lehni
ce7d584c05 Revert readNull and clone parameter sequence in arguments reading code. 2013-06-11 19:49:35 -07:00
Jürg Lehni
2e565dcfce Fix Function#name on browsers that don't support it.
Closes #236.
2013-06-11 19:07:25 -07:00
Jürg Lehni
18383875eb Fix global variable leakage. 2013-06-11 17:46:50 -07:00
Jürg Lehni
375156059d Do not use pathData in JSON for CompoundPaths. 2013-06-11 15:27:04 -07:00
Jürg Lehni
03a7503789 Fix issue in getPathData() with closed CompoundPaths. 2013-06-11 15:26:44 -07:00
Jürg Lehni
f2bb5d07df Let's not go too far with optimizations. 2013-06-11 15:10:02 -07:00
Jürg Lehni
875a766d19 Implement clipPath support in SVGExporter. 2013-06-11 14:50:13 -07:00
Jürg Lehni
35f17979df Improve Node.js XMLSerializer workaround for lowercased tagNames. 2013-06-11 14:39:34 -07:00
Jürg Lehni
d41f79598e Change exportDefinitions() to create an actual <defs> container for definitions. 2013-06-11 14:26:04 -07:00
Jürg Lehni
470cfae9f1 Clean up export code. 2013-06-11 14:15:54 -07:00
Jürg Lehni
a1cab3592b No need to explicitly set fill to 'none' anymore since comparing style with parent handles this for us automatically now. 2013-06-11 14:15:43 -07:00
Jürg Lehni
72082bdcff Fix new failing test. 2013-06-11 13:57:28 -07:00
Jürg Lehni
b4ff0d347e Optimize SVG import for clipped groups. 2013-06-11 12:57:03 -07:00
Jürg Lehni
7faf2a9e70 Clean-up @hkrish's changes a bit. 2013-06-09 18:37:08 -07:00
hkrish
d8498b6418 Remove invalid code and unnecessary comments 2013-06-09 22:02:50 +05:30
hkrish
8758b232f4 Merge branch 'master' into fatline
* master:
  Fix regression in importing SVG viewBox.
  Minor code clean ups.
  Properly fix exporting of classes into Base.exports.
  Switch to HTML5 meta charset tags.
  Fix issues with uglifyjs.
  Include stats.js in distribution so all examples can work.
2013-06-09 18:08:31 +05:30
hkrish
ca2bfb8cab Merge branch 'master' of https://github.com/paperjs/paper.js
* 'master' of https://github.com/paperjs/paper.js:
  Fix regression in importing SVG viewBox.
2013-06-09 18:03:19 +05:30
Jürg Lehni
48651d5fb1 Fix regression in importing SVG viewBox. 2013-06-08 13:44:50 -07:00
hkrish
d6ed9890b8 Merge branch 'master' of https://github.com/paperjs/paper.js
* 'master' of https://github.com/paperjs/paper.js:
  Minor code clean ups.
  Properly fix exporting of classes into Base.exports.
  Switch to HTML5 meta charset tags.
  Fix issues with uglifyjs.
  Include stats.js in distribution so all examples can work.
2013-06-08 23:26:45 +05:30
hkrish
d3405115c1 Use parameter on both curves in CurveLocation objects instead of Point in #getIntersection() 2013-06-08 21:37:43 +05:30
Jürg Lehni
75eddbcdba Minor code clean ups. 2013-06-02 16:18:40 -07:00
Jürg Lehni
b896a98b1e Properly fix exporting of classes into Base.exports. 2013-06-02 16:17:54 -07:00
hkrish
1e86aa4e97 Merge branch 'master' of https://github.com/paperjs/paper.js
* 'master' of https://github.com/paperjs/paper.js:
  Explicitly use bash to avoid build problems on linux.
  Bump version number to 0.9.2
  Fix exporting of Base, Numerical and PaperScript into PaperScope.
2013-05-31 17:21:46 +02:00
Jürg Lehni
a81fdc2758 Fix exporting of Base, Numerical and PaperScript into PaperScope. 2013-05-30 14:37:04 -07:00
hkrish
8d1e5ea144 Merge branch 'master' of https://github.com/paperjs/paper.js
* 'master' of https://github.com/paperjs/paper.js:
  Bump version number to 0.9.1
  Fix issue with local paper variable shielding global one.
  Reset transformation matrix when blitting off-screen canvas.
2013-05-30 23:21:05 +02:00
Jürg Lehni
178b09caa7 Fix issue with local paper variable shielding global one.
We need a cleaner fix for this on the long run.
2013-05-30 11:26:47 -07:00
Jürg Lehni
d76d573eb2 Reset transformation matrix when blitting off-screen canvas.
Closes #233.
2013-05-29 13:52:47 -07:00
hkrish
cdaab794f2 Merge branch 'master' of https://github.com/paperjs/paper.js
* 'master' of https://github.com/paperjs/paper.js: (56 commits)
  Fix regressions in Raster caused by faulty merge.
  Store data in _data rather than on the image itself.
  Clean up @trankek's fix for node a bit.
  Explain compact = true in Project#_serialize()
  Properly fix issue with Project#exportJSON() creating separate projects on import.
  Update straps.js to version 1.1.0
  Rename options.server to options.node
  Remove all create() constructors for basic types since new constructors are now faster.
  Make sure project we import into is active.
  Unbox project data in Project#importJSON(), as we don't want to create a new project object.
  Remove need for _needsRedraw() calls by replacing it with a boolean flag.
  Apply "pending" matrix in group when it receives content.
  Move main Item insertion code from #insertChild() to #insertChildren().
  Fix documentation warning.
  Handle exporting of Numerical and PaperScript in export.js
  Update straps.js to latest version.
  Accessors cannot define the writable property.
  Properly export Numerical and PaperScript again.
  Only reset matrices in Groups when it could actually be applied to the content.
  Set options.stats = false for build.sh and Node.js
  ...
2013-05-29 19:09:07 +02: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
a952e6f5ad Merge branch 'master' of github.com:paperjs/paper.js 2013-05-28 08:07:26 -07:00
Jürg Lehni
277f7aabae Merge branch 'refs/heads/tranek-master' 2013-05-28 08:06:06 -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
f0f7a7f35c Explain compact = true in Project#_serialize() 2013-05-28 07:57:35 -07:00
Jürg Lehni
dd38e4aae6 Merge pull request #231 from NorthNick/master
Path.arcBy bug fix
2013-05-28 07:53:58 -07:00
Jürg Lehni
0b4bc678bc Properly fix issue with Project#exportJSON() creating separate projects on import. 2013-05-28 07:42:38 -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
0f74c01f75 Make sure project we import into is active. 2013-05-27 23:48:16 -07:00
Jürg Lehni
85920bbdb8 Unbox project data in Project#importJSON(), as we don't want to create a new project object. 2013-05-27 23:43:24 -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
961451b271 Handle exporting of Numerical and PaperScript in export.js
Allowing build.sh to work again.
2013-05-27 18:28:35 -07:00
Jürg Lehni
70d6050900 Accessors cannot define the writable property. 2013-05-27 18:12:25 -07:00
Jürg Lehni
5592bb57e0 Properly export Numerical and PaperScript again. 2013-05-27 15:55:44 -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
b92be7ecf3 Set options.stats = false for build.sh and Node.js 2013-05-27 15:33:28 -07:00
Jürg Lehni
d577b1bf48 Share one options.js file describing Paper.js options for Node.js, build.sh and the dev version. 2013-05-27 15:11:32 -07:00
Jürg Lehni
6ac5463630 Switch to using common string format for paper.version (major.minor.build) 2013-05-27 14:27:05 -07:00
Jürg Lehni
fef22f25e8 Remove node.js specific version of Base.isPlainObject(), since straps.js can handle it now. 2013-05-27 14:10:38 -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
Jürg Lehni
15b1ea7af0 Solve issue with SVG gradients on Firefox. 2013-05-27 10:12:23 -07:00
Jürg Lehni
c533dda7b5 Finally found a better and faster alternative for this.base() calls, by setting base on the function object instead.
base can be accessed on named functions very easily, leading to another measurable speed increase. Finally all performance reasons against straps.js are eliminated!
2013-05-27 10:04:05 -07:00
Jürg Lehni
369b329b23 Change straps.js to directly use initialize() as constructor function rather than redirecting calls to it.
Should yield some interesting performance improvements.
2013-05-27 09:11:50 -07:00
Jürg Lehni
094e35f2e5 No need for separate injection object for Item.extend() 2013-05-27 08:16:34 -07:00
Jürg Lehni
f9267e7f5c Some more code clean up and variable renaming. 2013-05-26 17:59:01 -07:00
Jürg Lehni
14962b5c45 Clean up code a bit more. 2013-05-26 17:52:05 -07:00
Jürg Lehni
32709a176b Fix some comments. 2013-05-26 17:48:36 -07:00
Jürg Lehni
7050edd6e4 Fix point sequence. 2013-05-26 17:40:40 -07:00
Jürg Lehni
90f0679700 Further simplify getConvexHull() by using p0 … p3 point objects. 2013-05-26 17:39:13 -07:00
Jürg Lehni
487c4c4aef Further simplify getConvexHull() by inlining cross product calculations. 2013-05-26 17:32:44 -07:00
Jürg Lehni
9edab9c3aa Simplify convex hull algorithm by returning lists of points rather than lines.
We can avoid some data redundancy that way at no performance cost.
2013-05-26 17:18:54 -07:00
Jürg Lehni
9540b7f6a9 Use addLineIntersection() in subdivision algorithm as well. 2013-05-26 17:10:29 -07:00
Jürg Lehni
20737c6664 Rename various intersection methods. 2013-05-26 17:06:23 -07:00
Jürg Lehni
da8898abd2 Fix newly introduced bug in Line.getSide() through variable renaming. 2013-05-26 17:05:10 -07:00
Jürg Lehni
5d7cc2fb40 Use new Line.getSignedDistance(). 2013-05-26 16:58:49 -07:00
Jürg Lehni
f771233d37 Speed up Line class by removing internal dependance on Point. 2013-05-26 16:58:34 -07:00
Jürg Lehni
80f9f6061c Change the way the Line class handles direction vectors and infinite lines.
The beginning of performance improvements in the Line class.
2013-05-26 15:44:52 -07:00
NickNorth
3e520efe5f arcBy recursively calls itself rather than arcTo. 2013-05-26 20:09:26 +01:00
Jürg Lehni
1fb0a3a13c Always provide t parameter for CurveLocations if we know it. 2013-05-25 11:23:59 -07:00
hkrish
46a324722a Merge branch 'master' of https://github.com/paperjs/paper.js
* 'master' of https://github.com/paperjs/paper.js: (90 commits)
  Start merging fat-line clipping code into Curve class.
  Fix white-spaces.
  Merge handling of flat curves.
  More getConvexHull() clean up.
  Remove unused variable dqmin.
  Further clean up clipFatLine()
  Some clean up in clipFatLine()
  Merge the two convergence checks to one.
  Simplify convergence checks.
  Rename p\d to part\d
  Rename v\dt to range\d
  Simplify handling of ranges and curve parts.
  Switch to using arrays rather than objects for parameter ranges.
  Reverse logic of v1t / _v1t naming and switch to using Numerical constants.
  Re-implement Curve.getLocation2() as "hub" for all the different intersection methods.
  Use break; instead of return; and untangle unnecessarily nested conditionals.
  Define private addLocation() to reduce code redundancy.
  Correctly handle calculation of CurveLocation point in getCurveIntersections().
  Move Curve.getIntersection2 to private function and better name other private functions.
  Always use parameter in getCurveLineIntersection() by flipping curve1 / 2 values as well.
  ...
2013-05-25 11:37:33 +02:00
Jürg Lehni
502c76dbce Start merging fat-line clipping code into Curve class.
And add a prepro option for now.
2013-05-24 22:30:13 -07:00
Jürg Lehni
7f00ef8f05 Fix white-spaces. 2013-05-24 22:25:22 -07:00
Jürg Lehni
7e5f846190 Remove debugging code. 2013-05-24 17:57:13 -07:00
tranek
1637127e09 Fixed data URLs src disappearing 2013-05-24 20:55:59 -04:00
Jürg Lehni
bd3ac02bbe Use Curve instead of this.
Compresses better and allows passing on function as callback.
2013-05-24 17:52:05 -07:00
Jürg Lehni
e359dd038c Add explaining comment. 2013-05-24 17:14:39 -07:00
tranek
cd7938e363 Fixed string equals in Raster data URL for Node.js 2013-05-24 16:41:02 -04:00
tranek
269b93e888 Added data URLs for Rasters in Node.js 2013-05-24 16:38:43 -04:00
hkrish
cfbe6d8312 Merge branch 'master' of https://github.com/paperjs/paper.js
* 'master' of https://github.com/paperjs/paper.js:
  Remove Item#applyMatrix boolean, go back to previous way of directly applying transformations to children in Group and Layer, and introduce new Clip class for non-transformed nested matrices.
  Make sure the Base class is exposed in Node.js
2013-05-16 20:33:13 +02:00
Jürg Lehni
ae416f821c Explain the booolean argument in color getter calls, and put _matrix in local variable for better minification. 2013-05-13 19:31:41 -07:00
Jürg Lehni
7c2e57e105 Remove Item#applyMatrix boolean, go back to previous way of directly applying transformations to children in Group and Layer, and introduce new Clip class for non-transformed nested matrices. 2013-05-13 18:57:17 -07:00
Jürg Lehni
c70b985911 Make sure the Base class is exposed in Node.js 2013-05-12 14:29:21 -07:00
hkrish
158001c154 Merge branch 'master' of https://github.com/paperjs/paper.js
* 'master' of https://github.com/paperjs/paper.js:
  Fix: #initialize() to correctly convert #getValue() array back to Curve object.
  Handle allowNull correctly again in SVGImport.
  Simplify SVGImport attribute parsing and correctly handle failing tests with invalid coordinates.
  Further refine Node.js integration.
  Improve the Node version of Base.isPlainObject()
2013-05-11 14:42:56 +02:00
Harikrishnan Gopalakrishnan
ce600f4ea4 Fix: #initialize() to correctly convert #getValue() array back to Curve object. 2013-05-11 00:59:30 +03:00
Jürg Lehni
2b4dddbb1f Handle allowNull correctly again in SVGImport. 2013-05-09 16:16:48 -07:00
Jürg Lehni
a4e875cf29 Simplify SVGImport attribute parsing and correctly handle failing tests with invalid coordinates. 2013-05-09 16:08:38 -07:00
Jürg Lehni
dd96d67fe1 Further refine Node.js integration. 2013-05-09 16:06:45 -07:00
Jürg Lehni
82b9cb3dbf Improve the Node version of Base.isPlainObject() 2013-05-09 15:30:18 -07:00