feat:set content block default width 100%
This commit is contained in:
@@ -711,7 +711,9 @@ export class Draw {
|
||||
metrics.boundingBoxDescent = 0
|
||||
metrics.boundingBoxAscent = metrics.height
|
||||
} else if (element.type === ElementType.BLOCK) {
|
||||
metrics.width = element.width! * scale
|
||||
metrics.width = element.width
|
||||
? element.width * scale
|
||||
: this.getInnerWidth()
|
||||
metrics.height = element.height! * scale
|
||||
metrics.boundingBoxDescent = metrics.height
|
||||
metrics.boundingBoxAscent = 0
|
||||
|
||||
@@ -44,13 +44,13 @@ export class BaseBlock {
|
||||
}
|
||||
|
||||
public setClientRects(pageNo: number, x: number, y: number) {
|
||||
const scale = this.draw.getOptions().scale
|
||||
const height = this.draw.getHeight()
|
||||
const pageGap = this.draw.getPageGap()
|
||||
const preY = pageNo * (height + pageGap)
|
||||
// 尺寸
|
||||
this.blockItem.style.width = `${this.element.width! * scale}px`
|
||||
this.blockItem.style.height = `${this.element.height! * scale}px`
|
||||
const { metrics } = this.element
|
||||
this.blockItem.style.width = `${metrics.width}px`
|
||||
this.blockItem.style.height = `${metrics.height}px`
|
||||
// 位置
|
||||
this.blockItem.style.left = `${x}px`
|
||||
this.blockItem.style.top = `${preY + y}px`
|
||||
|
||||
@@ -237,16 +237,9 @@ export function formatElementList(elementList: IElement[], options: IFormatEleme
|
||||
if (el.value === '\n') {
|
||||
el.value = ZERO
|
||||
}
|
||||
if (el.type === ElementType.IMAGE) {
|
||||
if (el.type === ElementType.IMAGE || el.type === ElementType.BLOCK) {
|
||||
el.id = getUUID()
|
||||
}
|
||||
if (el.type === ElementType.BLOCK) {
|
||||
el.id = getUUID()
|
||||
if (!el.width) {
|
||||
const { editorOptions: { width, margins } } = options
|
||||
el.width = width - margins[1] - margins[3]
|
||||
}
|
||||
}
|
||||
if (el.type === ElementType.LATEX) {
|
||||
const { svg, width, height } = LaTexParticle.convertLaTextToSVG(el.value)
|
||||
el.width = el.width || width
|
||||
|
||||
Reference in New Issue
Block a user