Adding doc and fixing broken references

master
Dmitry Baranovskiy 2013-07-26 13:47:26 +10:00
parent a9a99faada
commit fe71fc7505
2 changed files with 45 additions and 2 deletions

View File

@ -75,7 +75,7 @@ Savage.plugin(function (Savage, Element, Paper, glob) {
out += a + "]";
b[i] = out;
}
return Function("val", "return Savage.path2string.call([" + b + "]);");
return Function("val", "return Savage.path.toString.call([" + b + "])");
}
function path2array(path) {
var out = [];
@ -109,7 +109,7 @@ Savage.plugin(function (Savage, Element, Paper, glob) {
return equaliseTransform(a.local, b);
}
if (name == "d" || name == "path") {
A = Savage.path2curve(a, b);
A = Savage.path.toCubic(a, b);
return {
from: path2array(A[0]),
to: path2array(A[1]),

View File

@ -1267,9 +1267,52 @@ Savage.plugin(function (Savage, Element, Paper, glob) {
Savage.path.getBBox = pathBBox;
// TODO add doc
Savage.path.get = getPath;
/*\
* Savage.path.toRelative
[ method ]
**
* Utility method
**
* Converts path coordinates into relative values.
> Parameters
- path (string) path string
= (array) path string
\*/
Savage.path.toRelative = pathToRelative;
/*\
* Savage.path.toAbsolute
[ method ]
**
* Utility method
**
* Converts path coordinates into absolute values.
> Parameters
- path (string) path string
= (array) path string
\*/
Savage.path.toAbsolute = pathToAbsolute;
/*\
* Savage.path.toCubic
[ method ]
**
* Utility method
**
* Converts path to a new path where all segments are cubic bezier curves.
> Parameters
- pathString (string|array) path string or array of segments
= (array) array of segments.
\*/
Savage.path.toCubic = path2curve;
/*\
* Savage.path.map
[ method ]
**
* Transform the path string with given matrix.
> Parameters
- path (string) path string
- matrix (object) see @Matrix
= (string) transformed path string
\*/
Savage.path.map = mapPath;
Savage.path.toString = toString;
Savage.path.clone = pathClone;