Add Image to Canvas API
This commit is contained in:
parent
c3bcb8a6de
commit
15e0e0d7c7
1 changed files with 23 additions and 1 deletions
|
@ -701,12 +701,34 @@ var Path = {
|
|||
}
|
||||
};
|
||||
|
||||
# Image
|
||||
# ==============================================================================
|
||||
# Class for an image element on a canvas
|
||||
#
|
||||
var Image = {
|
||||
new: func(parent, id)
|
||||
{
|
||||
var m = {
|
||||
parents: [Image, Element.new(parent, "image", id, arg)]
|
||||
};
|
||||
m.color = _createColorNodes(m._node, "color");
|
||||
m.sourceRect = m._node.getNode("source", 1);
|
||||
return m;
|
||||
},
|
||||
|
||||
setFile: func(file)
|
||||
{
|
||||
me.set("file", file);
|
||||
}
|
||||
};
|
||||
|
||||
# Element factories used by #Group elements to create children
|
||||
Group._element_factories = {
|
||||
"group": Group.new,
|
||||
"map": Map.new,
|
||||
"text": Text.new,
|
||||
"path": Path.new
|
||||
"path": Path.new,
|
||||
"image": Image.new
|
||||
};
|
||||
|
||||
# Canvas
|
||||
|
|
Loading…
Reference in a new issue