diff --git a/src/editor/core/draw/Draw.ts b/src/editor/core/draw/Draw.ts index 66b1153..bcfbfb7 100644 --- a/src/editor/core/draw/Draw.ts +++ b/src/editor/core/draw/Draw.ts @@ -1329,7 +1329,7 @@ export class Draw { private _drawPage(payload: IDrawPagePayload) { const { elementList, positionList, rowList, pageNo } = payload - const { inactiveAlpha, pageMode } = this.options + const { inactiveAlpha, pageMode, header, footer, pageNumber } = this.options const innerWidth = this.getInnerWidth() const ctx = this.ctxList[pageNo] // 判断当前激活区域-非正文区域时元素透明度降低 @@ -1351,11 +1351,17 @@ export class Draw { zone: EditorZone.MAIN }) // 绘制页眉 - this.header.render(ctx, pageNo) + if (!header.disabled) { + this.header.render(ctx, pageNo) + } // 绘制页码 - this.pageNumber.render(ctx, pageNo) + if (!pageNumber.disabled) { + this.pageNumber.render(ctx, pageNo) + } // 绘制页脚 - this.footer.render(ctx, pageNo) + if (!footer.disabled) { + this.footer.render(ctx, pageNo) + } // 搜索匹配绘制 if (this.search.getSearchKeyword()) { this.search.render(ctx, pageNo) @@ -1402,7 +1408,7 @@ export class Draw { } public render(payload?: IDrawOption) { - const { pageMode } = this.options + const { pageMode, header, footer } = this.options const { isSubmitHistory = true, isSetCursor = true, @@ -1414,9 +1420,13 @@ export class Draw { // 计算文档信息 if (isCompute) { // 页眉信息 - this.header.compute() + if (!header.disabled) { + this.header.compute() + } // 页脚信息 - this.footer.compute() + if (!footer.disabled) { + this.footer.compute() + } // 行信息 this.rowList = this.computeRowList(innerWidth, this.elementList) // 页面信息 diff --git a/src/editor/core/draw/frame/Footer.ts b/src/editor/core/draw/frame/Footer.ts index c371d5b..7812d15 100644 --- a/src/editor/core/draw/frame/Footer.ts +++ b/src/editor/core/draw/frame/Footer.ts @@ -81,7 +81,8 @@ export class Footer { } public getFooterBottom(): number { - const { footer: { bottom }, scale } = this.options + const { footer: { bottom, disabled }, scale } = this.options + if (disabled) return 0 return Math.floor(bottom * scale) } diff --git a/src/editor/core/draw/frame/Header.ts b/src/editor/core/draw/frame/Header.ts index 0f4ffc8..99f5d8b 100644 --- a/src/editor/core/draw/frame/Header.ts +++ b/src/editor/core/draw/frame/Header.ts @@ -78,7 +78,8 @@ export class Header { } public getHeaderTop(): number { - const { header: { top }, scale } = this.options + const { header: { top, disabled }, scale } = this.options + if (disabled) return 0 return Math.floor(top * scale) } diff --git a/src/editor/dataset/constant/Footer.ts b/src/editor/dataset/constant/Footer.ts index 29f57d0..8b003a3 100644 --- a/src/editor/dataset/constant/Footer.ts +++ b/src/editor/dataset/constant/Footer.ts @@ -3,5 +3,6 @@ import { MaxHeightRatio } from '../enum/Common' export const defaultFooterOption: Readonly> = { bottom: 30, - maxHeightRadio: MaxHeightRatio.HALF + maxHeightRadio: MaxHeightRatio.HALF, + disabled: false } \ No newline at end of file diff --git a/src/editor/dataset/constant/Header.ts b/src/editor/dataset/constant/Header.ts index 808d9b0..9c974c7 100644 --- a/src/editor/dataset/constant/Header.ts +++ b/src/editor/dataset/constant/Header.ts @@ -3,5 +3,6 @@ import { MaxHeightRatio } from '../enum/Common' export const defaultHeaderOption: Readonly> = { top: 30, - maxHeightRadio: MaxHeightRatio.HALF + maxHeightRadio: MaxHeightRatio.HALF, + disabled: false } \ No newline at end of file diff --git a/src/editor/dataset/constant/PageNumber.ts b/src/editor/dataset/constant/PageNumber.ts index cd44168..29ff43e 100644 --- a/src/editor/dataset/constant/PageNumber.ts +++ b/src/editor/dataset/constant/PageNumber.ts @@ -14,5 +14,6 @@ export const defaultPageNumberOption: Readonly> = { color: '#000000', rowFlex: RowFlex.CENTER, format: FORMAT_PLACEHOLDER.PAGE_NO, - numberType: NumberType.ARABIC + numberType: NumberType.ARABIC, + disabled: false } \ No newline at end of file diff --git a/src/editor/interface/Footer.ts b/src/editor/interface/Footer.ts index 5dc896f..4dfec7a 100644 --- a/src/editor/interface/Footer.ts +++ b/src/editor/interface/Footer.ts @@ -3,4 +3,5 @@ import { MaxHeightRatio } from '../dataset/enum/Common' export interface IFooter { bottom?: number; maxHeightRadio?: MaxHeightRatio; + disabled?: boolean; } \ No newline at end of file diff --git a/src/editor/interface/Header.ts b/src/editor/interface/Header.ts index 5f9923e..5cbeb92 100644 --- a/src/editor/interface/Header.ts +++ b/src/editor/interface/Header.ts @@ -3,4 +3,5 @@ import { MaxHeightRatio } from '../dataset/enum/Common' export interface IHeader { top?: number; maxHeightRadio?: MaxHeightRatio; + disabled?: boolean; } \ No newline at end of file diff --git a/src/editor/interface/PageNumber.ts b/src/editor/interface/PageNumber.ts index 4b41776..17955ae 100644 --- a/src/editor/interface/PageNumber.ts +++ b/src/editor/interface/PageNumber.ts @@ -9,4 +9,5 @@ export interface IPageNumber { rowFlex?: RowFlex; format?: string; numberType?: NumberType; + disabled?: boolean; } \ No newline at end of file