UNPKG

laya-coreui-es

Version:

laya核心库、ui库es版本,剔除了媒体、TTF等功能。基于 LayaAir-release_2.12.0 修改

40 lines (39 loc) 1.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Box = void 0; const UIComponent_1 = require("./UIComponent"); const Event_1 = require("../events/Event"); class Box extends UIComponent_1.UIComponent { set dataSource(value) { this._dataSource = value; for (var name in value) { var comp = this.getChildByName(name); if (comp) comp.dataSource = value[name]; else if (name in this && !(this[name] instanceof Function)) this[name] = value[name]; } } get dataSource() { return super.dataSource; } get bgColor() { return this._bgColor; } set bgColor(value) { this._bgColor = value; if (value) { this._onResize(null); this.on(Event_1.Event.RESIZE, this, this._onResize); } else { this.graphics.clear(); this.off(Event_1.Event.RESIZE, this, this._onResize); } } _onResize(e) { this.graphics.clear(); this.graphics.drawRect(0, 0, this.width, this.height, this._bgColor); } } exports.Box = Box;