fix:画布高度自适应

This commit is contained in:
黄云飞
2021-11-19 16:25:56 +08:00
parent cc0b936704
commit d848a23688
+2 -2
View File
@@ -285,8 +285,8 @@ export class Draw {
// canvas高度自适应计算 // canvas高度自适应计算
const lastPosition = positionList[positionList.length - 1] const lastPosition = positionList[positionList.length - 1]
const { coordinate: { leftBottom, leftTop } } = lastPosition const { coordinate: { leftBottom, leftTop } } = lastPosition
if (leftBottom[1] > this.canvas.height) { if (leftBottom[1] > this.canvas.height - margins[2]) {
const height = Math.ceil(leftBottom[1] + (leftBottom[1] - leftTop[1])) const height = Math.ceil(leftBottom[1] + (leftBottom[1] - leftTop[1]) + margins[2])
this.canvas.height = height this.canvas.height = height
this.canvas.style.height = `${height}px` this.canvas.style.height = `${height}px`
this.render({ curIndex, isSubmitHistory: false }) this.render({ curIndex, isSubmitHistory: false })