UNPKG

playcanvas

Version:

Open-source WebGL/WebGPU 3D engine for the web

37 lines (36 loc) 1.52 kB
import { ComponentSystem } from "../system.js"; import { LayoutChildComponent } from "./component.js"; class LayoutChildComponentSystem extends ComponentSystem { constructor(app) { super(app); this.id = "layoutchild"; this.ComponentType = LayoutChildComponent; } initializeComponentData(component, data, properties) { if (data.enabled !== void 0) component.enabled = data.enabled; if (data.minWidth !== void 0) component.minWidth = data.minWidth; if (data.minHeight !== void 0) component.minHeight = data.minHeight; if (data.maxWidth !== void 0) component.maxWidth = data.maxWidth; if (data.maxHeight !== void 0) component.maxHeight = data.maxHeight; if (data.fitWidthProportion !== void 0) component.fitWidthProportion = data.fitWidthProportion; if (data.fitHeightProportion !== void 0) component.fitHeightProportion = data.fitHeightProportion; if (data.excludeFromLayout !== void 0) component.excludeFromLayout = data.excludeFromLayout; super.initializeComponentData(component, data, []); } cloneComponent(entity, clone) { const layoutChild = entity.layoutchild; return this.addComponent(clone, { enabled: layoutChild.enabled, minWidth: layoutChild.minWidth, minHeight: layoutChild.minHeight, maxWidth: layoutChild.maxWidth, maxHeight: layoutChild.maxHeight, fitWidthProportion: layoutChild.fitWidthProportion, fitHeightProportion: layoutChild.fitHeightProportion, excludeFromLayout: layoutChild.excludeFromLayout }); } } export { LayoutChildComponentSystem };