mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Support passing canvas ids straight to View constructor.
This commit is contained in:
parent
6b3fdb0880
commit
9195f026d7
1 changed files with 3 additions and 1 deletions
|
@ -35,7 +35,9 @@ var View = this.View = Base.extend(/** @lends View# */{
|
|||
this._index = this._scope.views.push(this) - 1;
|
||||
// Handle canvas argument
|
||||
var size;
|
||||
if (canvas && canvas instanceof HTMLCanvasElement) {
|
||||
if (typeof canvas === 'string')
|
||||
canvas = document.getElementById(canvas);
|
||||
if (canvas instanceof HTMLCanvasElement) {
|
||||
this._canvas = canvas;
|
||||
// If the canvas has the resize attribute, resize the it to fill the
|
||||
// window and resize it again whenever the user resizes the window.
|
||||
|
|
Loading…
Reference in a new issue