Document: subtract the offset of the canvas element from the size of the window when resizing.

This commit is contained in:
Jonathan Puckey 2011-05-05 20:19:54 +01:00
parent c8f13b4ace
commit 7e24a9170f

View file

@ -30,13 +30,15 @@ var Document = this.Document = Base.extend({
// margin: 0;
// overflow: hidden;
// }
this._size = Element.getScrollBounds().size;
this._size = Element.getScrollBounds().size
.subtract(Element.getOffset(this.canvas));
this.canvas.width = this._size.width;
this.canvas.height = this._size.height;
var that = this;
Event.add(window, {
resize: function(event) {
that.setSize(Element.getScrollBounds().size);
that.setSize(Element.getScrollBounds().size
.subtract(Element.getOffset(that.canvas)));
that.redraw();
}
});