I load the raster in a function in a text/paperscript file as : function loadRaster(name) { var raster = new Raster(name,view.center); raster.scale(0.2); }
Raster then appears on canvas as expected.
In a different paperscript file (both paperscript files are referring the same canvas object in the tag as specified in https://github.com/paperjs/paper.js/issues/153 ), in another function I rotate the raster:
function rotateRaster(raster, angle) {
raster.rotate(angle);
....
processLater();
}
function processLater() {
...
window.setTimeout(function() { view.update(); },0);
..
}
Now I find that when I call loadRaster() and then rotateRaster() with the appropriate arguments, for an instant I do see the raster on the canvas but it disappears. When I stepped through the code, it seems that the raster is vanishing clearRect() but not getting redrawn in project.draw() in view.update():
update: function(force) {
var project = this._project;
if (!project || !force && !project._needsUpdate)
retu false;
var ctx = this._context,
size = this._viewSize;
ctx.clearRect(0, 0, size.width + 1, size.height + 1);
project.draw(ctx, this._matrix, this._pixelRatio);
project._needsUpdate = false;
retu true;
Other canvas elements are being redrawn but not the raster
I dont use the project object explicitly in my code.
I am wondering whats the error in what I am doing?
