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/DoricTextNode.ts

26 lines
722 B
TypeScript
Raw Normal View History

2019-12-20 17:56:01 +08:00
import { DoricViewNode, FrameSize, toPixelString, toRGBAString } from "./DoricViewNode";
export class DoricTextNode extends DoricViewNode {
build(): HTMLElement {
return document.createElement('p')
}
blendProps(v: HTMLParagraphElement, propName: string, prop: any) {
switch (propName) {
case 'text':
v.innerText = prop
break
case 'textSize':
v.style.fontSize = toPixelString(prop)
break
case 'textColor':
v.style.color = toRGBAString(prop)
break
default:
super.blendProps(v, propName, prop)
break
}
}
}