This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/src/shader/DoricImageNode.ts

27 lines
815 B
TypeScript
Raw Normal View History

2019-12-21 16:37:55 +08:00
import { DoricViewNode, LEFT, RIGHT, CENTER_X, CENTER_Y, TOP, BOTTOM, toPixelString, toRGBAString } from "./DoricViewNode";
export class DoricImageNode extends DoricViewNode {
build(): HTMLElement {
return document.createElement('img')
}
blendProps(v: HTMLParagraphElement, propName: string, prop: any) {
switch (propName) {
case 'imageUrl':
v.setAttribute('src', prop)
break
case 'imageBase64':
v.setAttribute('src', prop)
break
case 'loadCallback':
v.onload = () => {
this.callJSResponse(prop)
}
break
default:
super.blendProps(v, propName, prop)
break
}
}
}