KITASENJU DESIGN BLOG

memo, html, javascript, unity

俺俺DOMラッパークラス

export class AbsDOM{

    public dom:HTMLElement;
    
    constructor(
        dom:HTMLElement,
        parentDom:HTMLElement,
        zIndex:number
    ){
        this.dom = dom;
        this.dom.style.position="absolute";
        this.dom.style.zIndex = ""+zIndex;
        parentDom.append(this.dom);
    }

    show(){
        this.dom.style.display="block";
    }

    hide(){
        this.dom.style.display="none";
    }

    //-----setter-----
    set x(value: number) {
        this.dom.style.left = value + "px";
    }
    set y(value: number) {
        this.dom.style.top = value + "px";
    }
    set width(value: number) {
        this.dom.style.width = value + "px";
    }
    set height(value: number) {
        this.dom.style.height = value + "px";
    }
    set color(value: string){
        this.dom.style.color = value;
    }
    set backgroundColor(value: string){
        this.dom.style.backgroundColor = value;
    }
    set text(value:string){
        this.dom.innerText = value;
    }
    set fontSize(value:string){
        this.dom.style.fontSize=value;
    }


}
"FOOTER"