mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-03-15 17:29:52 -04: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;
|
this._index = this._scope.views.push(this) - 1;
|
||||||
// Handle canvas argument
|
// Handle canvas argument
|
||||||
var size;
|
var size;
|
||||||
if (canvas && canvas instanceof HTMLCanvasElement) {
|
if (typeof canvas === 'string')
|
||||||
|
canvas = document.getElementById(canvas);
|
||||||
|
if (canvas instanceof HTMLCanvasElement) {
|
||||||
this._canvas = canvas;
|
this._canvas = canvas;
|
||||||
// If the canvas has the resize attribute, resize the it to fill the
|
// If the canvas has the resize attribute, resize the it to fill the
|
||||||
// window and resize it again whenever the user resizes the window.
|
// window and resize it again whenever the user resizes the window.
|
||||||
|
|
Loading…
Reference in a new issue