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 = {
|
CanvasProvider = {
|
||||||
canvases: [],
|
canvases: [],
|
||||||
getCanvas: function(width, height) {
|
getCanvas: function() {
|
||||||
|
var size = Size.read(arguments);
|
||||||
var canvas = this.canvases.length
|
var canvas = this.canvases.length
|
||||||
? this.canvases.pop()
|
? this.canvases.pop()
|
||||||
: document.createElement('canvas');
|
: document.createElement('canvas');
|
||||||
canvas.width = width;
|
canvas.width = size.width;
|
||||||
canvas.height = height;
|
canvas.height = size.height;
|
||||||
return canvas;
|
return canvas;
|
||||||
},
|
},
|
||||||
|
|
||||||
returnCanvas: function(canvas) {
|
returnCanvas: function(canvas) {
|
||||||
|
// reset canvas:
|
||||||
|
canvas.width = canvas.width;
|
||||||
this.canvases.push(canvas);
|
this.canvases.push(canvas);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue