From 2d103dd792bb628c5f2174fdb9a9296c6bcfc26b Mon Sep 17 00:00:00 2001 From: Jonathan Puckey Date: Mon, 4 Mar 2013 12:09:58 +0100 Subject: [PATCH] Improve and fix example documentation. --- src/path/Path.Constructors.js | 4 ++-- src/path/Path.js | 36 +++++++++++++++++------------------ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/path/Path.Constructors.js b/src/path/Path.Constructors.js index 7b449b24..90bc88f9 100644 --- a/src/path/Path.Constructors.js +++ b/src/path/Path.Constructors.js @@ -193,8 +193,8 @@ Path.inject({ statics: new function() { * * @example {@paperscript} * var rectangle = new Rectangle({ - * point: new Point(20, 20), - * size: new Size(60, 60) + * point: [20, 20], + * size: [180, 60] * }); * var path = new Path.Ellipse(rectangle); * path.fillColor = 'black'; diff --git a/src/path/Path.js b/src/path/Path.js index 8d8e2e76..f3eba7b0 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -1301,10 +1301,10 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{ * // Make the tangent vector 60pt long: * tangent.length = 60; * - * var path = new Path(); - * path.strokeColor = 'red'; - * path.add(point); - * path.add(point + tangent); + * var line = new Path({ + * segments: [point, point + tangent], + * strokeColor: 'red' + * }) * * @example {@paperscript height=200} * // Iterating over the length of a path: @@ -1331,11 +1331,10 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{ * // Make the tangent vector 60pt long: * tangent.length = 60; * - * var line = new Path(); - * line.strokeColor = 'red'; - * line.add(point); - * line.add(point + tangent); - * } + * var line = new Path({ + * segments: [point, point + tangent], + * strokeColor: 'red' + * }) */ getTangentAt: function(offset, isParameter) { var loc = this.getLocationAt(offset, isParameter); @@ -1373,10 +1372,10 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{ * // Make the normal vector 30pt long: * normal.length = 30; * - * var path = new Path(); - * path.strokeColor = 'red'; - * path.add(point); - * path.add(point + normal); + * var line = new Path({ + * segments: [point, point + normal], + * strokeColor: 'red' + * }); * * @example {@paperscript height=200} * // Iterating over the length of a path: @@ -1403,10 +1402,11 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{ * // Make the normal vector 30pt long: * normal.length = 30; * - * var path = new Path({ - * segments: [point, point + normal], - * strokeColor: 'red' - * }); + * var line = new Path({ + * segments: [point, point + normal], + * strokeColor: 'red' + * }); + * } */ getNormalAt: function(offset, isParameter) { var loc = this.getLocationAt(offset, isParameter); @@ -1456,7 +1456,7 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{ * center: view.center, * radius: 3, * fillColor: 'red' - * });; + * }); * * function onMouseMove(event) { * // Get the nearest point from the mouse position