mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
More work on Project#getItems(match) docs.
This commit is contained in:
parent
c1dda3c2a3
commit
f0db48a77f
1 changed files with 26 additions and 6 deletions
|
@ -314,12 +314,11 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
||||||
/**
|
/**
|
||||||
* Fetch items contained within the project whose properties match the
|
* Fetch items contained within the project whose properties match the
|
||||||
* criteria in the specified object.
|
* criteria in the specified object.
|
||||||
* Matching supports regular expressions for
|
* Extended matching is possible by providing a compare function or
|
||||||
* strings, function callbacks, and plain object matching (as a subset).
|
* regular expression. Matching points, colors only work as a comparison
|
||||||
* Matching segments is not supported yet. Matching points, colors only
|
* of the full object, not partial matching (e.g. only providing the x-
|
||||||
* work as a comparison of the full object, not partial matching
|
* coordinate to match all points with that x-value). Partial matching
|
||||||
* (e.g. only providing the x-coordinate to match all points with that
|
* does work for {@link Item#data}.
|
||||||
* x-value). Partial matching does work for {@link Item#data}.
|
|
||||||
*
|
*
|
||||||
* @example {@paperscript} // Fetch all selected path items:
|
* @example {@paperscript} // Fetch all selected path items:
|
||||||
* var path1 = new Path.Circle({
|
* var path1 = new Path.Circle({
|
||||||
|
@ -346,6 +345,27 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
||||||
* // Change the fill color of the selected path to red:
|
* // Change the fill color of the selected path to red:
|
||||||
* items[0].fillColor = 'red';
|
* items[0].fillColor = 'red';
|
||||||
*
|
*
|
||||||
|
* @example {@paperscript} // Fetch all items with a specific fill color:
|
||||||
|
* var path1 = new Path.Circle({
|
||||||
|
* center: [50, 50],
|
||||||
|
* radius: 25,
|
||||||
|
* fillColor: 'black'
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* var path2 = new Path.Circle({
|
||||||
|
* center: [150, 50],
|
||||||
|
* radius: 25,
|
||||||
|
* fillColor: 'purple'
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Fetch all items with a purple fill color:
|
||||||
|
* var items = project.getItems({
|
||||||
|
* fillColor: 'purple'
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Change the fill color of the selected path to red:
|
||||||
|
* items[0].selected = true;
|
||||||
|
*
|
||||||
* @example {@paperscript} // Fetch items at a specific position:
|
* @example {@paperscript} // Fetch items at a specific position:
|
||||||
* var path1 = new Path.Circle({
|
* var path1 = new Path.Circle({
|
||||||
* center: [50, 50],
|
* center: [50, 50],
|
||||||
|
|
Loading…
Reference in a new issue