[LayaAir 2.0]新手引导在ios浏览器表现异常

代码:
module laya  {
    export class Sprite_Guide 
    {
        private width = 750;
        private height = 1334;
        constructor() 
        {
            Laya3D.init(this.width, this.height);
            Laya.stage.setScreenSize(this.width, this.height);
            Laya.stage.scaleMode = Laya.Stage.SCALE_FIXED_AUTO;
            Laya.stage.screenMode = Laya.Stage.SCREEN_NONE;
            Laya.stage.on(Laya.Event.RESIZE, this, this.windowResized);
        }
        windowResized(){
            let sp = new Laya.Sprite();
            sp.graphics.drawRect(0,0,Laya.stage.width,Laya.stage.height,"#FFFFFF");
            Laya.stage.addChild(sp); 
            let guideView = new MazeGuideView();
            guideView.zOrder = MazeConst.gameZOrder;
            guideView.pos(0,0);
            Laya.stage.addChild(guideView);
            guideView.setClickArea(Laya.stage.width/2, Laya.stage.height/2,100);
        }
    }
    export class MazeGuideView extends Laya.Sprite {
        protected guideContainer: Laya.Sprite;
        protected guideHitArea: Laya.HitArea;
        protected tipContainer: Laya.Image;
        constructor() {
            super();
            this.init();
        }
        private init() {
            this.size(Laya.stage.width,Laya.stage.height);
            this.guideContainer = new Laya.Sprite();
            this.guideContainer.cacheAs = "bitmap";
            this.addChild(this.guideContainer);
            let maskArea = new Laya.Sprite();
            maskArea.alpha = 0.5;
            maskArea.graphics.drawRect(0, 0, Laya.stage.width, Laya.stage.height, "#000000");
            this.guideContainer.addChild(maskArea);
            this.on(Laya.Event.CLICK, this, ()=>{
    
            });
        }
    
        showTips(posX: number, posY: number, width:number,height:number,skinRes: string) {
            this.tipContainer = new Laya.Image();
            this.tipContainer.size(width, height);
            this.tipContainer.skin = skinRes;
            this.tipContainer.pos(posX, posY);
            this.addChild(this.tipContainer);
        }
    
        setClickArea(posX: number, posY: number, radius: number, button? : Laya.Sprite) {
            //绘制一个圆形区域,利用叠加模式,从遮罩区域抠出可交互区
            let interactionArea = new Laya.Sprite();
            interactionArea.blendMode = "destination-out";
            this.guideContainer.addChild(interactionArea);
            this.guideHitArea = new Laya.HitArea();
            this.guideHitArea.hit.drawRect(0, 0, Laya.stage.width, Laya.stage.height, "#000000");
            this.guideContainer.hitArea = this.guideHitArea;
            this.guideHitArea.unHit.drawCircle(posX, posY, radius, "#000000");
            interactionArea.graphics.drawCircle(posX, posY, radius, "#000000");
            let maskButton = new Laya.Button();
            maskButton.pos(posX, posY);
            maskButton.size(radius * 2, radius * 2);
            maskButton.anchorX = 0.5;
            maskButton.anchorY = 0.5;
            maskButton.stateNum = 1;
            this.guideContainer.addChild(maskButton);
            maskButton.clickHandler = new Laya.Handler(this, () => {
                if (button) {
                    if (button instanceof Laya.Button) {
                        if (button.clickHandler) {
                            button.clickHandler.run();
                        }
                    } else {
                        button.event(Laya.Event.CLICK);
                    }
                }
                this.destroy();
            })
        }
        destroy() {
            super.destroy(true);
        }
    }
}
new laya.Sprite_Guide();
图片.jpg
已邀请:

执迷不悟

赞同来自:

 Laya.stage.scaleMode = Laya.Stage.SCALE_FIXED_AUTO;出现这个问题
 Laya.stage.scaleMode = Laya.Stage.SCALE_FIXED_WIDTH;有没有这个问题
真是奇怪奇怪

Aar0n

赞同来自:

这个就用那个没有问题的适配模式吧。

执迷不悟

赞同来自:

这个问题是因为新手引导超过了2048,如果超过2048就用scale动态算一下大小就好了

要回复问题请先

商务合作
商务合作