canvas 动态设置宽高问题 (apicloud)

 1 apiready = function() {
 2     var winWidth = api.winWidth;
 3     var winHeight = api.winHeight;
 4     console.log(winHeight);
 5     var canvasList = document.getElementById('leftjoystick');
 6     var canvas = document.createElement('canvas');
 7     $api.css(canvasList,'margin-top:' + 2*winHeight/5 +'px;margin-left:'+winWidth/15 +'px;')
 8     // canvasList.marginLeft = winWidth / 10;
 9     // canvasList.marginTop = winHeight / 5;
10     canvasList.appendChild(canvas);
11     // if(api.systemType == 'ios')
12     canvas.width = winHeight / 1.8; //
13     canvas.height = winHeight / 1.8;
14     //...
15    //最后再执行画图操作  
16 }

 

posted @ 2019-02-28 18:55  雁字回头月满西楼  阅读(943)  评论(0编辑  收藏  举报