Switch from inline @option tags to real doc tags.

This commit is contained in:
Jürg Lehni 2014-10-20 23:33:28 +02:00
parent c25548031b
commit 99ef521af4
7 changed files with 107 additions and 106 deletions

@ -1 +1 @@
Subproject commit 0d715f3430318411604eeb477080b7008a1dd27c Subproject commit d9e43ebb265a200172dfa6ac8366b2995317c04c

View file

@ -189,7 +189,7 @@
checkCollisions: function() { checkCollisions: function() {
var crashRock; var crashRock;
// move rocks and do a hit test // move rocks and do a hit-test
// between bounding rect of rocks and ship // between bounding rect of rocks and ship
for (var i = 0; i < Rocks.children.length; i++) { for (var i = 0; i < Rocks.children.length; i++) {
var rock = Rocks.children[i]; var rock = Rocks.children[i];

View file

@ -116,9 +116,9 @@ var PaperScope = Base.extend(/** @lends PaperScope# */{
/** /**
* Gives access to paper's configurable settings. * Gives access to paper's configurable settings.
* *
* {@option settings.applyMatrix:Boolean} * @option settings.applyMatrix {Boolean}
* {@option settings.handleSize:Number} * @option settings.handleSize {Number}
* {@option settings.hitTolerance:Number} * @option settings.hitTolerance {Number}
* *
* @name PaperScope#settings * @name PaperScope#settings
* @type Object * @type Object

View file

@ -1665,38 +1665,38 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
}, },
/** /**
* Perform a hit test on the item (and its children, if it is a * Perform a hit-test on the item (and its children, if it is a
* {@link Group} or {@link Layer}) at the location of the specified point. * {@link Group} or {@link Layer}) at the location of the specified point.
* *
* The options object allows you to control the specifics of the hit test * The options object allows you to control the specifics of the hit-test
* and may contain a combination of the following values: * and may contain a combination of the following values:
* *
* {@option options.tolerance:Number the tolerance of the hit test in * @option options.tolerance {Number} the tolerance of the hit-test in
* points. Can also be controlled through * points. Can also be controlled through
* {@link Project#options}{@code .hitTolerance}.} * {@link PaperScope#settings}{@code .hitTolerance}.
* {@option options.class:{Function} Only hit test again a certain item * @option options.class {Function} only hit-test again a certain item class
* class and its sub-classes: {@code Group, Layer, Path, CompoundPath, * and its sub-classes: {@code Group, Layer, Path, CompoundPath,
* Shape, Raster, PlacedSymbol, PointText}, etc.} * Shape, Raster, PlacedSymbol, PointText}, etc.
* {@option options.fill:{Boolean} hit test the fill of items.} * @option options.fill {Boolean} hit-test the fill of items.
* {@option options.stroke:{Boolean} hit test the stroke of path.} * @option options.stroke {Boolean} hit-test the stroke of path items,
* items, taking into account the setting of stroke color and width.} * taking into account the setting of stroke color and width.
* {@option options.segments:{Boolean} hit test for {@link Segment#point} of * @option options.segments {Boolean} hit-test for {@link Segment#point} of
* {@link Path} items.} * {@link Path} items.
* {@option options.curves:{Boolean} hit test the curves of path items, * @option options.curves {Boolean} hit-test the curves of path items,
* without taking the stroke color or width into account.} * without taking the stroke color or width into account.
* {@option options.handles:{Boolean} hit test for the handles.} * @option options.handles {Boolean} hit-test for the handles.
* ({@link Segment#handleIn} / {@link Segment#handleOut}) of path segments.} * ({@link Segment#handleIn} / {@link Segment#handleOut}) of path segments.
* {@option options.ends:{Boolean} only hit test for the first or * @option options.ends {Boolean} only hit-test for the first or last
* last segment points of open path items.} * segment points of open path items.
* {@option options.bounds:{Boolean} hit test the corners and * @option options.bounds {Boolean} hit-test the corners and side-centers of
* side-centers of the bounding rectangle of items ({@link Item#bounds}).} * the bounding rectangle of items ({@link Item#bounds}).
* {@option options.center:{Boolean} hit test the {@link Rectangle#center} * @option options.center {Boolean} hit-test the {@link Rectangle#center} of
* of the bounding rectangle of items ({@link Item#bounds}).} * the bounding rectangle of items ({@link Item#bounds}).
* {@option options.guides:{Boolean} hit test items that have * @option options.guides {Boolean} hit-test items that have
* {@link Item#guide} set to {@code true}.} * {@link Item#guide} set to {@code true}.
* {@option options.selected:{Boolean} only hit selected items.} * @option options.selected {Boolean} only hit selected items.
* *
* @param {Point} point The point where the hit test should be performed * @param {Point} point The point where the hit-test should be performed
* @param {Object} [options={ fill: true, stroke: true, segments: true, * @param {Object} [options={ fill: true, stroke: true, segments: true,
* tolerance: 2 }] * tolerance: 2 }]
* @return {HitResult} a hit result object that contains more * @return {HitResult} a hit result object that contains more
@ -1812,6 +1812,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
* Checks whether the item matches the criteria described by the given * Checks whether the item matches the criteria described by the given
* object, by iterating over all of its properties and matching against * object, by iterating over all of its properties and matching against
* their values through {@link #matches(name, compare)}. * their values through {@link #matches(name, compare)}.
*
* See {@link Project#getItems(match)} for a selection of illustrated * See {@link Project#getItems(match)} for a selection of illustrated
* examples. * examples.
* *
@ -1829,6 +1830,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
* partial matching (e.g. only providing the x-coordinate to match all * partial matching (e.g. only providing the x-coordinate to match all
* points with that x-value). Partial matching does work for * points with that x-value). Partial matching does work for
* {@link Item#data}. * {@link Item#data}.
*
* See {@link Project#getItems(match)} for a selection of illustrated * See {@link Project#getItems(match)} for a selection of illustrated
* examples. * examples.
* *
@ -1960,11 +1962,12 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
* Exports (serializes) the item with its content and child items to a JSON * Exports (serializes) the item with its content and child items to a JSON
* data string. * data string.
* *
* The options object offers control over some aspects of the SVG export: * The options object offers control over some aspects of the JSON export:
* {@option options.asString:{Boolean} whether the JSON is returned *
* as a {@code Object} or a {@code String}.} * @option options.asString {Boolean} whether the JSON is returned as a
* {@option options.precision:{Number} the amount of fractional * {@code Object} or a {@code String}.
* digits in numbers used in JSON data.} * @option options.precision {Number} the amount of fractional digits in
* numbers used in JSON data.
* *
* @name Item#exportJSON * @name Item#exportJSON
* @function * @function
@ -1997,12 +2000,12 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
* *
* The options object offers control over some aspects of the SVG export: * The options object offers control over some aspects of the SVG export:
* *
* {@option options.asString:{Boolean} whether a SVG node or a * @option options.asString {Boolean} whether a SVG node or a {@code String}
* {@code String} is to be returned.} * is to be returned.
* {@option options.precision:{Number} the amount of fractional digits in * @option options.precision {Number} the amount of fractional digits in
* numbers used in SVG data.} * numbers used in SVG data.
* {@option options.matchShapes:{Boolean} whether path items should tried to * @option options.matchShapes {Boolean} whether path items should tried to
* be converted to shape items, if their geometries can be made to match.} * be converted to shape items, if their geometries can be made to match.
* *
* @name Item#exportSVG * @name Item#exportSVG
* @function * @function
@ -2020,8 +2023,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
* *
* The options object offers control over some aspects of the SVG import: * The options object offers control over some aspects of the SVG import:
* *
* {@option options.expandShapes:{Boolean} whether imported shape * @option options.expandShapes {Boolean} whether imported shape items
* items should be expanded to path items.} * should be expanded to path items.
* *
* @name Item#importSVG * @name Item#importSVG
* @function * @function
@ -3188,12 +3191,12 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
* The function receives an event object which contains information about * The function receives an event object which contains information about
* the frame event: * the frame event:
* *
* {@option event.count:{Number} the number of times the frame event was * @option event.count {Number} the number of times the frame event was
* fired.} * fired.
* {@option event.time:{Number} the total amount of time passed since the * @option event.time {Number} the total amount of time passed since the
* first frame event in seconds.} * first frame event in seconds.
* {@option event.delta:{Number} the time passed in seconds since the last * @option event.delta {Number} the time passed in seconds since the last
* frame event.} * frame event.
* *
* @see View#onFrame * @see View#onFrame
* @example {@paperscript} * @example {@paperscript}

View file

@ -287,38 +287,38 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
}, },
/** /**
* Perform a hit test on the items contained within the project at the * Perform a hit-test on the items contained within the project at the
* location of the specified point. * location of the specified point.
* *
* The options object allows you to control the specifics of the hit test * The options object allows you to control the specifics of the hit-test
* and may contain a combination of the following values: * and may contain a combination of the following values:
* *
* {@option options.tolerance:Number the tolerance of the hit test in * @option options.tolerance {Number} the tolerance of the hit-test in
* points. Can also be controlled through * points. Can also be controlled through
* {@link Project#options}{@code .hitTolerance}.} * {@link PaperScope#settings}{@code .hitTolerance}.
* {@option options.class:{Function} Only hit test again a certain item * @option options.class {Function} only hit-test again a certain item class
* class and its sub-classes: {@code Group, Layer, Path, CompoundPath, * and its sub-classes: {@code Group, Layer, Path, CompoundPath,
* Shape, Raster, PlacedSymbol, PointText}, etc.} * Shape, Raster, PlacedSymbol, PointText}, etc.
* {@option options.fill:{Boolean} hit test the fill of items.} * @option options.fill {Boolean} hit-test the fill of items.
* {@option options.stroke:{Boolean} hit test the stroke of path.} * @option options.stroke {Boolean} hit-test the stroke of path items,
* items, taking into account the setting of stroke color and width.} * taking into account the setting of stroke color and width.
* {@option options.segments:{Boolean} hit test for {@link Segment#point} of * @option options.segments {Boolean} hit-test for {@link Segment#point} of
* {@link Path} items.} * {@link Path} items.
* {@option options.curves:{Boolean} hit test the curves of path items, * @option options.curves {Boolean} hit-test the curves of path items,
* without taking the stroke color or width into account.} * without taking the stroke color or width into account.
* {@option options.handles:{Boolean} hit test for the handles.} * @option options.handles {Boolean} hit-test for the handles.
* ({@link Segment#handleIn} / {@link Segment#handleOut}) of path segments.} * ({@link Segment#handleIn} / {@link Segment#handleOut}) of path segments.
* {@option options.ends:{Boolean} only hit test for the first or * @option options.ends {Boolean} only hit-test for the first or last
* last segment points of open path items.} * segment points of open path items.
* {@option options.bounds:{Boolean} hit test the corners and * @option options.bounds {Boolean} hit-test the corners and side-centers of
* side-centers of the bounding rectangle of items ({@link Item#bounds}).} * the bounding rectangle of items ({@link Item#bounds}).
* {@option options.center:{Boolean} hit test the {@link Rectangle#center} * @option options.center {Boolean} hit-test the {@link Rectangle#center} of
* of the bounding rectangle of items ({@link Item#bounds}).} * the bounding rectangle of items ({@link Item#bounds}).
* {@option options.guides:{Boolean} hit test items that have * @option options.guides {Boolean} hit-test items that have
* {@link Item#guide} set to {@code true}.} * {@link Item#guide} set to {@code true}.
* {@option options.selected:{Boolean} only hit selected items.} * @option options.selected {Boolean} only hit selected items.
* *
* @param {Point} point the point where the hit test should be performed * @param {Point} point the point where the hit-test should be performed
* @param {Object} [options={ fill: true, stroke: true, segments: true, * @param {Object} [options={ fill: true, stroke: true, segments: true,
* tolerance: true }] * tolerance: true }]
* @return {HitResult} a hit result object that contains more * @return {HitResult} a hit result object that contains more
@ -584,14 +584,12 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
* Exports (serializes) the project with all its layers and child items to * Exports (serializes) the project with all its layers and child items to
* a JSON data string. * a JSON data string.
* *
* The options object offers control over some aspects of the SVG export: * The options object offers control over some aspects of the JSON export:
* *
* {@option options.asString:{Boolean} whether a SVG node or a {@code String} * @option options.asString {Boolean} whether the JSON is returned as a
* is to be returned.} * {@code Object} or a {@code String}.
* {@option options.precision:{Number} the amount of fractional digits in * @option options.precision {Number} the amount of fractional digits in
* numbers used in SVG data.} * numbers used in JSON data.
* {@option options.matchShapes:{Boolean} whether imported path items should
* tried to be converted to shape items, if their geometries match.}
* *
* @name Project#exportJSON * @name Project#exportJSON
* @function * @function
@ -621,12 +619,12 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
* *
* The options object offers control over some aspects of the SVG export: * The options object offers control over some aspects of the SVG export:
* *
* {@option options.asString:{Boolean} whether a SVG node or a * @option options.asString {Boolean} whether a SVG node or a {@code String}
* {@code String} is to be returned.} * is to be returned.
* {@option options.precision:{Number} the amount of fractional digits in * @option options.precision {Number} the amount of fractional digits in
* numbers used in SVG data.} * numbers used in SVG data.
* {@option options.matchShapes:{Boolean} whether path items should tried to * @option options.matchShapes {Boolean} whether path items should tried to
* be converted to shape items, if their geometries can be made to match.} * be converted to shape items, if their geometries can be made to match.
* *
* @name Project#exportSVG * @name Project#exportSVG
* @function * @function
@ -644,8 +642,8 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
* *
* The options object offers control over some aspects of the SVG import: * The options object offers control over some aspects of the SVG import:
* *
* {@option options.expandShapes:{Boolean} whether imported shape * @option options.expandShapes {Boolean} whether imported shape items
* items should be expanded to path items.} * should be expanded to path items.
* *
* @name Project#importSVG * @name Project#importSVG
* @function * @function

View file

@ -510,11 +510,11 @@ var View = Base.extend(Emitter, /** @lends View# */{
* The function receives an event object which contains information about * The function receives an event object which contains information about
* the frame event: * the frame event:
* *
* <b>{@code event.count}</b>: the number of times the frame event was * @option event.count {Number} the number of times the frame event was
* fired. * fired.
* <b>{@code event.time}</b>: the total amount of time passed since the * @option event.time {Number} the total amount of time passed since the
* first frame event in seconds. * first frame event in seconds.
* <b>{@code event.delta}</b>: the time passed in seconds since the last * @code event.delta {Number} the time passed in seconds since the last
* frame event. * frame event.
* *
* @example {@paperscript} * @example {@paperscript}

View file

@ -46,7 +46,7 @@ test('the item on top should be returned', function() {
test('hitting a stroked path', function() { test('hitting a stroked path', function() {
var path = new Path([0, 0], [50, 0]); var path = new Path([0, 0], [50, 0]);
// We are hit testing with an offset of 5pt on a path with a stroke width // We are hit-testing with an offset of 5pt on a path with a stroke width
// of 10: // of 10:
var hitResult = paper.project.hitTest([25, 5]); var hitResult = paper.project.hitTest([25, 5]);
@ -260,7 +260,7 @@ test('hitting path handles (2)', function() {
} }
}); });
test('hit testing stroke on segment point of a path', function() { test('hit-testing stroke on segment point of a path', function() {
var path = new Path([0, 0], [50, 50], [100, 0]); var path = new Path([0, 0], [50, 50], [100, 0]);
path.strokeColor = 'black'; path.strokeColor = 'black';
path.closed = true; path.closed = true;
@ -273,7 +273,7 @@ test('hit testing stroke on segment point of a path', function() {
} catch (e) { } catch (e) {
error = e; error = e;
} }
var description = 'This hit test should not throw an error'; var description = 'This hit-test should not throw an error';
if (error) if (error)
description += ': ' + error; description += ': ' + error;
equals(error == null, true, description); equals(error == null, true, description);
@ -291,7 +291,7 @@ test('Hit testing a point that is extremely close to a curve', function() {
} catch(e) { } catch(e) {
error = e; error = e;
} }
var description = 'This hit test should not throw an error'; var description = 'This hit-test should not throw an error';
if (error) if (error)
description += ': ' + error; description += ': ' + error;
equals(error == null, true, description); equals(error == null, true, description);
@ -475,7 +475,7 @@ test('hitting path with a text item in the project', function() {
}); });
test('Check hit testing of items that come after a transformed group.', function() { test('Check hit-testing of items that come after a transformed group.', function() {
paper.project.currentStyle.fillColor = 'black'; paper.project.currentStyle.fillColor = 'black';
var point1 = new Point(100, 100); var point1 = new Point(100, 100);
var point2 = new Point(140, 100); var point2 = new Point(140, 100);
@ -509,37 +509,37 @@ test('Check hit testing of items that come after a transformed group.', function
hitResult = paper.project.hitTest(point1); hitResult = paper.project.hitTest(point1);
equals(function() { equals(function() {
return hitResult && hitResult.item; return hitResult && hitResult.item;
}, path1, 'After translating group, hit testing project for point1 should give us path1.'); }, path1, 'After translating group, hit-testing project for point1 should give us path1.');
hitResult = paper.project.hitTest(point2.add(delta)); hitResult = paper.project.hitTest(point2.add(delta));
equals(function() { equals(function() {
return hitResult && hitResult.item; return hitResult && hitResult.item;
}, path2, 'After translating group, hit testing project for point2 + delta should give us path2.'); }, path2, 'After translating group, hit-testing project for point2 + delta should give us path2.');
hitResult = path1.hitTest(point1); hitResult = path1.hitTest(point1);
equals(function() { equals(function() {
return hitResult && hitResult.item; return hitResult && hitResult.item;
}, path1, 'After translating group, hit testing path1 for point1 should give us path1.'); }, path1, 'After translating group, hit-testing path1 for point1 should give us path1.');
group.moveBelow(path1); group.moveBelow(path1);
hitResult = paper.project.hitTest(point1); hitResult = paper.project.hitTest(point1);
equals(function() { equals(function() {
return hitResult && hitResult.item; return hitResult && hitResult.item;
}, path1, 'After moving group before path1, hit testing project for point1 should give us path1.'); }, path1, 'After moving group before path1, hit-testing project for point1 should give us path1.');
hitResult = paper.project.hitTest(point2.add(delta)); hitResult = paper.project.hitTest(point2.add(delta));
equals(function() { equals(function() {
return hitResult && hitResult.item; return hitResult && hitResult.item;
}, path2, 'After moving group before path1, hit testing project for point2 + delta should give us path2.'); }, path2, 'After moving group before path1, hit-testing project for point2 + delta should give us path2.');
hitResult = path1.hitTest(point1); hitResult = path1.hitTest(point1);
equals(function() { equals(function() {
return hitResult && hitResult.item; return hitResult && hitResult.item;
}, path1, 'After moving group before path1, hit testing path1 for point1 should give us path1.'); }, path1, 'After moving group before path1, hit-testing path1 for point1 should give us path1.');
}); });
test('Check hit testing of placed symbols.', function() { test('Check hit-testing of placed symbols.', function() {
var point = new Point(100, 100); var point = new Point(100, 100);
var path = new Path.Circle([0, 0], 20); var path = new Path.Circle([0, 0], 20);