move "hidden" constructor from api.nas to api/canvas.nas; add destructor support
This commit is contained in:
parent
3892d2eddd
commit
e16bf79e91
2 changed files with 14 additions and 8 deletions
|
@ -39,14 +39,11 @@ Group._element_factories = {
|
||||||
io.include(include_path~"canvas.nas");
|
io.include(include_path~"canvas.nas");
|
||||||
|
|
||||||
# @param g Canvas ghost
|
# @param g Canvas ghost
|
||||||
var wrapCanvas = func(g)
|
var wrapCanvas = func(g) {
|
||||||
{
|
if (g != nil and g._impl == nil) {
|
||||||
if( g != nil and g._impl == nil )
|
g._impl = Canvas._new(g);
|
||||||
g._impl = {
|
}
|
||||||
parents: [PropertyElement, Canvas],
|
return g;
|
||||||
_node: props.wrapNode(g._node_ghost)
|
|
||||||
};
|
|
||||||
return g;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create a new canvas. Pass parameters as hash, eg:
|
# Create a new canvas. Pass parameters as hash, eg:
|
||||||
|
|
|
@ -5,6 +5,15 @@
|
||||||
# not to be confused with the namespace canvas (case sensitive!)
|
# not to be confused with the namespace canvas (case sensitive!)
|
||||||
#
|
#
|
||||||
var Canvas = {
|
var Canvas = {
|
||||||
|
# private helper for wrapCanvas;
|
||||||
|
_new: func(canvas_ghost) {
|
||||||
|
var obj = {
|
||||||
|
parents: [Canvas, PropertyElement],
|
||||||
|
_node: props.wrapNode(canvas_ghost._node_ghost),
|
||||||
|
};
|
||||||
|
return obj;
|
||||||
|
},
|
||||||
|
|
||||||
# Place this canvas somewhere onto the object. Pass criterions for placement
|
# Place this canvas somewhere onto the object. Pass criterions for placement
|
||||||
# as a hash, eg:
|
# as a hash, eg:
|
||||||
#
|
#
|
||||||
|
|
Loading…
Add table
Reference in a new issue