Path: add docs for Style Tests group and move Path#isInserted() to Hierarchy Tests group.

This commit is contained in:
Jonathan Puckey 2014-04-28 18:41:40 +02:00
parent 8c32dda435
commit 1d905f5c58

View file

@ -447,21 +447,6 @@ var Item = Base.extend(Callback, /** @lends Item# */{
// Don't access _style directly so Path#getStyle() can be overriden for
// CompoundPaths.
this.getStyle().set(style);
},
// DOCS: Item#hasFill()
hasFill: function() {
return this.getStyle().hasFill();
},
// DOCS: Item#hasStroke()
hasStroke: function() {
return this.getStyle().hasStroke();
},
// DOCS: Item#hasShadow()
hasShadow: function() {
return this.getStyle().hasShadow();
}
}, Base.each(['locked', 'visible', 'blendMode', 'opacity', 'guide'],
// Produce getter/setters for properties. We need setters because we want to
@ -2319,16 +2304,6 @@ var Item = Base.extend(Callback, /** @lends Item# */{
return !this._children || this._children.length === 0;
},
/**
* Checks whether the item and all its parents are inserted into the DOM or
* not.
*
* @return {Boolean} {@true if the item is inserted into the DOM}
*/
isInserted: function() {
return this._parent ? this._parent.isInserted() : false;
},
/**
* Checks whether the item is editable.
*
@ -2353,6 +2328,35 @@ var Item = Base.extend(Callback, /** @lends Item# */{
*/
// TODO: isValid / checkValid
/**
* {@grouptitle Style Tests}
*
* Checks whether the item has a fill.
*
* @return {Boolean} {@true if the item has a fill}
*/
hasFill: function() {
return this.getStyle().hasFill();
},
/**
* Checks whether the item has a stroke.
*
* @return {Boolean} {@true if the item has a stroke}
*/
hasStroke: function() {
return this.getStyle().hasStroke();
},
/**
* Checks whether the item has a shadow.
*
* @return {Boolean} {@true if the item has a shadow}
*/
hasShadow: function() {
return this.getStyle().hasShadow();
},
/**
* Returns -1 if 'this' is above 'item', 1 if below, 0 if their order is not
* defined in such a way, e.g. if one is a descendant of the other.
@ -2390,6 +2394,16 @@ var Item = Base.extend(Callback, /** @lends Item# */{
return this._children && this._children.length > 0;
},
/**
* Checks whether the item and all its parents are inserted into the DOM or
* not.
*
* @return {Boolean} {@true if the item is inserted into the DOM}
*/
isInserted: function() {
return this._parent ? this._parent.isInserted() : false;
},
/**
* Checks if this item is above the specified item in the stacking order
* of the project.