CanvasContext.fillText的maxWidth参数在iphone中无效?
在安卓系统中可以正常显示,但是iphone中不能。不管能不能,希望能有一致的结果。(安卓测试机华为p30pro,微信8.0.1;苹果测试机iphone11,微信8.0.2) [图片] [图片] const canvas = wx.createCanvas();
wx.getSystemInfo({
success: function (res) {
canvas.width = res.screenWidth * res.pixelRatio;
canvas.height = res.screenHeight * res.pixelRatio;
}
});
var buttonWeight = canvas.width / 5 * 4;
var buttonHeight = canvas.height / 20;
var buttontextheight = buttonHeight / 3 * 2;
var buttonLeft = canvas.width / 2 - buttonWeight / 2;
var buttonTop = 200;//这个值是我随手填的,游戏中是许多个值算出来的,公式太长,所以我随手填了一个。
// draw button text
function DrawButtonText() {
draw.fillStyle = '#000000';
draw.font = buttontextheight + 'px Arial';
draw.fillText('提交解答,若正确则开始新游戏', buttonLeft, buttonTop + buttonHeight / 2 + buttontextheight / 2, buttonWeight);
}