mirror of
https://github.com/hiloteam/Hilo.git
synced 2026-01-25 16:25:48 +00:00
6 lines
731 B
JavaScript
6 lines
731 B
JavaScript
/**
|
|
* hilojs 2.0.3 for cmd
|
|
* Copyright 2016 alibaba.com
|
|
* Licensed under the MIT License
|
|
*/
|
|
define(function(i,t,n){var e=i("hilo/core/Class"),r=i("hilo/util/util"),a=e.create({constructor:function(i){this.init(i)},image:null,rect:null,init:function(i){var t=this,n=t.image;a.isDrawable(i)?t.image=i:r.copy(t,i,!0);var e=t.image;if("string"==typeof e){if(!n||e!==n.getAttribute("src")){t.image=null;var o=new Image;return i.crossOrigin&&(o.crossOrigin="Anonymous"),o.onload=function(){o.onload=null,t.init(o)},void(o.src=e)}e=t.image=n}e&&!t.rect&&(t.rect=[0,0,e.width,e.height])},Statics:{isDrawable:function(i){if(!i||!i.tagName)return!1;var t=i.tagName.toLowerCase();return"img"===t||"canvas"===t||"video"===t}}});return a}); |