1
0
Fork 0

Canvas: add helper to get parent of canvas.Element

This commit is contained in:
Thomas Geymayer 2013-10-23 17:33:12 +02:00
parent 326d2044a5
commit 5f54a68491

View file

@ -142,6 +142,20 @@ var Element = {
_node: props.wrapNode(ghost._node_ghost)
};
},
# Get parent group/element
getParent: func()
{
var parent_ghost = me._getParent();
if( parent_ghost == nil )
return nil;
var type = props.wrapNode(parent_ghost._node_ghost).getName();
var factory = me._getFactory(type);
if( factory == nil )
return parent_ghost;
return factory(parent_ghost);
},
# Check if elements represent same instance
#
# @param el Other Element or element ghost