import Config from "../../../Config"; import { ViewZOrder } from "../../../data/const/ViewZOrder"; const { ccclass, property } = cc._decorator; @ccclass export default class UISafeAreaNode extends cc.Component { protected onEnable() { cc.game.addPersistRootNode(this.node) this.node.zIndex = ViewZOrder.MASK this.node.getComponent(cc.Widget).top = Config.safeAreaRect.y this.node.getComponent(cc.Widget).bottom = Config.safeAreaRect.y / 2 this.node.getComponent(cc.Widget).updateAlignment() } protected onDisable() { } }