提交 99d1979e 编写于 作者: Q qiang

fix: 修复 uni.canvasToTempFilePath 配置的大小超过 canvas 大小时获取的图像空白的问题 question/111225

上级 e7320b24
...@@ -365,12 +365,10 @@ export default { ...@@ -365,12 +365,10 @@ export default {
}) { }) {
const canvas = this.$refs.canvas const canvas = this.$refs.canvas
let data let data
if (!width) { const maxWidth = canvas.offsetWidth - x
width = canvas.offsetWidth - x width = width ? Math.min(width, maxWidth) : maxWidth
} const maxHeight = canvas.offsetHeight - y
if (!height) { height = height ? Math.min(height, maxWidth) : maxHeight
height = canvas.offsetHeight - y
}
if (!hidpi) { if (!hidpi) {
if (!destWidth && !destHeight) { if (!destWidth && !destHeight) {
destWidth = Math.round(width * pixelRatio) destWidth = Math.round(width * pixelRatio)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册