- 需求的场景描述(希望解决的问题)
截屏API适配不同分辨率手机
比如屏幕上有一张纸分辨率为750x1136 游戏分辨率为 750x1334 我想截出这张纸的大小的图片 但是很多机型只截的左上角
canvas.toTempFilePath({ x: 0, y: 0, width:750, height: 1136, destWidth: 750, destHeight: 1136, canvasId: '' , success: ( function (res) { let imgPath = res.tempFilePath; wx.saveImageToPhotosAlbum({ filePath: imgPath, success:(res) => { var imgList = [imgPath]; wx.showModal({ title: '提示' , content: '图片已存入系统相册,点击确定长按图片可直接发送朋友' , success (res) { if (res.confirm) { // console.log('用户点击确定') wx.previewImage( { urls: imgList } ) } else if (res.cancel) { // console.log('用户点击取消') } } }) } }) }), fail: function (res) { }, complete: function (res) { }, }, this ) |
麻烦提供具体机型看看