mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-22 07:19:57 -05:00
Allow Rasters to be created directly from id strings.
This commit is contained in:
parent
8e25a951bc
commit
3f0a45a7c2
1 changed files with 4 additions and 1 deletions
|
@ -8,6 +8,9 @@ var Raster = this.Raster = Item.extend({
|
||||||
if (object.getContext) {
|
if (object.getContext) {
|
||||||
this.setCanvas(object);
|
this.setCanvas(object);
|
||||||
} else {
|
} else {
|
||||||
|
// If it's a string, get the element with this id first.
|
||||||
|
if (typeof object == 'string')
|
||||||
|
object = document.getElementById(object);
|
||||||
this.setImage(object);
|
this.setImage(object);
|
||||||
}
|
}
|
||||||
this.matrix = new Matrix();
|
this.matrix = new Matrix();
|
||||||
|
|
Loading…
Reference in a new issue