收藏
回答

小游戏开发者工具与手机预览横屏时宽高不一样

操作系统 工具版本
Windows v1.02.1712280

小游戏设置为横屏的时候,

ctx.drawImage(

this.img,

0,

0,

this.width,

this.height,

0,

0,


window.innerWidth, //  innerWidth写在这里的时候,手机预览时画布尺寸有问题,开发者工具没问题

window.innerHeight,

window.innerWidth, // innerWidth写在这里的时候,手机预览时画布尺寸没问题,开发者工具有问题

)



最后一次编辑于  2018-01-03
回答关注问题邀请回答
收藏

5 个回答

  • 工号 9527
    工号 9527
    2018-01-05

    你好,这是一个已知问题,我们会尽快进行修复。

    2018-01-05
    有用
    回复
  • 工号 9527
    工号 9527
    2018-01-03

    没理解。

    2018-01-03
    有用
    回复
  • 日进斗金
    日进斗金
    2018-06-02

    该Bug还没有修复,期待中

    2018-06-02
    有用
    回复
  • Roger.Y
    Roger.Y
    2018-02-12

    该Bug还没有修复,期待中

    2018-02-12
    有用
    回复
  • kenyee
    kenyee
    2018-01-03

    就是

    1.手机设为横屏显示的时候:

    {
     
        "deviceOrientation": "landscape"
     
    }


    2.通过window.innerWidth获取screenWidth,  window.innerHeight获取 screenHeight


    3.然后画出一个图片

    ctx.drawImage(
     
    this.img,
     
    0,
     
    0,
     
    this.width,
     
    this.height,
     
    0,
     
    0,
     
    screenWidth,
     
    screenHeight
     
    )

    这种情况下, 在开发者工具中预览是没有问题的,但是在手机上预览,就会出现问题(画布被拉伸?)

    如果这是将ctx.drawImage方法中的screenWidth和screenHeight的顺序调转,那手机上显示就没问题了,但是在开发者工具上预览就有问题





    2018-01-03
    有用
    回复
登录 后发表内容