tapspace
Version:
A zoomable user interface lib for web apps
23 lines (22 loc) • 598 B
JavaScript
module.exports = function () {
// @Component:getAncestors()
//
// Get an array of affine ancestors of this node, ordered from
// the immediate parent to the farthest ancestor, the immediate parent first.
// The list of ancestors includes a space and a viewport, given that
// the node is placed in a space.
//
// Return
// array of Component
//
// Complexity
// O(d) where d is the depth of the affine tree
//
const arr = []
let par = this.element.parentElement
while (par && par.affine) {
arr.push(par.affine)
par = par.parentElement
}
return arr
}