fix:画布高度自适应

pr675
黄云飞 4 years ago
parent cc0b936704
commit d848a23688

@ -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 })

Loading…
Cancel
Save