mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-20 22:39:50 -05:00
Document: subtract the offset of the canvas element from the size of the window when resizing.
This commit is contained in:
parent
c8f13b4ace
commit
7e24a9170f
1 changed files with 4 additions and 2 deletions
|
@ -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();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue