import { setGameScroller } from "../utils";

class Layers extends eui.UILayer {
    private _topLayer: eui.UILayer;
    private _popupLayer: eui.UILayer;
    private _sceneLayer: eui.Group;
    init(root: egret.DisplayObjectContainer) {
        root.addChild(this);
        this._topLayer = new eui.UILayer();
        this._popupLayer = new eui.UILayer();
        this._sceneLayer = new eui.UILayer();

        /* let scaler = document.body.clientWidth / 750;
        if (document.body.clientHeight < 1206 * scaler) {
            let scroller = new eui.Scroller();
            scroller.bounces = false;
            scroller.top = 0;
            scroller.left = 0;
            scroller.right = 0;
            scroller.bottom = 0;
            this.addChild(scroller);
            scroller.viewport = this._sceneLayer;
            scroller.addChild(this._sceneLayer);
            setGameScroller(scroller);
        } else {
            this.addChild(this._sceneLayer);
        } */
        this.addChild(this._sceneLayer);
        this.addChild(this._popupLayer);
        this.addChild(this._topLayer);


        this._popupLayer.visible = false;
        this._topLayer.visible = false;
        // this._sceneLayer.percentHeight = 100;
    }

    get topLayer() { return this._topLayer }
    get popupLayer() { return this._popupLayer }
    get sceneLayer() { return this._sceneLayer }

}

const instance = new Layers();
export default instance