mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Allow CanvasProvider to receive sizes too.
This commit is contained in:
parent
f1cd24eef8
commit
dc51384a1a
1 changed files with 6 additions and 3 deletions
|
@ -1,15 +1,18 @@
|
|||
CanvasProvider = {
|
||||
canvases: [],
|
||||
getCanvas: function(width, height) {
|
||||
getCanvas: function() {
|
||||
var size = Size.read(arguments);
|
||||
var canvas = this.canvases.length
|
||||
? this.canvases.pop()
|
||||
: document.createElement('canvas');
|
||||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
canvas.width = size.width;
|
||||
canvas.height = size.height;
|
||||
return canvas;
|
||||
},
|
||||
|
||||
returnCanvas: function(canvas) {
|
||||
// reset canvas:
|
||||
canvas.width = canvas.width;
|
||||
this.canvases.push(canvas);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue