fix:content block boundary error

pr675
Hufe921 3 years ago
parent 37110b675a
commit a763e94f27

@ -711,9 +711,13 @@ export class Draw {
metrics.boundingBoxDescent = 0 metrics.boundingBoxDescent = 0
metrics.boundingBoxAscent = metrics.height metrics.boundingBoxAscent = metrics.height
} else if (element.type === ElementType.BLOCK) { } else if (element.type === ElementType.BLOCK) {
metrics.width = element.width const innerWidth = this.getInnerWidth()
? element.width * scale if (!element.width) {
: this.getInnerWidth() metrics.width = innerWidth
} else {
const elementWidth = element.width * scale
metrics.width = elementWidth > innerWidth ? innerWidth : elementWidth
}
metrics.height = element.height! * scale metrics.height = element.height! * scale
metrics.boundingBoxDescent = metrics.height metrics.boundingBoxDescent = metrics.height
metrics.boundingBoxAscent = 0 metrics.boundingBoxAscent = 0
@ -750,6 +754,7 @@ export class Draw {
if ( if (
preElement?.type === ElementType.TABLE preElement?.type === ElementType.TABLE
|| preElement?.type === ElementType.BLOCK || preElement?.type === ElementType.BLOCK
|| element.type === ElementType.BLOCK
|| preElement?.imgDisplay === ImageDisplay.INLINE || preElement?.imgDisplay === ImageDisplay.INLINE
|| element.imgDisplay === ImageDisplay.INLINE || element.imgDisplay === ImageDisplay.INLINE
|| curRow.width + metrics.width > innerWidth || curRow.width + metrics.width > innerWidth

Loading…
Cancel
Save