Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

截图大小自适应& #8

Closed
duckpowermb opened this issue Jun 2, 2017 · 1 comment
Closed

截图大小自适应& #8

duckpowermb opened this issue Jun 2, 2017 · 1 comment

Comments

@duckpowermb
Copy link

根据wx的官方文档 canvasToTempFilePath api是可以自适应的,是否可以考虑在调用api时候使用自适应来达到截图自适应,而且现在确实出现了截图后宽高失真的情况

wx.canvasToTempFilePath(OBJECT)

把当前画布指定区域的内容导出生成指定大小的图片,并返回文件路径。

OBJECT参数说明:

参数 类型 必填 说明 最低版本
x Number 否 画布x轴起点(默认0) 1.2.0
y Number 否 画布y轴起点(默认0) 1.2.0
width Number 否 画布宽度(默认为canvas宽度-x) 1.2.0
height Number 否 画布高度(默认为canvas高度-y) 1.2.0
destWidth Number 否 输出图片宽度(默认为width) 1.2.0
destHeight Number 否 输出图片高度(默认为height) 1.2.0
canvasId String 是 画布标识,传入 的 cavas-id
success Function 否 接口调用成功的回调函数
fail Function 否 接口调用失败的回调函数
complete Function 否 接口调用结束的回调函数(调用成功、失败都会执行)

示例代码
wx.canvasToTempFilePath({
x: 100,
y: 200,
width: 50,
height: 50,
destWidth: 100,
destHeight: 100,
canvasId: 'myCanvas',
success: function(res) {
console.log(res.tempFilePath)
}
})

@dlhandsome
Copy link
Member

真机上会出现宽高失真的情况吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants