1
0
Fork 0

Use core Canvas Nasal helpers

This commit is contained in:
Thomas Geymayer 2012-11-15 14:19:09 +01:00
parent 680167ccab
commit fa97e5ea7a
2 changed files with 16 additions and 3 deletions

View file

@ -745,7 +745,7 @@ var Canvas = {
# Get path of canvas to be used eg. in Image::setFile
getPath: func()
{
return "canvas://by-index/texture[" ~ me._node.getIndex() ~ "]";
return "canvas://by-index/texture[" ~ me.texture.getIndex() ~ "]";
}
};
@ -759,9 +759,9 @@ var Canvas = {
# });
var new = func(vals)
{
var m = { parents: [Canvas] };
var m = { parents: [Canvas, _newCanvasGhost()] };
m.texture = Canvas.property_root.addChild("texture", 0, 0);
m.texture = props.wrapNode(m._node_ghost);
m.texture.setValues(vals);
return m;

View file

@ -56,6 +56,19 @@ Canvas.setStrokeDashArray = func(pattern)
return me;
};
# Internal helper for creating a canvas.
#
# @note In 2.9+ this function is replaced by a C++ function. This
# implementation is just used as fallback for 2.8 and for usage
# in other programs.
canvas._newCanvasGhost = func()
{
return {
parents: [Canvas],
texture: Canvas.property_root.addChild("texture", 0, 0)
};
};
print("Canvas API: FlightGear 2.8 backward support loaded.");
})();