delayed image instance
parent
c765a5a0d8
commit
4f3f777762
|
@ -33,9 +33,17 @@ GameLib.D3.Image = function(
|
|||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_IMAGE
|
||||
GameLib.Component.COMPONENT_IMAGE,
|
||||
null,
|
||||
true
|
||||
);
|
||||
|
||||
GameLib.Event.Emit(
|
||||
GameLib.Event.LOAD_IMAGE,
|
||||
{
|
||||
image : this
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.Image.prototype = Object.create(GameLib.D3.API.Image.prototype);
|
||||
|
@ -46,29 +54,6 @@ GameLib.D3.Image.prototype.constructor = GameLib.D3.Image;
|
|||
* @returns {*}
|
||||
*/
|
||||
GameLib.D3.Image.prototype.createInstance = function() {
|
||||
|
||||
this.instance = document.createElement('img');
|
||||
|
||||
this.instance.onload = function() {
|
||||
|
||||
GameLib.Event.Emit(
|
||||
GameLib.Event.IMAGE_INSTANCE_CREATED,
|
||||
{
|
||||
image: this
|
||||
}
|
||||
);
|
||||
|
||||
}.bind(this);
|
||||
|
||||
this.instance.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QoWEQMQBXD4hQAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAABRSURBVGje7c8xDQAwCAAwmA3koA/PU8FB0jpo1nRc9uI4AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBgX0fjEoBa8xN1z4AAAAASUVORK5CYII=';
|
||||
|
||||
GameLib.Event.Emit(
|
||||
GameLib.Event.LOAD_IMAGE,
|
||||
{
|
||||
image : this
|
||||
}
|
||||
);
|
||||
|
||||
GameLib.Component.prototype.createInstance.call(this);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue