Commit graph

631 commits

Author SHA1 Message Date
Jonathan Puckey
12de77eb42 Path.Constructors: implement Path.Star and add tests. 2011-04-12 14:18:00 +02:00
Jonathan Puckey
bd59e48682 Fix problem with Point constructor when passed { angle: 0, length: n }, by checking for undefined. 2011-04-12 13:48:44 +02:00
Jonathan Puckey
2a9bbd3dee Fix Path#closePath & CompoundPath#closePath. 2011-04-11 23:33:08 +02:00
Jonathan Puckey
499c421021 Implement Path#join(path) and add tests for it. 2011-04-11 23:30:08 +02:00
Jonathan Puckey
d02885cba7 Implement Item#isParent and add tests for it. 2011-04-11 19:42:03 +02:00
Jonathan Puckey
594c11fedd CurveLocation: fix mistakes. 2011-04-11 19:36:40 +02:00
Jonathan Puckey
aa043428c0 CurveLocation: add empty line to end of file. 2011-04-11 19:33:34 +02:00
Jonathan Puckey
b46c6d0a29 Curve: implement getLocation(length), getLength(location), getTangent(length), getNormal(length) 2011-04-11 19:32:19 +02:00
Jonathan Puckey
d396f48c4b Implement CurveLocation. 2011-04-11 19:32:04 +02:00
Jonathan Puckey
5f05c85b42 Gradient: rename midPoint to rampPoint. 2011-04-07 17:12:00 +02:00
Jonathan Puckey
c875953198 Merge remote branch 'origin/master' 2011-04-07 17:03:33 +02:00
Jonathan Puckey
06df8b1288 Allow Gradient constructor to receive an array of colors or [color, midPoint]. Also allow the user to specify the type of the gradient in the constructor. 2011-04-07 17:01:49 +02:00
Jürg Lehni
08d0499251 Change comment. 2011-03-25 19:58:20 +02:00
Jürg Lehni
e83195bb8f Add #first/lastCurve getters. 2011-03-25 19:58:02 +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
dbb947b7aa Finish ObservedRectangle, by solving observer notification for all setters. 2011-03-22 17:15:56 +00:00
Jürg Lehni
14010eb8b2 Format abscissas array for better reading. 2011-03-21 12:46:00 +00:00
Jürg Lehni
417d015eab Improve curve time parametrization precision by iteratively adding up sub-range lengths, and optimise speed by determining integration precision based on range size. 2011-03-20 11:38:06 +00:00
Jürg Lehni
a794816097 Fix wrong number of iterations in False Position method. 2011-03-20 02:03:26 +00:00
Jürg Lehni
11e70c5069 Use fast Newton-Raphson Method for now. 2011-03-20 02:02:02 +00:00
Jürg Lehni
0620a19eb9 Use False Position method as fall back in Newton-Raphson method, for accurate results in rare sitatuations wher the fast Newton-Raphson method fails. 2011-03-20 02:01:17 +00:00
Jürg Lehni
02328287cb Use n=16 evaluations in integrations for now. 2011-03-20 02:00:15 +00:00
Jürg Lehni
500942e86d Improve Numerical.integrate() by adding higher precision and supported iterations of up to n = 16. 2011-03-20 01:59:53 +00:00
Jürg Lehni
7ae504e51f Add support for Item#removeOnMove(). 2011-03-20 00:11:02 +00:00
Jürg Lehni
ad71293983 Remove Van Wijngaarden–Dekker–Brent method again as it led to imprecise results, and experiment with the very fast Newton-Raphson method (keeping False Position as a possible fallback for now). 2011-03-20 00:04:33 +00:00
Jürg Lehni
2c9d168224 Clean up and improve Path drawing commands. 2011-03-19 23:09:17 +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
b1c0a48552 Add ObservedPoint class that records changes and passes them on to the owner, and use it for all Point objects returned from Rectangle. 2011-03-16 07:12:34 +01:00
Jürg Lehni
4e65d2c1d3 Fix simple syntax error. 2011-03-15 12:30:44 +01:00
Jürg Lehni
db1e7e8880 Simple optimisations. 2011-03-14 22:38:40 +01:00
Jürg Lehni
3a8bdeb19b Move scroll bounds code to Element.getScrollBounds(). 2011-03-14 22:37:31 +01:00
Jürg Lehni
ca9e70ade0 Request next animation frame at beginning of callback. 2011-03-14 22:35:31 +01:00
Jürg Lehni
2fcca38a9c Add support for onFrameLoop() callback to PaperScript. 2011-03-14 22:34:09 +01:00
Jürg Lehni
8179d7bf7e Clean up Event.requestAnimationFrame. 2011-03-14 22:19:06 +01:00
Jürg Lehni
6d8379f885 Separate Events into Event and Element object, add a row of useful Element helper functions and define experimental Event.requestAnimationFrame(). 2011-03-14 22:14:20 +01:00
Jürg Lehni
aae88d7568 Optimise chained return statements. 2011-03-14 22:13:01 +01:00
Jürg Lehni
f02b7031a9 Reintroduce accidentally removed definition of _readNull: true. 2011-03-14 22:08:07 +01:00
Jürg Lehni
a48c130965 Improve comments. 2011-03-14 22:07:21 +01:00
Jürg Lehni
a2a9646d02 Merge remote-tracking branch 'origin/master' 2011-03-14 16:18:28 +01:00
Jürg Lehni
c284b0837e Fix tiny error in Path#smooth() 2011-03-14 16:18:12 +01:00
Jonathan Puckey
46ee4c517d Optimize nameToRGBColor to also handle strings like rgb(0, 0, 0). 2011-03-14 13:54:57 +01:00
Jürg Lehni
bfd43b27fa Improve commens and get rid of for loop to in nameToRGBColor(). 2011-03-13 23:00:01 +01:00
Jürg Lehni
1c8c64c473 One more nameToRGBColor() simplification, by reversing return logic. 2011-03-13 22:57:01 +01:00
Jürg Lehni
a842b5faa6 Simplify nameToRGBColor() further: No need to create function in its own scope, simply use the inject scope to contain cache and context variables. 2011-03-13 22:55:20 +01:00
Jürg Lehni
21aa12271e Simplify nameToRGBColor() code a little: Shorter variables names, no need to save and restore context, as all we do is fillRect(). 2011-03-13 22:53:32 +01:00
Jürg Lehni
873e715361 Merge remote-tracking branch 'origin/master' 2011-03-13 22:48:17 +01:00
Jürg Lehni
c8449162d8 Remove unnecessary checks for rect. 2011-03-13 22:48:07 +01:00
Jonathan Puckey
e0753179e3 Clean up last commit a bit. 2011-03-13 20:16:04 +01:00
Jonathan Puckey
0d173e39bf Merge remote branch 'origin/master' 2011-03-13 20:15:00 +01:00
Jonathan Puckey
b004a83361 Color: avoid huge named color lookup table by drawing the named color on a canvas and reading its components. 2011-03-13 20:14:16 +01:00
Jürg Lehni
cd80db14d8 Rearrange color converters to group by pairs. 2011-03-13 18:41:32 +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
5079259a8e Small change to Color. 2011-03-12 15:16:17 +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
Jonathan Puckey
fed52bd521 Paperscript#run: keep tool on global the paper object. 2011-03-09 19:33:53 +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
df0c95e41f Fix bug in Tool.js. 2011-03-09 16:51:50 +01:00
Jonathan Puckey
f57a7ba0d9 Use Math.min / Math.max to clamp component values in color classes. 2011-03-09 16:48:53 +01:00
Jonathan Puckey
08d66ae231 Color: small change. 2011-03-09 15:50:32 +01:00
Jonathan Puckey
87de9f4fa8 Further refactoring in Color. 2011-03-09 15:25:41 +01:00
Jonathan Puckey
30d2f16c8c Color: save a var statement. 2011-03-09 15:00:13 +01:00
Jonathan Puckey
da92ff9773 Check for min and max values in the different color component setters. 2011-03-09 14:48:16 +01:00
Jürg Lehni
41ce6279f1 Merge remote-tracking branch 'origin/master'
Conflicts:
	src/color/Color.js
2011-03-09 13:34:13 +00:00
Jürg Lehni
9fd0381b82 Minor clean-ups. 2011-03-09 13:31:40 +00:00
Jonathan Puckey
b7902635bf Color#setAlpha: comment out code using Math.min and Math.max, which was supposed to just be there to explain what is happening. 2011-03-09 14:31:30 +01:00
Jonathan Puckey
bda24fbd54 Color: simplify stringToRGB again. 2011-03-09 14:29:19 +01:00
Jonathan Puckey
eacf346aab Color: reintroduce hexToRGB to be called from stringToRGB. 2011-03-09 14:23:18 +01:00
Jonathan Puckey
741652aa9c Color: combine stringToRgb, namedToRgb and hexToRgb and optimize a bit. 2011-03-09 14:20:09 +01:00
Jonathan Puckey
526711ffd4 Fix and improve performance of Raster#getPixel. 2011-03-09 13:38:58 +01:00
Jonathan Puckey
00c4b5ee34 Small change to HSBColor#setHue. 2011-03-09 02:30:50 +01:00
Jonathan Puckey
6a26cf3228 Add HSBColor to load.js. 2011-03-09 02:24:35 +01:00
Jonathan Puckey
62db3e56dd Implement HSBColor, introduce Color#convert(type) and refactor color classes. 2011-03-09 02:23:39 +01:00
Jürg Lehni
526e2ea0ba Hide Curve#getLength() parameters from Bootstrap so it injects bean too. 2011-03-08 17:31:36 +00: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
195b089424 Clean up Path.* constructors and make sure they handle Base.read() returning null. 2011-03-08 17:20:30 +00:00
Jürg Lehni
484b2b0c94 Test code for Path#segments change observation. 2011-03-08 17:20:03 +00:00
Jürg Lehni
3927836441 Declare functions that work both as getters for beans and also as callalble functions with optional parameters differently, since they do not inject beans anymore if they declare parameters. 2011-03-08 17:19:02 +00:00
Jürg Lehni
dd9340d522 Handle all the calls to Base.read() differently, by checking result for null and bailing out if it is. 2011-03-08 17:17:36 +00:00
Jürg Lehni
ea9a1d2c47 Fix Base.read() to correctly read existing objects even when length > 1. 2011-03-08 17:08:30 +00:00
Jürg Lehni
74167ff28d Add test code for segments list that detects change. 2011-03-08 13:19:08 +00:00
Jürg Lehni
fc0d3efd29 Simplify Path constructor further. 2011-03-08 13:03:57 +00:00
Jürg Lehni
e35fb1efb6 Move populating of segments list to Path#setSegments() and rely on it in constructor. 2011-03-08 13:03:11 +00:00
Jürg Lehni
848befe103 No need to create a new segments array in setSegments, just set length of existing one instead. 2011-03-08 13:00:32 +00:00
Jürg Lehni
7a4e49c5d5 Clean up Document#draw a bit and define param outside of loop. 2011-03-08 12:55:52 +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
34a6c7871c Clean-up loading code. 2011-03-08 01:07:26 +00:00
Jürg Lehni
2e55cd9871 Clean up source loading sequence, and rename test_function.js to helpers.js 2011-03-08 01:05:01 +00:00
Jürg Lehni
4680283ce7 Simply use document.write() for script loading, as load.js seems not ready for primetime yet (it magically half-broke QUnit on Safari). 2011-03-08 00:58:47 +00:00
Jürg Lehni
de797aa0fe Improve load.js mechanism and make it work for QUnit too. 2011-03-08 00:17:42 +00:00
Jürg Lehni
8f78513174 Change naming of exported PaperScript methods. 2011-03-08 00:17:19 +00:00
Jürg Lehni
798bcd709a Since Firefox does not seem to support the <base> tag for script loading, roll our own solution through the load.js calls. 2011-03-07 23:11:41 +00:00
Jürg Lehni
3dd523a683 Merge remote-tracking branch 'origin/master' 2011-03-07 18:37:03 +00:00
Jürg Lehni
e32549aaf2 Switch to using load.js for loading the various parts of the library during development. 2011-03-07 18:36:42 +00:00
Jürg Lehni
6db184341a Fix a small syntax error. 2011-03-07 18:36:13 +00:00
Jürg Lehni
b4356078a7 Export PaperScript.install, so it can be loaded after onload. 2011-03-07 18:35:48 +00:00
Jürg Lehni
3685a614a5 Add copyright / license comment to main file and include Line.js and BlendMode.js in compiled library. 2011-03-07 18:34:17 +00:00
Jonathan Puckey
781fd4adda Fix Size#dot. 2011-03-07 18:49:43 +01:00
Jonathan Puckey
6b5ce7c18c Merge remote branch 'origin/master' 2011-03-07 18:39:25 +01:00
Jonathan Puckey
dc25512f73 Compress getters and setters of translateX / translateY / scaleX / scaleY / rotateX / rotateY. 2011-03-07 18:38:50 +01:00
Jürg Lehni
c4c5b070b5 Minor code clean-up. 2011-03-07 16:51:12 +00:00
Jürg Lehni
2a0c393b85 Simplify HSB code a little. 2011-03-07 16:51:00 +00:00
Jürg Lehni
350fef00ec Simplify new getter / setter generation code a bit. 2011-03-07 16:49:24 +00:00
Jürg Lehni
ff2b740c68 Use local references to often called Math functions, allowing uglify to shorten them further. 2011-03-07 16:49:02 +00:00
Jonathan Puckey
d713102734 Implement Color#saturation / Color#hue / Color#brightness and allow chaining of color channel setters. 2011-03-07 15:59:35 +01:00
Jonathan Puckey
513bd1da67 Merge remote branch 'origin/master' 2011-03-07 13:42:58 +01:00
Jonathan Puckey
69829e03f6 Rectangle: optimize creation of corner getters / setters and combine multiple variable declarations. 2011-03-07 13:42:50 +01:00
Jürg Lehni
8895209e3b Merge remote-tracking branch 'origin/master' 2011-03-07 12:01:33 +00:00
Jürg Lehni
59cb7e937e Add control over maximum iterations to Numerical.findRoot(). 2011-03-07 11:59:43 +00:00
Jonathan Puckey
5e99833ebb Merge remote branch 'origin/master' 2011-03-07 12:59:08 +01:00
Jürg Lehni
d9b8809f3c Further clean up getParameter() code. 2011-03-07 11:58:41 +00:00
Jonathan Puckey
1b7dbd659d Compress Rectangle corner getters and setters. 2011-03-07 12:58:00 +01:00
Jürg Lehni
7956b50886 Use === for undefined comparisons. 2011-03-07 11:52:04 +00:00
Jürg Lehni
1e8dffac08 Clean up getParameter() code. 2011-03-07 11:51:01 +00:00
Jürg Lehni
0ddfc9ef33 Add support for sub ranges and negatives lengths in Curve#getParameter(), a prerequirement for adding dash support. 2011-03-07 11:37:42 +00:00
Jürg Lehni
2ac9a13e2a Give Numerical methods more meaningful names. 2011-03-07 11:12:00 +00:00
Jürg Lehni
f5c79bf709 Clean up PaperScript code a bit. 2011-03-07 11:10:45 +00:00
Jürg Lehni
6d8c7787bd Export ToolEvent too. 2011-03-07 11:08:58 +00:00
Jürg Lehni
26caf099ca No need for all the .0 in brent() code. 2011-03-07 02:43:07 +00:00
Jürg Lehni
08545983d7 Minor clean-ups. 2011-03-07 02:38:07 +00:00
Jürg Lehni
4dd4072f6b Use push() instead fo concat() for better getParameter() performance. 2011-03-07 02:35:06 +00:00
Jürg Lehni
3d7e66053c Simplify getLength() for line ranges. 2011-03-07 02:33:36 +00:00
Jürg Lehni
172212c222 Clean-up code and comments. 2011-03-07 02:28:49 +00:00
Jürg Lehni
add0bcf1fd Yet more optimisations in getParameter(), both for straight lines and curves. 2011-03-07 02:26:59 +00:00
Jürg Lehni
0e8c346888 Further optimise getParameter() / getLength() code by reusing a integrand function and taking advantage of integral ranges. 2011-03-07 02:22:33 +00:00
Jürg Lehni
3447d11a6f Some minor clean-ups. 2011-03-07 01:40:18 +00:00
Jürg Lehni
027a5e67b9 Add getLength() optimisation for straight lines. 2011-03-07 01:37:18 +00:00
Jürg Lehni
f7f5a70b1c Fix recently newly introduced bug in getStrokeBounds(). 2011-03-07 01:30:45 +00:00
Jürg Lehni
e1a7aff2f0 Add copyright notice and license file. 2011-03-07 00:50:44 +00:00
Jürg Lehni
91160bc5d7 Add copyright notices. 2011-03-07 00:40:48 +00:00
Jürg Lehni
003cfbd32b Format Gauss tables nicer. 2011-03-07 00:38:33 +00:00
Jürg Lehni
0bfca81140 Clean-up getBounds() code and move to its own scope at the end of Path. 2011-03-07 00:36:44 +00:00
Jürg Lehni
9fdbd0146d Rename MathUtils to Numerical. 2011-03-07 00:21:04 +00:00
Jürg Lehni
58f5c8554e Add comments about initial guess. 2011-03-07 00:17:43 +00:00
Jürg Lehni
83fea3bf4e Clean up MathUtils code. 2011-03-07 00:17:32 +00:00
Jürg Lehni
65900f8790 Implement Curve#getParameter() using MathUtils.brent(), with the astonishing result that performance can match the Java side on Chrome! 2011-03-07 00:00:45 +00:00
Jürg Lehni
b1e90efc9e Add Van Wijngaarden–Dekker–Brent method for root finding, ported from Numerical Recipes in C. 2011-03-06 23:25:57 +00:00
Jürg Lehni
29e57cc521 Replace slow simpson() method with insanely fast Gauss-Legendre Numerical Integration by Jim Armstrong which was further optimised. 2011-03-06 23:24:33 +00:00
Jürg Lehni
c4ad95b0ac More variable chaining... 2011-03-06 22:06:24 +00:00
Jürg Lehni
4c13ca6961 Fix syntax errors (that magically work on Safari). 2011-03-06 22:06:06 +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
6def2b9d3a Clean-up Path#arcTo() code. 2011-03-06 21:13:55 +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
8ddf5a3d90 Add Matrix#createShiftless(), to return a copy of the matrix that lacks the translation. 2011-03-06 21:10:47 +00:00
Jürg Lehni
670512d123 Finally figured out why Matrix#applyToContext was not working right: The parameters where not passed in the right sequence! 2011-03-06 21:09:52 +00:00