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.UI_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() { } }