@a200888213/gbdocx 0.6.1 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +215 -215
- package/index.html +31 -30
- package/package.json +49 -48
- package/serve.mjs +27 -23
- package/src/app/file-io.js +122 -122
- package/src/app/main.js +9 -9
- package/src/app/word/catalog.js +52 -52
- package/src/app/word/comments.js +112 -112
- package/src/app/word/doc.js +113 -113
- package/src/app/word/edit.js +72 -72
- package/src/app/word/file.js +191 -191
- package/src/app/word/hf.js +76 -76
- package/src/app/word/layout.js +155 -155
- package/src/app/word/menus.js +201 -201
- package/src/app/word/notes.js +110 -110
- package/src/app/word/shared.js +22 -22
- package/src/app/word/view.js +159 -159
- package/src/app/word-app.js +487 -487
- package/src/app/word-sheets.js +101 -101
- package/src/kernel/docx/catalog.js +41 -41
- package/src/kernel/docx/codec/blocks.js +123 -123
- package/src/kernel/docx/codec/carry.js +129 -129
- package/src/kernel/docx/codec/comments.js +25 -25
- package/src/kernel/docx/codec/docx.js +198 -198
- package/src/kernel/docx/codec/docxStyles.js +177 -177
- package/src/kernel/docx/codec/fonts.js +195 -195
- package/src/kernel/docx/codec/helpers.js +161 -161
- package/src/kernel/docx/codec/hfHtml.js +152 -152
- package/src/kernel/docx/codec/html.js +739 -739
- package/src/kernel/docx/codec/losses.js +420 -420
- package/src/kernel/docx/codec/markdown.js +170 -170
- package/src/kernel/docx/codec/parts.js +249 -249
- package/src/kernel/docx/codec/read.js +603 -603
- package/src/kernel/docx/codec/render.js +1156 -1156
- package/src/kernel/docx/codec/roundtrip.js +236 -236
- package/src/kernel/docx/codec/write.js +833 -833
- package/src/kernel/docx/comments.js +14 -14
- package/src/kernel/docx/menus.js +348 -348
- package/src/kernel/docx/pageGeometry.js +123 -123
- package/src/kernel/docx/pagination.js +481 -481
- package/src/kernel/docx/watermark.js +45 -45
- package/src/kernel/docx/wordShortcuts.js +37 -37
- package/src/kernel/editor/constants.js +8 -8
- package/src/kernel/editor/engine/blocks.js +594 -594
- package/src/kernel/editor/engine/blocksEnter.js +109 -109
- package/src/kernel/editor/engine/blocksInsert.js +254 -254
- package/src/kernel/editor/engine/blocksStructure.js +226 -226
- package/src/kernel/editor/engine/commands.js +181 -181
- package/src/kernel/editor/engine/dom.js +646 -646
- package/src/kernel/editor/engine/editor.js +213 -213
- package/src/kernel/editor/engine/history.js +149 -149
- package/src/kernel/editor/engine/inline.js +656 -656
- package/src/kernel/editor/engine/input.js +554 -554
- package/src/kernel/editor/engine/interaction.js +137 -137
- package/src/kernel/editor/engine/pointer.js +39 -39
- package/src/kernel/editor/engine/revision.js +138 -138
- package/src/kernel/editor/engine/schema.js +417 -417
- package/src/kernel/editor/engine/search.js +113 -113
- package/src/kernel/editor/engine/selection.js +119 -119
- package/src/kernel/editor/engine/state.js +118 -118
- package/src/kernel/editor/engine/tableClip.js +154 -154
- package/src/kernel/editor/engine/tableGrid.js +55 -55
- package/src/kernel/editor/engine/tableInteraction.js +388 -388
- package/src/kernel/editor/engine/tableMenu.js +250 -250
- package/src/kernel/editor/engine/tableOps.js +174 -174
- package/src/kernel/editor/engine/tables.js +732 -732
- package/src/kernel/editor/overlayGeometry.js +20 -20
- package/src/kernel/editor/pasteClean.js +293 -293
- package/src/kernel/editor/utils.js +48 -48
- package/src/kernel/keyboard.js +114 -114
- package/src/kernel/notify.js +54 -54
- package/src/kernel/textStyles.js +84 -84
- package/src/kernel/util/clipboard.js +89 -89
- package/src/kernel/util/imageFile.js +91 -91
- package/src/kernel/util/safeValue.js +25 -25
- package/src/kernel/util/shortcutKey.js +33 -33
- package/src/surface/editor-surface.js +603 -600
- package/src/ui/color-panel.js +69 -69
- package/src/ui/context-menu.js +135 -133
- package/src/ui/dialogs.js +249 -249
- package/src/ui/find-bar.js +151 -151
- package/src/ui/icons.js +245 -137
- package/src/ui/menubar.js +28 -28
- package/src/ui/panels.js +115 -115
- package/src/ui/popup.js +79 -79
- package/src/ui/prompt.js +89 -89
- package/src/ui/ribbon.js +485 -485
- package/src/ui/special-chars.js +39 -39
- package/src/ui/statusbar.js +81 -81
- package/src/ui/toolbar.js +32 -32
- package/styles/app.css +970 -970
- package/styles/editor-content.css +440 -440
- package/styles/tokens.css +154 -154
- package/styles/word-panel.css +410 -410
package/src/app/word/layout.js
CHANGED
|
@@ -1,155 +1,155 @@
|
|
|
1
|
-
// [文件] gbdocx·word·layout —— 页面几何与分页 —— 缩放、纸张层、页眉页脚带测量、滚动读数
|
|
2
|
-
|
|
3
|
-
// [设计] 方法以独立函数导出,由 word-app.js 末尾 Object.assign 装配到 WordApp.prototype:
|
|
4
|
-
// 仍是同一个 this(方法调用时绑定),调用方形状与拆分前完全一致。
|
|
5
|
-
|
|
6
|
-
import { pageGeometry, layoutOf, GUTTER, SHEET_TOP_GAP, fromSheetTop, pageNumberStyle, bandStyle, sheetStyle } from '../../kernel/docx/pageGeometry.js';
|
|
7
|
-
import { repaginate } from '../../kernel/docx/pagination.js';
|
|
8
|
-
import { savePrefs } from './shared.js';
|
|
9
|
-
function geo() { return pageGeometry(this.state.page); }
|
|
10
|
-
|
|
11
|
-
function layout() { return layoutOf(this.geo()); }
|
|
12
|
-
|
|
13
|
-
function sheetsCtx() {
|
|
14
|
-
return {
|
|
15
|
-
geo: () => this.geo(),
|
|
16
|
-
layout: () => this.layout(),
|
|
17
|
-
pageCount: () => this.pageCount,
|
|
18
|
-
pageNumbers: () => this.state.pageNumbers,
|
|
19
|
-
watermark: () => this.state.watermark,
|
|
20
|
-
endnotes: () => this.state.endnotes,
|
|
21
|
-
fnHeights: () => this.fnHeights,
|
|
22
|
-
bandEdit: () => this.bandEditSlot,
|
|
23
|
-
pageNumberText: (p) => this.pageNumberText(p),
|
|
24
|
-
fnPageOf: (p) => this.footnotePages.get(p) || [],
|
|
25
|
-
sheetStyleOf: (p) => sheetStyle(p, this.layout()),
|
|
26
|
-
hfBandStyle: (p, which) => bandStyle(p, which, this.geo(), this.layout(), { head: 0, foot: 0 }),
|
|
27
|
-
pageNumStyle: (p) => pageNumberStyle(p, this.geo(), this.layout(), this.state.pageNumbers.align),
|
|
28
|
-
fnBandStyle: (p) => {
|
|
29
|
-
const L = this.layout();
|
|
30
|
-
const h = this.fnHeights[p - 1] || 0;
|
|
31
|
-
return { top: fromSheetTop(p, L.padTop + L.availOf() - h, L), left: `${L.padLeft}px`, right: `${L.padRight}px` };
|
|
32
|
-
},
|
|
33
|
-
enBandStyle: () => {
|
|
34
|
-
const L = this.layout();
|
|
35
|
-
const p = this.pageCount;
|
|
36
|
-
const h = this.fnHeights[p - 1] || 0;
|
|
37
|
-
return { top: fromSheetTop(p, L.padTop + L.availOf() - h, L), left: `${L.padLeft}px`, right: `${L.padRight}px`, transform: 'translateY(-100%)' };
|
|
38
|
-
},
|
|
39
|
-
bandSlot: (which, p) => this.bandSlot(which, p),
|
|
40
|
-
hfDisplayHtml: (which, p) => this.hfDisplayHtml(which, p),
|
|
41
|
-
showHf: (p, which) => this.showHf(p, which),
|
|
42
|
-
showPageNumber: (p) => this.showPageNumber(p),
|
|
43
|
-
footerHasPageField: (p) => /data-fld="PAGE"/i.test(this.hfTextAt('footer', p)),
|
|
44
|
-
onBandDblClick: (slot, el) => this.startEditBand(slot, el),
|
|
45
|
-
onBandCommit: () => this.commitBand(),
|
|
46
|
-
onFootnoteDblClick: (fn) => this.editFootnote(fn),
|
|
47
|
-
onEndnoteDblClick: (en) => this.editEndnote(en),
|
|
48
|
-
zoom: () => this.zoom,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function applyEditorGeometry() {
|
|
53
|
-
const geo = this.geo();
|
|
54
|
-
const layout = this.layout();
|
|
55
|
-
this.editorWrap.style.zoom = String(this.zoom / 100);
|
|
56
|
-
this.editorWrap.style.setProperty('--gbd-wd-sheet-top', `${SHEET_TOP_GAP}px`);
|
|
57
|
-
const style = {
|
|
58
|
-
'--gbd-re-content-w': `${geo.w}mm`,
|
|
59
|
-
'--gbd-re-content-m': '0 auto',
|
|
60
|
-
'--gbd-re-content-pad': `${layout.padTop}px ${layout.padRight}px ${layout.padBottom}px ${layout.padLeft}px`,
|
|
61
|
-
'--gbd-re-content-min-h': `${this.pageCount * layout.pageH + Math.max(0, this.pageCount - 1) * GUTTER}px`,
|
|
62
|
-
};
|
|
63
|
-
for (const [k, v] of Object.entries(style)) this.editorWrap.style.setProperty(k, v);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function applyZoom() {
|
|
67
|
-
this.statusBar.setZoom(this.zoom);
|
|
68
|
-
this.applyEditorGeometry();
|
|
69
|
-
this.schedulePaginate();
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function setZoom(z) {
|
|
73
|
-
this.zoom = Math.max(40, Math.min(300, Math.round(z)));
|
|
74
|
-
this.prefs.zoom = this.zoom;
|
|
75
|
-
savePrefs(this.prefs);
|
|
76
|
-
this.applyZoom();
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function paginate() {
|
|
80
|
-
const ed = this.editor;
|
|
81
|
-
const root = ed?.root;
|
|
82
|
-
if (!root || ed.composing) return;
|
|
83
|
-
const L = this.layout();
|
|
84
|
-
const opts = {
|
|
85
|
-
cellsPerPage: L.cols,
|
|
86
|
-
gapOf: L.padTop + L.padBottom,
|
|
87
|
-
gutter: GUTTER,
|
|
88
|
-
padTop: L.padTop,
|
|
89
|
-
colW: L.colW,
|
|
90
|
-
colGap: L.colGap,
|
|
91
|
-
colSeparator: this.geo().colSeparator,
|
|
92
|
-
padLeft: L.padLeft,
|
|
93
|
-
padRight: L.padRight,
|
|
94
|
-
scale: this.zoom / 100,
|
|
95
|
-
};
|
|
96
|
-
ed.quietly(() => {
|
|
97
|
-
this.pageCount = repaginate(root, { ...opts, cellH: L.availOf() });
|
|
98
|
-
});
|
|
99
|
-
this.refreshFootnotePages();
|
|
100
|
-
this.renderBackdrop();
|
|
101
|
-
if (this.state.footnotes.length === 0) {
|
|
102
|
-
this.fnHeights = [];
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
requestAnimationFrame(() => {
|
|
106
|
-
const hs = this.measureFnBands();
|
|
107
|
-
this.fnHeights = hs;
|
|
108
|
-
if (!hs.some((h) => h > 0)) {
|
|
109
|
-
this.renderBackdrop();
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
ed.quietly(() => {
|
|
113
|
-
this.pageCount = repaginate(root, { ...opts, cellH: (p) => Math.max(60, L.availOf() - (hs[p - 1] || 0)) });
|
|
114
|
-
});
|
|
115
|
-
this.refreshFootnotePages();
|
|
116
|
-
this.renderBackdrop();
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function schedulePaginate() {
|
|
121
|
-
clearTimeout(this.pageTimer);
|
|
122
|
-
cancelAnimationFrame(this.pageRaf);
|
|
123
|
-
this.pageTimer = setTimeout(() => {
|
|
124
|
-
this.pageRaf = requestAnimationFrame(() => this.paginate());
|
|
125
|
-
}, 120);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function renderBackdrop() {
|
|
129
|
-
this.surface.refreshBackdrop();
|
|
130
|
-
this.applyEditorGeometry();
|
|
131
|
-
this.refreshScroll();
|
|
132
|
-
this.statusBar.setPage(this.visiblePage, this.pageCount);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function measureFnBands() {
|
|
136
|
-
const scale = this.zoom / 100 || 1;
|
|
137
|
-
const out = [];
|
|
138
|
-
for (const el of this.root.querySelectorAll('.word-sheet-fn[data-page]')) {
|
|
139
|
-
const p = Number(el.dataset.page);
|
|
140
|
-
if (p > 0) out[p - 1] = el.getBoundingClientRect().height / scale;
|
|
141
|
-
}
|
|
142
|
-
return out;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
function refreshScroll() {
|
|
146
|
-
const pageH = this.layout().pageH;
|
|
147
|
-
if (!pageH) return;
|
|
148
|
-
const step = pageH + GUTTER;
|
|
149
|
-
// 第一页不从滚动原点起:扣掉纸层顶部留白再折算页序,否则页数会提前一页翻
|
|
150
|
-
const offset = this.surface.scrollEl.scrollTop - SHEET_TOP_GAP;
|
|
151
|
-
this.visiblePage = Math.max(1, Math.min(this.pageCount, Math.floor(Math.max(0, offset) / step) + 1));
|
|
152
|
-
this.statusBar.setPage(this.visiblePage, this.pageCount);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
export const layoutMethods = { geo, layout, sheetsCtx, applyEditorGeometry, applyZoom, setZoom, paginate, schedulePaginate, renderBackdrop, measureFnBands, refreshScroll };
|
|
1
|
+
// [文件] gbdocx·word·layout —— 页面几何与分页 —— 缩放、纸张层、页眉页脚带测量、滚动读数
|
|
2
|
+
|
|
3
|
+
// [设计] 方法以独立函数导出,由 word-app.js 末尾 Object.assign 装配到 WordApp.prototype:
|
|
4
|
+
// 仍是同一个 this(方法调用时绑定),调用方形状与拆分前完全一致。
|
|
5
|
+
|
|
6
|
+
import { pageGeometry, layoutOf, GUTTER, SHEET_TOP_GAP, fromSheetTop, pageNumberStyle, bandStyle, sheetStyle } from '../../kernel/docx/pageGeometry.js';
|
|
7
|
+
import { repaginate } from '../../kernel/docx/pagination.js';
|
|
8
|
+
import { savePrefs } from './shared.js';
|
|
9
|
+
function geo() { return pageGeometry(this.state.page); }
|
|
10
|
+
|
|
11
|
+
function layout() { return layoutOf(this.geo()); }
|
|
12
|
+
|
|
13
|
+
function sheetsCtx() {
|
|
14
|
+
return {
|
|
15
|
+
geo: () => this.geo(),
|
|
16
|
+
layout: () => this.layout(),
|
|
17
|
+
pageCount: () => this.pageCount,
|
|
18
|
+
pageNumbers: () => this.state.pageNumbers,
|
|
19
|
+
watermark: () => this.state.watermark,
|
|
20
|
+
endnotes: () => this.state.endnotes,
|
|
21
|
+
fnHeights: () => this.fnHeights,
|
|
22
|
+
bandEdit: () => this.bandEditSlot,
|
|
23
|
+
pageNumberText: (p) => this.pageNumberText(p),
|
|
24
|
+
fnPageOf: (p) => this.footnotePages.get(p) || [],
|
|
25
|
+
sheetStyleOf: (p) => sheetStyle(p, this.layout()),
|
|
26
|
+
hfBandStyle: (p, which) => bandStyle(p, which, this.geo(), this.layout(), { head: 0, foot: 0 }),
|
|
27
|
+
pageNumStyle: (p) => pageNumberStyle(p, this.geo(), this.layout(), this.state.pageNumbers.align),
|
|
28
|
+
fnBandStyle: (p) => {
|
|
29
|
+
const L = this.layout();
|
|
30
|
+
const h = this.fnHeights[p - 1] || 0;
|
|
31
|
+
return { top: fromSheetTop(p, L.padTop + L.availOf() - h, L), left: `${L.padLeft}px`, right: `${L.padRight}px` };
|
|
32
|
+
},
|
|
33
|
+
enBandStyle: () => {
|
|
34
|
+
const L = this.layout();
|
|
35
|
+
const p = this.pageCount;
|
|
36
|
+
const h = this.fnHeights[p - 1] || 0;
|
|
37
|
+
return { top: fromSheetTop(p, L.padTop + L.availOf() - h, L), left: `${L.padLeft}px`, right: `${L.padRight}px`, transform: 'translateY(-100%)' };
|
|
38
|
+
},
|
|
39
|
+
bandSlot: (which, p) => this.bandSlot(which, p),
|
|
40
|
+
hfDisplayHtml: (which, p) => this.hfDisplayHtml(which, p),
|
|
41
|
+
showHf: (p, which) => this.showHf(p, which),
|
|
42
|
+
showPageNumber: (p) => this.showPageNumber(p),
|
|
43
|
+
footerHasPageField: (p) => /data-fld="PAGE"/i.test(this.hfTextAt('footer', p)),
|
|
44
|
+
onBandDblClick: (slot, el) => this.startEditBand(slot, el),
|
|
45
|
+
onBandCommit: () => this.commitBand(),
|
|
46
|
+
onFootnoteDblClick: (fn) => this.editFootnote(fn),
|
|
47
|
+
onEndnoteDblClick: (en) => this.editEndnote(en),
|
|
48
|
+
zoom: () => this.zoom,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function applyEditorGeometry() {
|
|
53
|
+
const geo = this.geo();
|
|
54
|
+
const layout = this.layout();
|
|
55
|
+
this.editorWrap.style.zoom = String(this.zoom / 100);
|
|
56
|
+
this.editorWrap.style.setProperty('--gbd-wd-sheet-top', `${SHEET_TOP_GAP}px`);
|
|
57
|
+
const style = {
|
|
58
|
+
'--gbd-re-content-w': `${geo.w}mm`,
|
|
59
|
+
'--gbd-re-content-m': '0 auto',
|
|
60
|
+
'--gbd-re-content-pad': `${layout.padTop}px ${layout.padRight}px ${layout.padBottom}px ${layout.padLeft}px`,
|
|
61
|
+
'--gbd-re-content-min-h': `${this.pageCount * layout.pageH + Math.max(0, this.pageCount - 1) * GUTTER}px`,
|
|
62
|
+
};
|
|
63
|
+
for (const [k, v] of Object.entries(style)) this.editorWrap.style.setProperty(k, v);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function applyZoom() {
|
|
67
|
+
this.statusBar.setZoom(this.zoom);
|
|
68
|
+
this.applyEditorGeometry();
|
|
69
|
+
this.schedulePaginate();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function setZoom(z) {
|
|
73
|
+
this.zoom = Math.max(40, Math.min(300, Math.round(z)));
|
|
74
|
+
this.prefs.zoom = this.zoom;
|
|
75
|
+
savePrefs(this.prefs);
|
|
76
|
+
this.applyZoom();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function paginate() {
|
|
80
|
+
const ed = this.editor;
|
|
81
|
+
const root = ed?.root;
|
|
82
|
+
if (!root || ed.composing) return;
|
|
83
|
+
const L = this.layout();
|
|
84
|
+
const opts = {
|
|
85
|
+
cellsPerPage: L.cols,
|
|
86
|
+
gapOf: L.padTop + L.padBottom,
|
|
87
|
+
gutter: GUTTER,
|
|
88
|
+
padTop: L.padTop,
|
|
89
|
+
colW: L.colW,
|
|
90
|
+
colGap: L.colGap,
|
|
91
|
+
colSeparator: this.geo().colSeparator,
|
|
92
|
+
padLeft: L.padLeft,
|
|
93
|
+
padRight: L.padRight,
|
|
94
|
+
scale: this.zoom / 100,
|
|
95
|
+
};
|
|
96
|
+
ed.quietly(() => {
|
|
97
|
+
this.pageCount = repaginate(root, { ...opts, cellH: L.availOf() });
|
|
98
|
+
});
|
|
99
|
+
this.refreshFootnotePages();
|
|
100
|
+
this.renderBackdrop();
|
|
101
|
+
if (this.state.footnotes.length === 0) {
|
|
102
|
+
this.fnHeights = [];
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
requestAnimationFrame(() => {
|
|
106
|
+
const hs = this.measureFnBands();
|
|
107
|
+
this.fnHeights = hs;
|
|
108
|
+
if (!hs.some((h) => h > 0)) {
|
|
109
|
+
this.renderBackdrop();
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
ed.quietly(() => {
|
|
113
|
+
this.pageCount = repaginate(root, { ...opts, cellH: (p) => Math.max(60, L.availOf() - (hs[p - 1] || 0)) });
|
|
114
|
+
});
|
|
115
|
+
this.refreshFootnotePages();
|
|
116
|
+
this.renderBackdrop();
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function schedulePaginate() {
|
|
121
|
+
clearTimeout(this.pageTimer);
|
|
122
|
+
cancelAnimationFrame(this.pageRaf);
|
|
123
|
+
this.pageTimer = setTimeout(() => {
|
|
124
|
+
this.pageRaf = requestAnimationFrame(() => this.paginate());
|
|
125
|
+
}, 120);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function renderBackdrop() {
|
|
129
|
+
this.surface.refreshBackdrop();
|
|
130
|
+
this.applyEditorGeometry();
|
|
131
|
+
this.refreshScroll();
|
|
132
|
+
this.statusBar.setPage(this.visiblePage, this.pageCount);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function measureFnBands() {
|
|
136
|
+
const scale = this.zoom / 100 || 1;
|
|
137
|
+
const out = [];
|
|
138
|
+
for (const el of this.root.querySelectorAll('.word-sheet-fn[data-page]')) {
|
|
139
|
+
const p = Number(el.dataset.page);
|
|
140
|
+
if (p > 0) out[p - 1] = el.getBoundingClientRect().height / scale;
|
|
141
|
+
}
|
|
142
|
+
return out;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function refreshScroll() {
|
|
146
|
+
const pageH = this.layout().pageH;
|
|
147
|
+
if (!pageH) return;
|
|
148
|
+
const step = pageH + GUTTER;
|
|
149
|
+
// 第一页不从滚动原点起:扣掉纸层顶部留白再折算页序,否则页数会提前一页翻
|
|
150
|
+
const offset = this.surface.scrollEl.scrollTop - SHEET_TOP_GAP;
|
|
151
|
+
this.visiblePage = Math.max(1, Math.min(this.pageCount, Math.floor(Math.max(0, offset) / step) + 1));
|
|
152
|
+
this.statusBar.setPage(this.visiblePage, this.pageCount);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export const layoutMethods = { geo, layout, sheetsCtx, applyEditorGeometry, applyZoom, setZoom, paginate, schedulePaginate, renderBackdrop, measureFnBands, refreshScroll };
|