53 lines
1.0 KiB
JavaScript
53 lines
1.0 KiB
JavaScript
/**
|
|
* @file
|
|
* Handles AE's layer parenting property.
|
|
*
|
|
*/
|
|
|
|
function HierarchyElement() {}
|
|
|
|
HierarchyElement.prototype = {
|
|
/**
|
|
* @function
|
|
* Initializes hierarchy properties
|
|
*
|
|
*/
|
|
initHierarchy: function () {
|
|
// element's parent list
|
|
this.hierarchy = [];
|
|
// if element is parent of another layer _isParent will be true
|
|
this._isParent = false;
|
|
this.checkParenting();
|
|
},
|
|
/**
|
|
* @function
|
|
* Sets layer's hierarchy.
|
|
* @param {array} hierarch
|
|
* layer's parent list
|
|
*
|
|
*/
|
|
setHierarchy: function (hierarchy) {
|
|
this.hierarchy = hierarchy;
|
|
},
|
|
/**
|
|
* @function
|
|
* Sets layer as parent.
|
|
*
|
|
*/
|
|
setAsParent: function () {
|
|
this._isParent = true;
|
|
},
|
|
/**
|
|
* @function
|
|
* Searches layer's parenting chain
|
|
*
|
|
*/
|
|
checkParenting: function () {
|
|
if (this.data.parent !== undefined) {
|
|
this.comp.buildElementParenting(this, this.data.parent, []);
|
|
}
|
|
},
|
|
};
|
|
|
|
export default HierarchyElement;
|