HierarchyElement.js 1015 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /**
  2. * @file
  3. * Handles AE's layer parenting property.
  4. *
  5. */
  6. function HierarchyElement() {}
  7. HierarchyElement.prototype = {
  8. /**
  9. * @function
  10. * Initializes hierarchy properties
  11. *
  12. */
  13. initHierarchy: function () {
  14. // element's parent list
  15. this.hierarchy = [];
  16. // if element is parent of another layer _isParent will be true
  17. this._isParent = false;
  18. this.checkParenting();
  19. },
  20. /**
  21. * @function
  22. * Sets layer's hierarchy.
  23. * @param {array} hierarch
  24. * layer's parent list
  25. *
  26. */
  27. setHierarchy: function (hierarchy) {
  28. this.hierarchy = hierarchy;
  29. },
  30. /**
  31. * @function
  32. * Sets layer as parent.
  33. *
  34. */
  35. setAsParent: function () {
  36. this._isParent = true;
  37. },
  38. /**
  39. * @function
  40. * Searches layer's parenting chain
  41. *
  42. */
  43. checkParenting: function () {
  44. if (this.data.parent !== undefined) {
  45. this.comp.buildElementParenting(this, this.data.parent, []);
  46. }
  47. },
  48. };
  49. export default HierarchyElement;