mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-09 14:22:08 -05:00
17 lines
365 B
JavaScript
17 lines
365 B
JavaScript
CanvasProvider = {
|
|
canvases: [],
|
|
getCanvas: function(size) {
|
|
var canvas = this.canvases.length
|
|
? this.canvases.pop()
|
|
: document.createElement('canvas');
|
|
canvas.width = size.width;
|
|
canvas.height = size.height;
|
|
return canvas;
|
|
},
|
|
|
|
returnCanvas: function(canvas) {
|
|
// reset canvas:
|
|
canvas.width = canvas.width;
|
|
this.canvases.push(canvas);
|
|
}
|
|
};
|