lufy's legend

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 5515|回复: 0
打印 上一主题 下一主题

关于第一次缩放正常,屏幕更改后缩放不正常

[复制链接]

1

主题

0

好友

7

积分

士兵

Rank: 1

跳转到指定楼层
楼主
发表于 2016-3-14 17:55:30 |显示全部楼层 |倒序浏览
想要实现图片的根据屏幕大小实现自适应
发现缩放屏幕 图片的缩放不是正常的, 但是在这个分辨率在刷新下 又是正常的? 是bug么, 还是我缩放的过程有错?
bitmapsp是一个sprite 载入了一张640*960d的图片
舞台监听 LGlobal.stage.addEventListener(LEvent.WINDOW_RESIZE,screenAdjust);

function screenAdjust(e){
                       
                                var rotwidth=Math.round( window.innerWidth);
                                var rotheight=Math.round( window.innerHeight);
                                 LGlobal.resize(rotwidth,rotheight);
                                var scalex
                                var scaley
                                scalex=rotwidth/640;
                               
                                scaley=rotheight/960;
                                var _x=-(rotwidth-640)/2
                        //        number
                                var scale;
                                if(scalex<scaley){
                                scale=scaley;
                                }else{
                                scale=scalex;
                                }
                               
                       
                                if(bitmapsp){
                                        //bitmapsp.x=_x
                                        bitmapsp.scaleX=bitmapsp.scaleY=scale;
                                        console.log(scale)
                                }
                               
                        }

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

防止垃圾广告,请填写任意字符

Archiver|lufy's legend

GMT+8, 2024-5-16 18:16 , Processed in 0.044952 second(s), 20 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部