fix: header and footer floating image error #473
This commit is contained in:
@@ -1903,7 +1903,9 @@ export class Draw {
|
|||||||
const floatPosition = floatPositionList[e]
|
const floatPosition = floatPositionList[e]
|
||||||
const element = floatPosition.element
|
const element = floatPosition.element
|
||||||
if (
|
if (
|
||||||
pageNo === floatPosition.pageNo &&
|
(pageNo === floatPosition.pageNo ||
|
||||||
|
floatPosition.zone === EditorZone.HEADER ||
|
||||||
|
floatPosition.zone == EditorZone.FOOTER) &&
|
||||||
element.imgDisplay === imgDisplay &&
|
element.imgDisplay === imgDisplay &&
|
||||||
element.type === ElementType.IMAGE
|
element.type === ElementType.IMAGE
|
||||||
) {
|
) {
|
||||||
@@ -2044,6 +2046,8 @@ export class Draw {
|
|||||||
const isPagingMode = this.getIsPagingMode()
|
const isPagingMode = this.getIsPagingMode()
|
||||||
// 计算文档信息
|
// 计算文档信息
|
||||||
if (isCompute) {
|
if (isCompute) {
|
||||||
|
// 清空浮动元素位置信息
|
||||||
|
this.position.setFloatPositionList([])
|
||||||
if (isPagingMode) {
|
if (isPagingMode) {
|
||||||
// 页眉信息
|
// 页眉信息
|
||||||
if (!header.disabled) {
|
if (!header.disabled) {
|
||||||
|
|||||||
@@ -75,7 +75,8 @@ export class Footer {
|
|||||||
startIndex: 0,
|
startIndex: 0,
|
||||||
startX,
|
startX,
|
||||||
startY,
|
startY,
|
||||||
innerWidth
|
innerWidth,
|
||||||
|
zone: EditorZone.FOOTER
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,8 @@ export class Header {
|
|||||||
startIndex: 0,
|
startIndex: 0,
|
||||||
startX,
|
startX,
|
||||||
startY,
|
startY,
|
||||||
innerWidth
|
innerWidth,
|
||||||
|
zone: EditorZone.HEADER
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -96,6 +96,10 @@ export class Position {
|
|||||||
this.positionList = payload
|
this.positionList = payload
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public setFloatPositionList(payload: IFloatPosition[]) {
|
||||||
|
this.floatPositionList = payload
|
||||||
|
}
|
||||||
|
|
||||||
public computePageRowPosition(
|
public computePageRowPosition(
|
||||||
payload: IComputePageRowPositionPayload
|
payload: IComputePageRowPositionPayload
|
||||||
): IComputePageRowPositionResult {
|
): IComputePageRowPositionResult {
|
||||||
@@ -107,7 +111,8 @@ export class Position {
|
|||||||
startY,
|
startY,
|
||||||
startRowIndex,
|
startRowIndex,
|
||||||
startIndex,
|
startIndex,
|
||||||
innerWidth
|
innerWidth,
|
||||||
|
zone
|
||||||
} = payload
|
} = payload
|
||||||
const { scale, tdPadding } = this.options
|
const { scale, tdPadding } = this.options
|
||||||
let x = startX
|
let x = startX
|
||||||
@@ -177,7 +182,8 @@ export class Position {
|
|||||||
index: payload.index,
|
index: payload.index,
|
||||||
tdIndex: payload.tdIndex,
|
tdIndex: payload.tdIndex,
|
||||||
trIndex: payload.trIndex,
|
trIndex: payload.trIndex,
|
||||||
tdValueIndex: index
|
tdValueIndex: index,
|
||||||
|
zone
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
positionList.push(positionItem)
|
positionList.push(positionItem)
|
||||||
@@ -205,7 +211,8 @@ export class Position {
|
|||||||
isTable: true,
|
isTable: true,
|
||||||
index: index - 1,
|
index: index - 1,
|
||||||
tdIndex: d,
|
tdIndex: d,
|
||||||
trIndex: t
|
trIndex: t,
|
||||||
|
zone
|
||||||
})
|
})
|
||||||
// 垂直对齐方式
|
// 垂直对齐方式
|
||||||
if (
|
if (
|
||||||
@@ -252,7 +259,6 @@ export class Position {
|
|||||||
public computePositionList() {
|
public computePositionList() {
|
||||||
// 置空原位置信息
|
// 置空原位置信息
|
||||||
this.positionList = []
|
this.positionList = []
|
||||||
this.floatPositionList = []
|
|
||||||
// 按每页行计算
|
// 按每页行计算
|
||||||
const innerWidth = this.draw.getInnerWidth()
|
const innerWidth = this.draw.getInnerWidth()
|
||||||
const pageRowList = this.draw.getPageRowList()
|
const pageRowList = this.draw.getPageRowList()
|
||||||
@@ -550,6 +556,7 @@ export class Position {
|
|||||||
payload: IGetFloatPositionByXYPayload
|
payload: IGetFloatPositionByXYPayload
|
||||||
): ICurrentPosition | void {
|
): ICurrentPosition | void {
|
||||||
const { x, y } = payload
|
const { x, y } = payload
|
||||||
|
const currentZone = this.draw.getZone().getZone()
|
||||||
for (let f = 0; f < this.floatPositionList.length; f++) {
|
for (let f = 0; f < this.floatPositionList.length; f++) {
|
||||||
const {
|
const {
|
||||||
position,
|
position,
|
||||||
@@ -558,11 +565,13 @@ export class Position {
|
|||||||
index,
|
index,
|
||||||
trIndex,
|
trIndex,
|
||||||
tdIndex,
|
tdIndex,
|
||||||
tdValueIndex
|
tdValueIndex,
|
||||||
|
zone: floatElementZone
|
||||||
} = this.floatPositionList[f]
|
} = this.floatPositionList[f]
|
||||||
if (
|
if (
|
||||||
element.type === ElementType.IMAGE &&
|
element.type === ElementType.IMAGE &&
|
||||||
element.imgDisplay === payload.imgDisplay
|
element.imgDisplay === payload.imgDisplay &&
|
||||||
|
(!floatElementZone || floatElementZone === currentZone)
|
||||||
) {
|
) {
|
||||||
const imgFloatPosition = element.imgFloatPosition!
|
const imgFloatPosition = element.imgFloatPosition!
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ export interface IComputePageRowPositionPayload {
|
|||||||
tdIndex?: number
|
tdIndex?: number
|
||||||
trIndex?: number
|
trIndex?: number
|
||||||
tdValueIndex?: number
|
tdValueIndex?: number
|
||||||
|
zone?: EditorZone
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IComputePageRowPositionResult {
|
export interface IComputePageRowPositionResult {
|
||||||
@@ -86,4 +87,5 @@ export interface IFloatPosition {
|
|||||||
tdIndex?: number
|
tdIndex?: number
|
||||||
trIndex?: number
|
trIndex?: number
|
||||||
tdValueIndex?: number
|
tdValueIndex?: number
|
||||||
|
zone?: EditorZone
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user