我有:
var current_image_;
var canvas_;
canvas_ = new fabric.Canvas('myid');
canvas_.renderOnAddRemove = false;
function LoadImage(path)
{
fabric.Image.fromURL(path, function(oImg) {
// Something
current_image_ = oImg;
});
Draw();
}
// Other things
function Draw()
{
canvas_.clear();
canvas_.add(current_image_);
canvas_.renderAll();
}
current_image_
始终为空引用。为什么?实际上它不会渲染任何东西。
我只想尝试在某些时候渲染整个场景,但我觉得错误。
谢谢!