Permalink
Browse files

correction to sceneimage

  • Loading branch information...
1 parent ec9d184 commit 59348d8bde7bd381d9886d69752d9a5ae81d7178 @dyoo dyoo committed Mar 22, 2013
Showing with 10 additions and 4 deletions.
  1. +10 −4 js-runtime/lib/world/world.js
@@ -316,17 +316,23 @@ if (typeof(world) === 'undefined') {
SceneImage.prototype.render = function(ctx, x, y) {
var i;
var childImage, childX, childY;
+ ctx.save();
+ ctx.fillStyle="white";
+ ctx.fillRect(x, y, this.width, this.height);
+ ctx.restore();
+
+ ctx.save();
+ ctx.rect(x, y, this.width, this.height);
+ ctx.clip();
// Ask every object to render itself.
for(i = 0; i < this.children.length; i++) {
childImage = this.children[i][0];
childX = this.children[i][1];
childY = this.children[i][2];
- ctx.save();
childImage.render(ctx, childX + x, childY + y);
- ctx.restore();
-
-
}
+ ctx.restore();
+
// Finally, draw the black border if withBorder is true
if (this.withBorder) {
ctx.strokeStyle = 'black';

0 comments on commit 59348d8

Please sign in to comment.