@univerjs/engine-render 1.0.0-alpha.5 → 1.0.0-alpha.7
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/lib/cjs/index.js +205 -107
- package/lib/es/index.js +205 -107
- package/lib/types/components/docs/layout/block/paragraph/layout-ruler.d.ts +6 -2
- package/lib/types/components/docs/layout/block/table.d.ts +3 -1
- package/lib/types/components/docs/layout/doc-skeleton.d.ts +1 -0
- package/lib/types/components/docs/layout/model/glyph.d.ts +5 -1
- package/lib/types/components/docs/layout/model/line.d.ts +2 -2
- package/lib/types/components/docs/layout/tools.d.ts +5 -0
- package/lib/umd/index.js +3 -3
- package/package.json +3 -3
package/lib/cjs/index.js
CHANGED
|
@@ -13019,8 +13019,14 @@ function baseAdjustability(content, width) {
|
|
|
13019
13019
|
function createSkeletonWordGlyph(content, config, glyphWidth) {
|
|
13020
13020
|
return _createSkeletonWordOrLetter(1, content, config, glyphWidth);
|
|
13021
13021
|
}
|
|
13022
|
-
function createSkeletonLetterGlyph(content, config,
|
|
13023
|
-
|
|
13022
|
+
function createSkeletonLetterGlyph(content, config, glyphMetrics, glyphInfo) {
|
|
13023
|
+
const glyphWidth = typeof glyphMetrics === "number" ? glyphMetrics : glyphMetrics === null || glyphMetrics === void 0 ? void 0 : glyphMetrics.width;
|
|
13024
|
+
const glyph = _createSkeletonWordOrLetter(0, content, config, glyphWidth, glyphInfo);
|
|
13025
|
+
if (typeof glyphMetrics === "object") {
|
|
13026
|
+
if (glyphMetrics.ascent != null) glyph.bBox.ba = glyph.bBox.aba = glyphMetrics.ascent;
|
|
13027
|
+
if (glyphMetrics.descent != null) glyph.bBox.bd = glyph.bBox.abd = glyphMetrics.descent;
|
|
13028
|
+
}
|
|
13029
|
+
return glyph;
|
|
13024
13030
|
}
|
|
13025
13031
|
function createSkeletonTabGlyph(config, glyphWidth) {
|
|
13026
13032
|
return _createSkeletonWordOrLetter(4, _univerjs_core.DataStreamTreeTokenType.TAB, config, glyphWidth);
|
|
@@ -13215,7 +13221,7 @@ function glyphShrinkLeft(glyph, amount) {
|
|
|
13215
13221
|
|
|
13216
13222
|
//#endregion
|
|
13217
13223
|
//#region src/components/docs/layout/model/line.ts
|
|
13218
|
-
function createSkeletonLine(paragraphIndex, lineType, lineBoundingBox, columnWidth, lineIndex = 0, isParagraphStart = false, paragraphConfig, page, headerPage, footerPage) {
|
|
13224
|
+
function createSkeletonLine(paragraphIndex, lineType, lineBoundingBox, columnWidth, lineIndex = 0, isParagraphStart = false, paragraphConfig, page, headerPage, footerPage, columnLeft = 0, sectionTop = 0) {
|
|
13219
13225
|
var _page$skeDrawings, _page$skeTables;
|
|
13220
13226
|
const { lineHeight = 15.6, lineTop = 0, contentHeight = 0, paddingLeft = 0, paddingRight = 0, paddingTop = 0, paddingBottom = 0, marginTop = 0, spaceBelowApply = 0 } = lineBoundingBox;
|
|
13221
13227
|
const { skeTablesInParagraph } = paragraphConfig;
|
|
@@ -13240,35 +13246,36 @@ function createSkeletonLine(paragraphIndex, lineType, lineBoundingBox, columnWid
|
|
|
13240
13246
|
}
|
|
13241
13247
|
const affectSkeDrawings = new Map(Array.from(pageSkeDrawings).filter(([_, drawing]) => drawing.drawingOrigin.layoutType !== _univerjs_core.PositionedObjectLayoutType.INLINE && drawing.drawingOrigin.layoutType !== _univerjs_core.PositionedObjectLayoutType.WRAP_NONE));
|
|
13242
13248
|
const wrapTypeTables = new Map(Array.from(pageSkeTables).filter(([_, table]) => table.tableSource.textWrap === _univerjs_core.TableTextWrapType.WRAP));
|
|
13243
|
-
lineSke.divides = lineHeight <= .01 ? [__getDivideSKe(0, columnWidth)] : _calculateDividesByDrawings(lineHeight, lineTop, columnWidth, paddingLeft, paddingRight, page, headerPage, footerPage, affectSkeDrawings, headersDrawings, footersDrawings, wrapTypeTables);
|
|
13249
|
+
lineSke.divides = lineHeight <= .01 ? [__getDivideSKe(0, columnWidth)] : _calculateDividesByDrawings(lineHeight, sectionTop + lineTop, columnLeft, columnWidth, paddingLeft, paddingRight, page, headerPage, footerPage, affectSkeDrawings, headersDrawings, footersDrawings, wrapTypeTables);
|
|
13244
13250
|
for (const divide of lineSke.divides) divide.parent = lineSke;
|
|
13245
13251
|
return lineSke;
|
|
13246
13252
|
}
|
|
13247
|
-
function calculateLineTopByDrawings(lineHeight = 15.6, lineTop = 0, page, headerPage, footerPage, columnLeft = 0, columnWidth = 0) {
|
|
13248
|
-
|
|
13253
|
+
function calculateLineTopByDrawings(lineHeight = 15.6, lineTop = 0, page, headerPage, footerPage, columnLeft = 0, columnWidth = 0, sectionTop = 0) {
|
|
13254
|
+
const absoluteLineTop = sectionTop + lineTop;
|
|
13255
|
+
let maxTop = absoluteLineTop;
|
|
13249
13256
|
const pageSkeDrawings = page.skeDrawings;
|
|
13250
13257
|
const skeNonWrapTables = new Map(Array.from(page.skeTables).filter(([_, table]) => table.tableSource.textWrap === _univerjs_core.TableTextWrapType.NONE));
|
|
13251
13258
|
const headersDrawings = headerPage === null || headerPage === void 0 ? void 0 : headerPage.skeDrawings;
|
|
13252
13259
|
const footersDrawings = footerPage === null || footerPage === void 0 ? void 0 : footerPage.skeDrawings;
|
|
13253
13260
|
if (headerPage && headersDrawings) headersDrawings.forEach((drawing) => {
|
|
13254
|
-
const top = _getLineTopWidthWrapTopBottom(translateHeaderFooterDrawingPosition(drawing, headerPage, page, true), lineHeight,
|
|
13261
|
+
const top = _getLineTopWidthWrapTopBottom(translateHeaderFooterDrawingPosition(drawing, headerPage, page, true), lineHeight, absoluteLineTop, columnLeft, columnWidth);
|
|
13255
13262
|
if (top) maxTop = Math.max(maxTop, top);
|
|
13256
13263
|
});
|
|
13257
13264
|
if (footerPage && footersDrawings) footersDrawings.forEach((drawing) => {
|
|
13258
|
-
const top = _getLineTopWidthWrapTopBottom(translateHeaderFooterDrawingPosition(drawing, footerPage, page, false), lineHeight,
|
|
13265
|
+
const top = _getLineTopWidthWrapTopBottom(translateHeaderFooterDrawingPosition(drawing, footerPage, page, false), lineHeight, absoluteLineTop, columnLeft, columnWidth);
|
|
13259
13266
|
if (top) maxTop = Math.max(maxTop, top);
|
|
13260
13267
|
});
|
|
13261
13268
|
pageSkeDrawings === null || pageSkeDrawings === void 0 || pageSkeDrawings.forEach((drawing) => {
|
|
13262
|
-
const top = _getLineTopWidthWrapTopBottom(drawing, lineHeight,
|
|
13269
|
+
const top = _getLineTopWidthWrapTopBottom(drawing, lineHeight, absoluteLineTop, columnLeft, columnWidth);
|
|
13263
13270
|
if (top) maxTop = Math.max(maxTop, top);
|
|
13264
|
-
const blockingWrapTop = _getLineTopWithFullColumnWrap(drawing, lineHeight,
|
|
13271
|
+
const blockingWrapTop = _getLineTopWithFullColumnWrap(drawing, lineHeight, absoluteLineTop, columnLeft, columnWidth);
|
|
13265
13272
|
if (blockingWrapTop) maxTop = Math.max(maxTop, blockingWrapTop);
|
|
13266
13273
|
});
|
|
13267
13274
|
skeNonWrapTables === null || skeNonWrapTables === void 0 || skeNonWrapTables.forEach((table) => {
|
|
13268
|
-
const top = _getLineTopWidthWrapNone(table, lineHeight,
|
|
13275
|
+
const top = _getLineTopWidthWrapNone(table, lineHeight, absoluteLineTop, columnLeft, columnWidth);
|
|
13269
13276
|
if (top) maxTop = Math.max(maxTop, top);
|
|
13270
13277
|
});
|
|
13271
|
-
return maxTop;
|
|
13278
|
+
return maxTop - sectionTop;
|
|
13272
13279
|
}
|
|
13273
13280
|
function _getLineTopWithFullColumnWrap(drawing, lineHeight, lineTop, columnLeft, columnWidth) {
|
|
13274
13281
|
if (columnWidth <= 0) return;
|
|
@@ -13301,15 +13308,25 @@ function _getLineTopWithFullColumnWrap(drawing, lineHeight, lineTop, columnLeft,
|
|
|
13301
13308
|
if (split.left > 0 || split.left + split.width < columnWidth) return;
|
|
13302
13309
|
return bottom;
|
|
13303
13310
|
}
|
|
13304
|
-
function _getLineTopWidthWrapNone(table, lineHeight, lineTop) {
|
|
13305
|
-
const { top, height } = table;
|
|
13311
|
+
function _getLineTopWidthWrapNone(table, lineHeight, lineTop, columnLeft, columnWidth) {
|
|
13312
|
+
const { top, height, left, width } = table;
|
|
13313
|
+
if (columnWidth > 0 && (left + width <= columnLeft || left >= columnLeft + columnWidth)) return;
|
|
13306
13314
|
if (top + height < lineTop || top > lineHeight + lineTop) return;
|
|
13307
13315
|
return top + height;
|
|
13308
13316
|
}
|
|
13309
|
-
function _getLineTopWidthWrapTopBottom(drawing, lineHeight, lineTop) {
|
|
13317
|
+
function _getLineTopWidthWrapTopBottom(drawing, lineHeight, lineTop, columnLeft, columnWidth) {
|
|
13310
13318
|
const { aTop, height, aLeft, width, angle = 0, drawingOrigin } = drawing;
|
|
13311
13319
|
const { layoutType, distT = 0, distB = 0 } = drawingOrigin;
|
|
13312
13320
|
if (layoutType !== _univerjs_core.PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM) return;
|
|
13321
|
+
if (columnWidth > 0) {
|
|
13322
|
+
var _bounds$left, _bounds$width;
|
|
13323
|
+
const bounds = angle === 0 ? {
|
|
13324
|
+
left: aLeft,
|
|
13325
|
+
width
|
|
13326
|
+
} : getBoundingBox(angle, aLeft, width, aTop, height);
|
|
13327
|
+
const drawingLeft = (_bounds$left = bounds.left) !== null && _bounds$left !== void 0 ? _bounds$left : aLeft;
|
|
13328
|
+
if (drawingLeft + ((_bounds$width = bounds.width) !== null && _bounds$width !== void 0 ? _bounds$width : width) <= columnLeft || drawingLeft >= columnLeft + columnWidth) return;
|
|
13329
|
+
}
|
|
13313
13330
|
if (angle === 0) {
|
|
13314
13331
|
const newAtop = aTop - distT;
|
|
13315
13332
|
const newHeight = distT + height + distB;
|
|
@@ -13322,7 +13339,7 @@ function _getLineTopWidthWrapTopBottom(drawing, lineHeight, lineTop) {
|
|
|
13322
13339
|
if (sTop + sHeight < lineTop || sTop > lineHeight + lineTop) return;
|
|
13323
13340
|
return sTop + sHeight;
|
|
13324
13341
|
}
|
|
13325
|
-
function _calculateDividesByDrawings(lineHeight, lineTop, columnWidth, paddingLeft, paddingRight, page, headerPage, footerPage, paragraphNonInlineSkeDrawings, headersDrawings, footersDrawings, wrapTypeTables) {
|
|
13342
|
+
function _calculateDividesByDrawings(lineHeight, lineTop, columnLeft, columnWidth, paddingLeft, paddingRight, page, headerPage, footerPage, paragraphNonInlineSkeDrawings, headersDrawings, footersDrawings, wrapTypeTables) {
|
|
13326
13343
|
const drawingsMix = [];
|
|
13327
13344
|
drawingsMix.push({
|
|
13328
13345
|
left: 0,
|
|
@@ -13332,21 +13349,21 @@ function _calculateDividesByDrawings(lineHeight, lineTop, columnWidth, paddingLe
|
|
|
13332
13349
|
width: paddingRight
|
|
13333
13350
|
});
|
|
13334
13351
|
if (headerPage && headersDrawings) headersDrawings.forEach((drawing) => {
|
|
13335
|
-
const split = _calculateSplit(translateHeaderFooterDrawingPosition(drawing, headerPage, page, true), lineHeight, lineTop, columnWidth);
|
|
13352
|
+
const split = _calculateSplit(translateHeaderFooterDrawingPosition(drawing, headerPage, page, true), lineHeight, lineTop, columnLeft, columnWidth);
|
|
13336
13353
|
if (split) drawingsMix.push(split);
|
|
13337
13354
|
});
|
|
13338
13355
|
if (footerPage && footersDrawings) footersDrawings.forEach((drawing) => {
|
|
13339
|
-
const split = _calculateSplit(translateHeaderFooterDrawingPosition(drawing, footerPage, page, false), lineHeight, lineTop, columnWidth);
|
|
13356
|
+
const split = _calculateSplit(translateHeaderFooterDrawingPosition(drawing, footerPage, page, false), lineHeight, lineTop, columnLeft, columnWidth);
|
|
13340
13357
|
if (split) drawingsMix.push(split);
|
|
13341
13358
|
});
|
|
13342
13359
|
paragraphNonInlineSkeDrawings === null || paragraphNonInlineSkeDrawings === void 0 || paragraphNonInlineSkeDrawings.forEach((drawing) => {
|
|
13343
|
-
const split = _calculateSplit(drawing, lineHeight, lineTop, columnWidth);
|
|
13360
|
+
const split = _calculateSplit(drawing, lineHeight, lineTop, columnLeft, columnWidth);
|
|
13344
13361
|
if (split) drawingsMix.push(split);
|
|
13345
13362
|
});
|
|
13346
13363
|
if (wrapTypeTables && wrapTypeTables.size > 0) wrapTypeTables.forEach((table) => {
|
|
13347
13364
|
const { left, top, width, height, tableSource } = table;
|
|
13348
13365
|
const { dist } = tableSource;
|
|
13349
|
-
const split = __getSplitWidthNoAngle(top, height, left, width, lineTop, lineHeight, columnWidth, dist);
|
|
13366
|
+
const split = __getSplitWidthNoAngle(top, height, left - columnLeft, width, lineTop, lineHeight, columnWidth, dist);
|
|
13350
13367
|
if (split) drawingsMix.push(split);
|
|
13351
13368
|
});
|
|
13352
13369
|
return _calculateDivideByDrawings(columnWidth, drawingsMix);
|
|
@@ -13364,7 +13381,7 @@ function collisionDetection(floatObject, lineHeight, lineTop, columnLeft, column
|
|
|
13364
13381
|
if (left + width < columnLeft || left > columnLeft + columnWidth) return false;
|
|
13365
13382
|
return true;
|
|
13366
13383
|
}
|
|
13367
|
-
function _calculateSplit(drawing, lineHeight, lineTop, columnWidth) {
|
|
13384
|
+
function _calculateSplit(drawing, lineHeight, lineTop, columnLeft, columnWidth) {
|
|
13368
13385
|
const { aTop, height, aLeft, width, angle = 0, drawingOrigin } = drawing;
|
|
13369
13386
|
const { layoutType } = drawingOrigin;
|
|
13370
13387
|
if (layoutType === _univerjs_core.PositionedObjectLayoutType.WRAP_NONE || layoutType === _univerjs_core.PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM) return;
|
|
@@ -13377,6 +13394,9 @@ function _calculateSplit(drawing, lineHeight, lineTop, columnWidth) {
|
|
|
13377
13394
|
const point = lineTo[i];
|
|
13378
13395
|
points.push(new Vector2(point[0], point[1]));
|
|
13379
13396
|
}
|
|
13397
|
+
points.forEach((point) => {
|
|
13398
|
+
point.x -= columnLeft;
|
|
13399
|
+
});
|
|
13380
13400
|
if (angle !== 0) {
|
|
13381
13401
|
const transform = new Transform().rotate(angle);
|
|
13382
13402
|
for (let i = 0; i < points.length; i++) {
|
|
@@ -13393,8 +13413,8 @@ function _calculateSplit(drawing, lineHeight, lineTop, columnWidth) {
|
|
|
13393
13413
|
distB,
|
|
13394
13414
|
distR
|
|
13395
13415
|
};
|
|
13396
|
-
if (angle === 0) return __getSplitWidthNoAngle(aTop, height, aLeft, width, lineTop, lineHeight, columnWidth, dist, layoutType, wrapText);
|
|
13397
|
-
const boundingBox = getBoundingBox(angle, aLeft, width, aTop, height);
|
|
13416
|
+
if (angle === 0) return __getSplitWidthNoAngle(aTop, height, aLeft - columnLeft, width, lineTop, lineHeight, columnWidth, dist, layoutType, wrapText);
|
|
13417
|
+
const boundingBox = getBoundingBox(angle, aLeft - columnLeft, width, aTop, height);
|
|
13398
13418
|
if (layoutType === _univerjs_core.PositionedObjectLayoutType.WRAP_SQUARE) {
|
|
13399
13419
|
const { left: sLeft, width: sWidth, top: sTop, height: sHeight } = boundingBox;
|
|
13400
13420
|
return __getSplitWidthNoAngle(sTop, sHeight, sLeft, sWidth, lineTop, lineHeight, columnWidth, dist, layoutType, wrapText);
|
|
@@ -13708,7 +13728,7 @@ function createTableSkeleton(ctx, curPage, viewModel, tableNode, sectionBreakCon
|
|
|
13708
13728
|
tableSkeleton.height = rowTop;
|
|
13709
13729
|
applyMergedCellSpanHeights(tableSkeleton);
|
|
13710
13730
|
const { pageWidth, marginLeft = 0, marginRight = 0 } = curPage;
|
|
13711
|
-
tableSkeleton.left =
|
|
13731
|
+
tableSkeleton.left = getTableLeft(pageWidth - marginLeft - marginRight, tableWidth, table.align, table.indent);
|
|
13712
13732
|
return tableSkeleton;
|
|
13713
13733
|
}
|
|
13714
13734
|
function rollbackListCache(listLevel, table) {
|
|
@@ -13752,7 +13772,7 @@ function createTableSkeletons(ctx, curPage, viewModel, tableNode, sectionBreakCo
|
|
|
13752
13772
|
function updateTableSkeletonsPosition(cache, curPage, skeTables, table) {
|
|
13753
13773
|
const { pageWidth, marginLeft = 0, marginRight = 0 } = curPage;
|
|
13754
13774
|
const { tableWidth } = cache;
|
|
13755
|
-
const tableLeft =
|
|
13775
|
+
const tableLeft = getTableLeft(pageWidth - marginLeft - marginRight, tableWidth, table.align, table.indent);
|
|
13756
13776
|
let tableIndex = 0;
|
|
13757
13777
|
for (const tableSkeleton of skeTables) {
|
|
13758
13778
|
applyMergedCellSpanHeights(tableSkeleton);
|
|
@@ -13957,7 +13977,7 @@ function findMergedMasterCell(table, row, col) {
|
|
|
13957
13977
|
function isCoveredTableCell(cellConfig) {
|
|
13958
13978
|
return (cellConfig === null || cellConfig === void 0 ? void 0 : cellConfig.rowSpan) === 0 || (cellConfig === null || cellConfig === void 0 ? void 0 : cellConfig.columnSpan) === 0;
|
|
13959
13979
|
}
|
|
13960
|
-
function
|
|
13980
|
+
function getTableLeft(pageWidth, tableWidth, align, indent = { v: 0 }) {
|
|
13961
13981
|
switch (align) {
|
|
13962
13982
|
case _univerjs_core.TableAlignmentType.START: return indent.v;
|
|
13963
13983
|
case _univerjs_core.TableAlignmentType.END: return Math.max(0, pageWidth - tableWidth);
|
|
@@ -14095,7 +14115,7 @@ function _popHyphenSlice(divide) {
|
|
|
14095
14115
|
}
|
|
14096
14116
|
return glyphGroup;
|
|
14097
14117
|
}
|
|
14098
|
-
function _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType = "Normal",
|
|
14118
|
+
function _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType = "Normal", defaultSpanMetrics) {
|
|
14099
14119
|
const divideInfo = getLastNotFullDivideInfo(getLastPage(pages));
|
|
14100
14120
|
if (divideInfo) {
|
|
14101
14121
|
var _divide$glyphGroup;
|
|
@@ -14122,7 +14142,8 @@ function _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphCo
|
|
|
14122
14142
|
else if (!isLast && (divide === null || divide === void 0 ? void 0 : divide.glyphGroup.length) === 0 && glyphGroup.length === 1 && glyphGroup[0].streamType === _univerjs_core.DataStreamTreeTokenType.CUSTOM_BLOCK && glyphGroup[0].width > divide.width) {
|
|
14123
14143
|
addGlyphToDivide(divide, glyphGroup, preOffsetLeft);
|
|
14124
14144
|
updateDivideInfo(divide, { breakType: breakPointType });
|
|
14125
|
-
} else if ((divide === null || divide === void 0 ? void 0 : divide.glyphGroup.length) === 0)
|
|
14145
|
+
} else if (!isLast && (divide === null || divide === void 0 ? void 0 : divide.glyphGroup.length) === 0) _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType, defaultSpanMetrics);
|
|
14146
|
+
else if ((divide === null || divide === void 0 ? void 0 : divide.glyphGroup.length) === 0) {
|
|
14126
14147
|
const sliceGlyphGroup = [];
|
|
14127
14148
|
while (glyphGroup.length) {
|
|
14128
14149
|
sliceGlyphGroup.push(glyphGroup.shift());
|
|
@@ -14132,22 +14153,22 @@ function _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphCo
|
|
|
14132
14153
|
}
|
|
14133
14154
|
}
|
|
14134
14155
|
if (sliceGlyphGroup.length > 0) addGlyphToDivide(divide, sliceGlyphGroup, preOffsetLeft);
|
|
14135
|
-
if (glyphGroup.length) _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, false, breakPointType,
|
|
14156
|
+
if (glyphGroup.length) _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, false, breakPointType, defaultSpanMetrics);
|
|
14136
14157
|
} else if (hyphenLineCount > consecutiveHyphenLimit) {
|
|
14137
14158
|
const hyphenSliceGlyphGroup = _popHyphenSlice(divide);
|
|
14138
14159
|
if (hyphenSliceGlyphGroup.length > 0) {
|
|
14139
14160
|
updateDivideInfo(divide, { breakType: "Normal" });
|
|
14140
14161
|
_divideOperator(ctx, hyphenSliceGlyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, "Hyphen");
|
|
14141
14162
|
}
|
|
14142
|
-
_divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType,
|
|
14143
|
-
} else _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType,
|
|
14163
|
+
_divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType, defaultSpanMetrics);
|
|
14164
|
+
} else _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType, defaultSpanMetrics);
|
|
14144
14165
|
} else if (isLast && hyphenationZone && hyphenationZone > 0 && preOffsetLeft >= divide.width - hyphenationZone && breakPointType === "Hyphen" && divide.breakType === "Normal") {
|
|
14145
14166
|
updateDivideInfo(divide, { isFull: true });
|
|
14146
|
-
_divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType,
|
|
14167
|
+
_divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType, defaultSpanMetrics);
|
|
14147
14168
|
} else {
|
|
14148
14169
|
const currentLine = divide.parent;
|
|
14149
14170
|
const maxBox = __maxFontBoundingBoxByGlyphGroup(glyphGroup);
|
|
14150
|
-
if (currentLine &&
|
|
14171
|
+
if (currentLine && __isPositionedCustomBlockOnlyLine(__getGlyphGroupByLine(currentLine), paragraphConfig.paragraphNonInlineSkeDrawings) && __hasFlowGlyph(glyphGroup)) {
|
|
14151
14172
|
for (const lineDivide of currentLine.divides) updateDivideInfo(lineDivide, { isFull: true });
|
|
14152
14173
|
_lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, false, breakPointType);
|
|
14153
14174
|
return;
|
|
@@ -14166,7 +14187,10 @@ function _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphCo
|
|
|
14166
14187
|
startIndex = 2;
|
|
14167
14188
|
} else newGlyphGroup = [spanGroupCached[0]];
|
|
14168
14189
|
const { paragraphStart: lineIsStart } = currentLine.parent.lines.pop();
|
|
14169
|
-
_lineOperator(ctx, newGlyphGroup, pages, sectionBreakConfig, paragraphConfig, lineIsStart, breakPointType,
|
|
14190
|
+
_lineOperator(ctx, newGlyphGroup, pages, sectionBreakConfig, paragraphConfig, lineIsStart, breakPointType, {
|
|
14191
|
+
lineHeight: boundingBoxAscent + boundingBoxDescent,
|
|
14192
|
+
hasInlineCustomBlock: glyphGroup.some((glyph) => glyph.streamType === _univerjs_core.DataStreamTreeTokenType.CUSTOM_BLOCK && glyph.width !== 0)
|
|
14193
|
+
});
|
|
14170
14194
|
for (let i = startIndex; i < spanGroupCached.length; i++) _divideOperator(ctx, [spanGroupCached[i]], pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText);
|
|
14171
14195
|
_divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType);
|
|
14172
14196
|
return;
|
|
@@ -14188,9 +14212,9 @@ function _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphCo
|
|
|
14188
14212
|
addGlyphToDivide(divide, glyphGroup, preOffsetLeft);
|
|
14189
14213
|
updateDivideInfo(divide, { breakType: breakPointType });
|
|
14190
14214
|
}
|
|
14191
|
-
} else _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType,
|
|
14215
|
+
} else _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType, defaultSpanMetrics);
|
|
14192
14216
|
}
|
|
14193
|
-
function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType = "Normal",
|
|
14217
|
+
function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType = "Normal", defaultSpanMetrics) {
|
|
14194
14218
|
var _originParagraphStyle, _originParagraphStyle2, _skeHeaders$get, _skeFooters$get;
|
|
14195
14219
|
let lastPage = getLastPage(pages);
|
|
14196
14220
|
let columnInfo = getLastNotFullColumnInfo(lastPage);
|
|
@@ -14221,7 +14245,7 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
14221
14245
|
const preLine = getLastLineByColumn(column);
|
|
14222
14246
|
const ascent = Math.max(...glyphGroup.map((glyph) => glyph.bBox.ba));
|
|
14223
14247
|
const descent = Math.max(...glyphGroup.map((glyph) => glyph.bBox.bd));
|
|
14224
|
-
const glyphLineHeight =
|
|
14248
|
+
const glyphLineHeight = (defaultSpanMetrics === null || defaultSpanMetrics === void 0 ? void 0 : defaultSpanMetrics.lineHeight) || ascent + descent;
|
|
14225
14249
|
const { paragraphStyle: originParagraphStyle = {}, paragraphNonInlineSkeDrawings, skeTablesInParagraph, skeHeaders, skeFooters, pDrawingAnchor, paragraphIndex } = paragraphConfig;
|
|
14226
14250
|
const isZeroWidthNonFlowFloatingAnchorLine = __isZeroWidthNonFlowFloatingAnchorLine(glyphGroup, paragraphNonInlineSkeDrawings);
|
|
14227
14251
|
const { namedStyleType } = originParagraphStyle;
|
|
@@ -14232,7 +14256,7 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
14232
14256
|
spaceBelow: (_originParagraphStyle2 = originParagraphStyle.spaceBelow) !== null && _originParagraphStyle2 !== void 0 ? _originParagraphStyle2 : namedStyle === null || namedStyle === void 0 ? void 0 : namedStyle.spaceBelow
|
|
14233
14257
|
};
|
|
14234
14258
|
const { paragraphLineGapDefault, linePitch, lineSpacing, spacingRule, snapToGrid, gridType } = getLineHeightConfig(sectionBreakConfig, paragraphConfig);
|
|
14235
|
-
const hasInlineCustomBlock = glyphGroup.some((glyph) => glyph.streamType === _univerjs_core.DataStreamTreeTokenType.CUSTOM_BLOCK && glyph.width !== 0);
|
|
14259
|
+
const hasInlineCustomBlock = (defaultSpanMetrics === null || defaultSpanMetrics === void 0 ? void 0 : defaultSpanMetrics.hasInlineCustomBlock) || glyphGroup.some((glyph) => glyph.streamType === _univerjs_core.DataStreamTreeTokenType.CUSTOM_BLOCK && glyph.width !== 0);
|
|
14236
14260
|
const positionedCustomBlockOnly = glyphGroup.length > 0 && paragraphNonInlineSkeDrawings != null && paragraphNonInlineSkeDrawings.size > 0 && glyphGroup.every((glyph) => {
|
|
14237
14261
|
if (!glyph) return false;
|
|
14238
14262
|
if (glyph.streamType === _univerjs_core.DataStreamTreeTokenType.CUSTOM_BLOCK) return [...paragraphNonInlineSkeDrawings.values()].some((drawing) => drawing.drawingId === glyph.drawingId);
|
|
@@ -14293,12 +14317,12 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
14293
14317
|
var _pDrawingAnchor$get2;
|
|
14294
14318
|
needOpenNewPageByTableLayout = _updateAndPositionTable(ctx, lineTop, lineHeight, lastPage, column, section, skeTablesInParagraph, paragraphConfig.paragraphIndex, sectionBreakConfig, pDrawingAnchor === null || pDrawingAnchor === void 0 || (_pDrawingAnchor$get2 = pDrawingAnchor.get(paragraphIndex)) === null || _pDrawingAnchor$get2 === void 0 ? void 0 : _pDrawingAnchor$get2.top);
|
|
14295
14319
|
}
|
|
14296
|
-
const calculatedLineTop = positionedCustomBlockOnly ? lineTop : calculateLineTopByDrawings(lineHeight, lineTop, lastPage, headerPage, footerPage);
|
|
14320
|
+
const calculatedLineTop = positionedCustomBlockOnly ? lineTop : calculateLineTopByDrawings(lineHeight, lineTop, lastPage, headerPage, footerPage, column.left, column.width, section.top);
|
|
14297
14321
|
const previousTopBottomCustomBlockFlowBottom = deferredTopBottomAnchorDrawings.length > 0 ? paragraphConfig.topBottomCustomBlockFlowBottom : void 0;
|
|
14298
14322
|
const newLineTop = previousTopBottomCustomBlockFlowBottom == null ? calculatedLineTop : Math.max(calculatedLineTop, previousTopBottomCustomBlockFlowBottom);
|
|
14299
14323
|
if (lineHeight + newLineTop - section.height > LINE_LAYOUT_OVERFLOW_TOLERANCE && column.lines.length > 0 && lastPage.sections.length > 0 || needOpenNewPageByTableLayout) {
|
|
14300
14324
|
setColumnFullState(column, true);
|
|
14301
|
-
_columnOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType,
|
|
14325
|
+
_columnOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType, defaultSpanMetrics);
|
|
14302
14326
|
if (isParagraphFirstShapedText && paragraphNonInlineSkeDrawings && paragraphNonInlineSkeDrawings.size > 0) for (const drawing of paragraphNonInlineSkeDrawings.values()) {
|
|
14303
14327
|
if (lastPage.skeDrawings.has(drawing.drawingId)) lastPage.skeDrawings.delete(drawing.drawingId);
|
|
14304
14328
|
if (ctx.floatObjectsCache.has(drawing.drawingId)) {
|
|
@@ -14326,16 +14350,16 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
14326
14350
|
paddingBottom,
|
|
14327
14351
|
marginTop,
|
|
14328
14352
|
spaceBelowApply
|
|
14329
|
-
}, column.width, lineIndex, isParagraphFirstShapedText, paragraphConfig, lastPage, headerPage, footerPage);
|
|
14353
|
+
}, column.width, lineIndex, isParagraphFirstShapedText, paragraphConfig, lastPage, headerPage, footerPage, column.left, section.top);
|
|
14330
14354
|
column.lines.push(newLine);
|
|
14331
14355
|
newLine.parent = column;
|
|
14332
14356
|
const blockAnchorTop = deferredTopBottomAnchorDrawings.length > 0 ? newLineTop : lineTop;
|
|
14333
14357
|
createAndUpdateBlockAnchor(paragraphIndex, newLine, blockAnchorTop, pDrawingAnchor);
|
|
14334
14358
|
if (deferredTopBottomAnchorDrawings.length > 0) {
|
|
14335
|
-
__updateAndPositionDrawings(ctx, newLineTop, lineHeight, column, deferredTopBottomAnchorDrawings, paragraphConfig.paragraphIndex, isParagraphFirstShapedText, blockAnchorTop, paragraphAnchorLeft,
|
|
14336
|
-
__updateTopBottomCustomBlockFlowBottom(paragraphConfig, deferredTopBottomAnchorDrawings);
|
|
14359
|
+
__updateAndPositionDrawings(ctx, newLineTop, lineHeight, column, deferredTopBottomAnchorDrawings, paragraphConfig.paragraphIndex, isParagraphFirstShapedText, blockAnchorTop, paragraphAnchorLeft, false, true);
|
|
14360
|
+
__updateTopBottomCustomBlockFlowBottom(paragraphConfig, deferredTopBottomAnchorDrawings, section.top);
|
|
14337
14361
|
}
|
|
14338
|
-
_divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType,
|
|
14362
|
+
_divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType, defaultSpanMetrics);
|
|
14339
14363
|
if (deferredInlineGroupAnchorDrawings.length > 0) {
|
|
14340
14364
|
var _pDrawingAnchor$get3;
|
|
14341
14365
|
__updateAndPositionDrawings(ctx, lineTop, lineHeight, column, deferredInlineGroupAnchorDrawings, paragraphConfig.paragraphIndex, isParagraphFirstShapedText, pDrawingAnchor === null || pDrawingAnchor === void 0 || (_pDrawingAnchor$get3 = pDrawingAnchor.get(paragraphIndex)) === null || _pDrawingAnchor$get3 === void 0 ? void 0 : _pDrawingAnchor$get3.top, paragraphAnchorLeft, true);
|
|
@@ -14386,18 +14410,21 @@ function __updateWrapTablePosition(ctx, table, lineTop, lineHeight, column, para
|
|
|
14386
14410
|
table.left = left;
|
|
14387
14411
|
}
|
|
14388
14412
|
function __getWrapTablePosition(table, column, lineTop, lineHeight, drawingAnchorTop) {
|
|
14389
|
-
var _column$parent, _getPositionHorizon, _getPositionVertical;
|
|
14413
|
+
var _column$parent, _column$parent$top, _column$parent2, _getPositionHorizon, _getPositionVertical;
|
|
14390
14414
|
const page = (_column$parent = column.parent) === null || _column$parent === void 0 ? void 0 : _column$parent.parent;
|
|
14415
|
+
const sectionTop = (_column$parent$top = (_column$parent2 = column.parent) === null || _column$parent2 === void 0 ? void 0 : _column$parent2.top) !== null && _column$parent$top !== void 0 ? _column$parent$top : 0;
|
|
14391
14416
|
if (page == null) return;
|
|
14392
14417
|
const isPageBreak = __checkPageBreak(column);
|
|
14393
14418
|
const { tableSource, width, height } = table;
|
|
14394
14419
|
const { positionH, positionV } = tableSource.position;
|
|
14395
14420
|
return {
|
|
14396
14421
|
left: (_getPositionHorizon = getPositionHorizon(positionH, column, page, width, isPageBreak)) !== null && _getPositionHorizon !== void 0 ? _getPositionHorizon : 0,
|
|
14397
|
-
top: (_getPositionVertical = getPositionVertical(positionV, page, lineTop, lineHeight, height, drawingAnchorTop, isPageBreak)) !== null && _getPositionVertical !== void 0 ? _getPositionVertical : 0
|
|
14422
|
+
top: (_getPositionVertical = getPositionVertical(positionV, page, sectionTop + lineTop, lineHeight, height, drawingAnchorTop == null ? void 0 : sectionTop + drawingAnchorTop, isPageBreak)) !== null && _getPositionVertical !== void 0 ? _getPositionVertical : 0
|
|
14398
14423
|
};
|
|
14399
14424
|
}
|
|
14400
14425
|
function __avoidFlowAffectingDrawingsForTable(table, page, column) {
|
|
14426
|
+
var _column$left;
|
|
14427
|
+
const columnLeft = (_column$left = column.left) !== null && _column$left !== void 0 ? _column$left : 0;
|
|
14401
14428
|
const tableTop = table.top;
|
|
14402
14429
|
const tableBottom = table.top + table.height;
|
|
14403
14430
|
const tableRight = table.left + table.width;
|
|
@@ -14410,7 +14437,7 @@ function __avoidFlowAffectingDrawingsForTable(table, page, column) {
|
|
|
14410
14437
|
if (drawingTop >= tableBottom || drawingBottom <= tableTop) continue;
|
|
14411
14438
|
const drawingRight = drawing.aLeft + drawing.width + ((_drawingOrigin$distR = drawingOrigin.distR) !== null && _drawingOrigin$distR !== void 0 ? _drawingOrigin$distR : 0);
|
|
14412
14439
|
if (drawing.aLeft >= tableRight || drawingRight <= table.left) continue;
|
|
14413
|
-
if (drawingRight + table.width <= column.width) table.left = Math.max(table.left, drawingRight);
|
|
14440
|
+
if (drawingRight + table.width <= columnLeft + column.width) table.left = Math.max(table.left, drawingRight);
|
|
14414
14441
|
}
|
|
14415
14442
|
}
|
|
14416
14443
|
function _updateAndPositionTable(ctx, lineTop, lineHeight, page, column, section, skeTablesInParagraph, paragraphIndex, sectionBreakConfig, drawingAnchorTop) {
|
|
@@ -14419,9 +14446,10 @@ function _updateAndPositionTable(ctx, lineTop, lineHeight, page, column, section
|
|
|
14419
14446
|
if (firstUnPositionedTable == null) return false;
|
|
14420
14447
|
const { tableId, table } = firstUnPositionedTable;
|
|
14421
14448
|
const { tableSource } = table;
|
|
14422
|
-
if (firstUnPositionedTable.isSlideTable === false) switch (tableSource.textWrap) {
|
|
14449
|
+
if (firstUnPositionedTable.isSlideTable === false || tableSource.textWrap === _univerjs_core.TableTextWrapType.NONE) switch (tableSource.textWrap) {
|
|
14423
14450
|
case _univerjs_core.TableTextWrapType.NONE:
|
|
14424
|
-
table.top = lineTop;
|
|
14451
|
+
table.top = section.top + lineTop;
|
|
14452
|
+
table.left = column.left + getTableLeft(column.width, table.width, tableSource.align, tableSource.indent);
|
|
14425
14453
|
__avoidFlowAffectingDrawingsForTable(table, page, column);
|
|
14426
14454
|
break;
|
|
14427
14455
|
case _univerjs_core.TableTextWrapType.WRAP:
|
|
@@ -14430,9 +14458,10 @@ function _updateAndPositionTable(ctx, lineTop, lineHeight, page, column, section
|
|
|
14430
14458
|
default: throw new Error(`Unsupported table text wrap type: ${tableSource.textWrap}`);
|
|
14431
14459
|
}
|
|
14432
14460
|
const { top, left, height } = table;
|
|
14433
|
-
|
|
14461
|
+
const localTop = top - section.top;
|
|
14462
|
+
if (!ctx.isDirty && localTop + height > section.height && firstUnPositionedTable.isSlideTable === false) {
|
|
14434
14463
|
skeTablesInParagraph.pop();
|
|
14435
|
-
const availableHeight = section.height -
|
|
14464
|
+
const availableHeight = section.height - localTop;
|
|
14436
14465
|
const { segmentId } = page;
|
|
14437
14466
|
const viewModel = ctx.viewModel.getSelfOrHeaderFooterViewModel(segmentId);
|
|
14438
14467
|
const tableNode = firstUnPositionedTable.tableNode;
|
|
@@ -14476,18 +14505,30 @@ function _getCustomBlockIdsInLine(line) {
|
|
|
14476
14505
|
for (const divide of line.divides) for (const glyph of divide.glyphGroup) if (glyph.streamType === _univerjs_core.DataStreamTreeTokenType.CUSTOM_BLOCK) customBlockIds.push(glyph.drawingId);
|
|
14477
14506
|
return customBlockIds;
|
|
14478
14507
|
}
|
|
14479
|
-
function __updateTopBottomCustomBlockFlowBottom(paragraphConfig, drawings) {
|
|
14508
|
+
function __updateTopBottomCustomBlockFlowBottom(paragraphConfig, drawings, sectionTop) {
|
|
14480
14509
|
for (const drawing of drawings) {
|
|
14481
14510
|
var _drawingOrigin$distB, _paragraphConfig$topB;
|
|
14482
14511
|
const { drawingOrigin } = drawing;
|
|
14483
14512
|
if (drawingOrigin.layoutType !== _univerjs_core.PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM || drawingOrigin.behindDoc === _univerjs_core.BooleanNumber.TRUE) continue;
|
|
14484
|
-
const bottom = drawing.aTop + drawing.height + ((_drawingOrigin$distB = drawingOrigin.distB) !== null && _drawingOrigin$distB !== void 0 ? _drawingOrigin$distB : 0);
|
|
14513
|
+
const bottom = drawing.aTop + drawing.height + ((_drawingOrigin$distB = drawingOrigin.distB) !== null && _drawingOrigin$distB !== void 0 ? _drawingOrigin$distB : 0) - sectionTop;
|
|
14485
14514
|
paragraphConfig.topBottomCustomBlockFlowBottom = Math.max((_paragraphConfig$topB = paragraphConfig.topBottomCustomBlockFlowBottom) !== null && _paragraphConfig$topB !== void 0 ? _paragraphConfig$topB : Number.NEGATIVE_INFINITY, bottom);
|
|
14486
14515
|
}
|
|
14487
14516
|
}
|
|
14488
14517
|
function __isZeroWidthNonFlowFloatingAnchorLine(glyphGroup, paragraphNonInlineSkeDrawings) {
|
|
14489
14518
|
return __getZeroWidthNonFlowFloatingAnchorDrawings(glyphGroup, paragraphNonInlineSkeDrawings).length > 0;
|
|
14490
14519
|
}
|
|
14520
|
+
function __isPositionedCustomBlockOnlyLine(glyphGroup, paragraphNonInlineSkeDrawings) {
|
|
14521
|
+
let hasPositionedCustomBlock = false;
|
|
14522
|
+
for (const glyph of glyphGroup) {
|
|
14523
|
+
var _paragraphNonInlineSk;
|
|
14524
|
+
if (__isStructuralTerminatorGlyph(glyph) || __isIgnorableZeroSizeGlyph(glyph)) continue;
|
|
14525
|
+
if (glyph.streamType !== _univerjs_core.DataStreamTreeTokenType.CUSTOM_BLOCK || glyph.drawingId == null) return false;
|
|
14526
|
+
const drawingOrigin = paragraphNonInlineSkeDrawings === null || paragraphNonInlineSkeDrawings === void 0 || (_paragraphNonInlineSk = paragraphNonInlineSkeDrawings.get(glyph.drawingId)) === null || _paragraphNonInlineSk === void 0 ? void 0 : _paragraphNonInlineSk.drawingOrigin;
|
|
14527
|
+
if (drawingOrigin == null || drawingOrigin.layoutType === _univerjs_core.PositionedObjectLayoutType.INLINE) return false;
|
|
14528
|
+
hasPositionedCustomBlock = true;
|
|
14529
|
+
}
|
|
14530
|
+
return hasPositionedCustomBlock;
|
|
14531
|
+
}
|
|
14491
14532
|
function __getZeroWidthNonFlowFloatingAnchorDrawings(glyphGroup, paragraphNonInlineSkeDrawings) {
|
|
14492
14533
|
const drawings = [];
|
|
14493
14534
|
for (const glyph of glyphGroup) {
|
|
@@ -14516,26 +14557,25 @@ function __hasFlowGlyph(glyphGroup) {
|
|
|
14516
14557
|
});
|
|
14517
14558
|
}
|
|
14518
14559
|
function _reLayoutCheck(ctx, floatObjects, column, paragraphIndex) {
|
|
14519
|
-
var _column$
|
|
14520
|
-
const page = (_column$
|
|
14560
|
+
var _column$parent3;
|
|
14561
|
+
const page = (_column$parent3 = column.parent) === null || _column$parent3 === void 0 ? void 0 : _column$parent3.parent;
|
|
14521
14562
|
const flowAffectingFloatObjects = floatObjects.filter((floatObject) => floatObject.behindDoc !== _univerjs_core.BooleanNumber.TRUE || floatObject.layoutType != null && floatObject.layoutType !== _univerjs_core.PositionedObjectLayoutType.WRAP_NONE);
|
|
14522
14563
|
if (flowAffectingFloatObjects.length === 0 || page == null) return;
|
|
14523
14564
|
let needBreakLineIterator = false;
|
|
14524
14565
|
for (const floatObject of flowAffectingFloatObjects) {
|
|
14525
|
-
var _floatObjectCache$pag, _page$sections$;
|
|
14526
14566
|
const floatObjectCache = ctx.floatObjectsCache.get(floatObject.id);
|
|
14527
14567
|
if (floatObjectCache == null || floatObjectCache.page.segmentId !== page.segmentId) continue;
|
|
14528
14568
|
if (floatObjectCache.count >= FLOAT_OBJECT_RELAYOUT_LIMIT) continue;
|
|
14529
|
-
|
|
14530
|
-
const startIndex = (_page$sections$ = page.sections[0]) === null || _page$sections$ === void 0 || (_page$sections$ = _page$sections$.columns[0]) === null || _page$sections$ === void 0 || (_page$sections$ = _page$sections$.lines[0]) === null || _page$sections$ === void 0 ? void 0 : _page$sections$.paragraphIndex;
|
|
14531
|
-
if (floatObjectCache.page && cachePageStartParagraphIndex && startIndex && cachePageStartParagraphIndex !== startIndex) {
|
|
14569
|
+
if (floatObjectCache.page.pageNumber !== page.pageNumber) {
|
|
14532
14570
|
floatObjectCache.page.skeDrawings.delete(floatObject.id);
|
|
14533
14571
|
ctx.floatObjectsCache.delete(floatObject.id);
|
|
14534
14572
|
lineIterator([floatObjectCache.page], (line) => {
|
|
14535
|
-
|
|
14573
|
+
var _column$parent$top2, _column$parent4;
|
|
14574
|
+
const { lineHeight } = line;
|
|
14536
14575
|
const column = line.parent;
|
|
14537
14576
|
if (needBreakLineIterator || column == null) return;
|
|
14538
14577
|
const { width: columnWidth, left: columnLeft } = column;
|
|
14578
|
+
const top = ((_column$parent$top2 = (_column$parent4 = column.parent) === null || _column$parent4 === void 0 ? void 0 : _column$parent4.top) !== null && _column$parent$top2 !== void 0 ? _column$parent$top2 : 0) + line.top;
|
|
14539
14579
|
if (collisionDetection(floatObjectCache.floatObject, lineHeight, top, columnLeft, columnWidth)) {
|
|
14540
14580
|
var _ctx$layoutStartPoint;
|
|
14541
14581
|
needBreakLineIterator = true;
|
|
@@ -14548,9 +14588,12 @@ function _reLayoutCheck(ctx, floatObjects, column, paragraphIndex) {
|
|
|
14548
14588
|
}
|
|
14549
14589
|
needBreakLineIterator = false;
|
|
14550
14590
|
lineIterator([page], (line) => {
|
|
14551
|
-
|
|
14552
|
-
const {
|
|
14553
|
-
|
|
14591
|
+
var _lineColumn$parent$to, _lineColumn$parent;
|
|
14592
|
+
const { lineHeight } = line;
|
|
14593
|
+
const lineColumn = line.parent;
|
|
14594
|
+
if (needBreakLineIterator || lineColumn == null) return;
|
|
14595
|
+
const { width: columnWidth, left: columnLeft } = lineColumn;
|
|
14596
|
+
const top = ((_lineColumn$parent$to = (_lineColumn$parent = lineColumn.parent) === null || _lineColumn$parent === void 0 ? void 0 : _lineColumn$parent.top) !== null && _lineColumn$parent$to !== void 0 ? _lineColumn$parent$to : 0) + line.top;
|
|
14554
14597
|
for (const floatObject of flowAffectingFloatObjects.values()) {
|
|
14555
14598
|
let targetObject = floatObject;
|
|
14556
14599
|
if (ctx.floatObjectsCache.has(floatObject.id)) {
|
|
@@ -14593,18 +14636,18 @@ function checkRelativeDrawingNeedRePosition(ctx, floatObject) {
|
|
|
14593
14636
|
}
|
|
14594
14637
|
return false;
|
|
14595
14638
|
}
|
|
14596
|
-
function _columnOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType = "Normal",
|
|
14597
|
-
if (isColumnFull(getLastPage(pages)) === true) _pageOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType,
|
|
14598
|
-
else _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType,
|
|
14639
|
+
function _columnOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType = "Normal", defaultSpanMetrics) {
|
|
14640
|
+
if (isColumnFull(getLastPage(pages)) === true) _pageOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType, defaultSpanMetrics);
|
|
14641
|
+
else _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType, defaultSpanMetrics);
|
|
14599
14642
|
}
|
|
14600
|
-
function _pageOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType = "Normal",
|
|
14643
|
+
function _pageOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType = "Normal", defaultSpanMetrics) {
|
|
14601
14644
|
const curSkeletonPage = getLastPage(pages);
|
|
14602
14645
|
const { skeHeaders, skeFooters } = paragraphConfig;
|
|
14603
14646
|
pages.push(createSkeletonPage(ctx, sectionBreakConfig, {
|
|
14604
14647
|
skeHeaders,
|
|
14605
14648
|
skeFooters
|
|
14606
14649
|
}, (curSkeletonPage === null || curSkeletonPage === void 0 ? void 0 : curSkeletonPage.pageNumber) + 1));
|
|
14607
|
-
_columnOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType,
|
|
14650
|
+
_columnOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType, defaultSpanMetrics);
|
|
14608
14651
|
}
|
|
14609
14652
|
/**
|
|
14610
14653
|
* 17.3.1.12 ind (Paragraph Indentation)
|
|
@@ -14753,8 +14796,8 @@ function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, unitId =
|
|
|
14753
14796
|
const drawingHeight = (_viewport$height = viewport === null || viewport === void 0 ? void 0 : viewport.height) !== null && _viewport$height !== void 0 ? _viewport$height : height;
|
|
14754
14797
|
drawing.aLeft = viewport ? blockLeft + ((_viewport$offsetLeft = viewport.offsetLeft) !== null && _viewport$offsetLeft !== void 0 ? _viewport$offsetLeft : 0) : blockLeft + .5 * glyph.width - .5 * drawingWidth || 0;
|
|
14755
14798
|
if (glyph.width > divide.width) {
|
|
14756
|
-
var
|
|
14757
|
-
for (const positionedDrawing of (
|
|
14799
|
+
var _paragraphNonInlineSk2;
|
|
14800
|
+
for (const positionedDrawing of (_paragraphNonInlineSk2 = paragraphNonInlineSkeDrawings === null || paragraphNonInlineSkeDrawings === void 0 ? void 0 : paragraphNonInlineSkeDrawings.values()) !== null && _paragraphNonInlineSk2 !== void 0 ? _paragraphNonInlineSk2 : []) {
|
|
14758
14801
|
const positionedOrigin = positionedDrawing.drawingOrigin;
|
|
14759
14802
|
if (positionedOrigin == null || positionedOrigin.layoutType === _univerjs_core.PositionedObjectLayoutType.INLINE || positionedOrigin.layoutType === _univerjs_core.PositionedObjectLayoutType.WRAP_NONE || positionedOrigin.layoutType === _univerjs_core.PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM) continue;
|
|
14760
14803
|
const positionedBottom = positionedDrawing.aTop + positionedDrawing.height;
|
|
@@ -14790,11 +14833,14 @@ function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, unitId =
|
|
|
14790
14833
|
page.skeDrawings = new Map([...page.skeDrawings, ...drawings]);
|
|
14791
14834
|
}
|
|
14792
14835
|
function __getDrawingPosition(ctx, lineTop, lineHeight, column, isParagraphFirstShapedText, blockAnchorTop, needPositionDrawings = [], blockAnchorLeft = 0, normalizeTraditionalColumnAnchor = true) {
|
|
14793
|
-
var _column$
|
|
14794
|
-
const page = (_column$
|
|
14836
|
+
var _column$parent5, _column$parent$top3, _column$parent6;
|
|
14837
|
+
const page = (_column$parent5 = column.parent) === null || _column$parent5 === void 0 ? void 0 : _column$parent5.parent;
|
|
14795
14838
|
if (page == null || needPositionDrawings.length === 0) return;
|
|
14796
14839
|
const drawings = /* @__PURE__ */ new Map();
|
|
14797
14840
|
const isPageBreak = __checkPageBreak(column);
|
|
14841
|
+
const sectionTop = (_column$parent$top3 = (_column$parent6 = column.parent) === null || _column$parent6 === void 0 ? void 0 : _column$parent6.top) !== null && _column$parent$top3 !== void 0 ? _column$parent$top3 : 0;
|
|
14842
|
+
const absoluteLineTop = sectionTop + lineTop;
|
|
14843
|
+
const absoluteBlockAnchorTop = blockAnchorTop == null ? void 0 : sectionTop + blockAnchorTop;
|
|
14798
14844
|
if (isPageBreak && !isParagraphFirstShapedText) return;
|
|
14799
14845
|
for (const drawing of needPositionDrawings) {
|
|
14800
14846
|
var _ctx$dataModel$getUni, _ctx$dataModel$getUni2, _ctx$dataModel, _viewport$width2, _viewport$height2, _getPositionHorizon2, _getPositionVertical2;
|
|
@@ -14821,7 +14867,7 @@ function __getDrawingPosition(ctx, lineTop, lineHeight, column, isParagraphFirst
|
|
|
14821
14867
|
if (normalizeTraditionalColumnAnchor && ctx.dataModel.documentStyle.documentFlavor === _univerjs_core.DocumentFlavor.TRADITIONAL && positionV.relativeFrom === _univerjs_core.ObjectRelativeFromV.PARAGRAPH) aLeft -= page.marginLeft;
|
|
14822
14868
|
}
|
|
14823
14869
|
drawing.aLeft = aLeft;
|
|
14824
|
-
drawing.aTop = (_getPositionVertical2 = getPositionVertical(positionV, page,
|
|
14870
|
+
drawing.aTop = (_getPositionVertical2 = getPositionVertical(positionV, page, absoluteLineTop, lineHeight, drawingHeight, absoluteBlockAnchorTop, isPageBreak)) !== null && _getPositionVertical2 !== void 0 ? _getPositionVertical2 : 0;
|
|
14825
14871
|
drawing.width = drawingWidth;
|
|
14826
14872
|
drawing.height = drawingHeight;
|
|
14827
14873
|
drawing.angle = angle;
|
|
@@ -14835,17 +14881,17 @@ function __getDrawingPosition(ctx, lineTop, lineHeight, column, isParagraphFirst
|
|
|
14835
14881
|
} : void 0;
|
|
14836
14882
|
drawing.initialState = true;
|
|
14837
14883
|
drawing.columnLeft = column.left;
|
|
14838
|
-
drawing.lineTop =
|
|
14884
|
+
drawing.lineTop = absoluteLineTop;
|
|
14839
14885
|
drawing.lineHeight = lineHeight;
|
|
14840
14886
|
drawing.isPageBreak = isPageBreak;
|
|
14841
|
-
drawing.blockAnchorTop =
|
|
14887
|
+
drawing.blockAnchorTop = absoluteBlockAnchorTop !== null && absoluteBlockAnchorTop !== void 0 ? absoluteBlockAnchorTop : absoluteLineTop;
|
|
14842
14888
|
drawings.set(drawing.drawingId, drawing);
|
|
14843
14889
|
}
|
|
14844
14890
|
return drawings;
|
|
14845
14891
|
}
|
|
14846
14892
|
function __updateDrawingPosition(column, drawings, overwriteTopBottomPosition = false) {
|
|
14847
|
-
var _column$
|
|
14848
|
-
const page = (_column$
|
|
14893
|
+
var _column$parent7;
|
|
14894
|
+
const page = (_column$parent7 = column.parent) === null || _column$parent7 === void 0 ? void 0 : _column$parent7.parent;
|
|
14849
14895
|
if (drawings == null || drawings.size === 0 || page == null) return;
|
|
14850
14896
|
for (const drawing of drawings.values()) {
|
|
14851
14897
|
const originDrawing = page.skeDrawings.get(drawing.drawingId);
|
|
@@ -14859,8 +14905,11 @@ function __updateDrawingPosition(column, drawings, overwriteTopBottomPosition =
|
|
|
14859
14905
|
}
|
|
14860
14906
|
}
|
|
14861
14907
|
function __checkPageBreak(column) {
|
|
14908
|
+
var _section$parent;
|
|
14862
14909
|
const section = column.parent;
|
|
14863
14910
|
if (!section) return false;
|
|
14911
|
+
const pageSections = (_section$parent = section.parent) === null || _section$parent === void 0 ? void 0 : _section$parent.sections;
|
|
14912
|
+
if (pageSections && pageSections[0] !== section) return false;
|
|
14864
14913
|
const columns = section === null || section === void 0 ? void 0 : section.columns;
|
|
14865
14914
|
if (!columns) return false;
|
|
14866
14915
|
const columnLength = columns.length;
|
|
@@ -15681,11 +15730,17 @@ function getFontCreateConfig(index, viewModel, paragraphNode, sectionBreakConfig
|
|
|
15681
15730
|
if (!hasAddonStyle && originTextRun) fontCreateConfigCache.setValue(st, ed, result);
|
|
15682
15731
|
return result;
|
|
15683
15732
|
}
|
|
15684
|
-
function
|
|
15733
|
+
function getCustomRangeGlyphMetrics(index, viewModel, paragraphNode, config) {
|
|
15685
15734
|
const customRange = viewModel.getCustomRange(index + paragraphNode.startIndex);
|
|
15686
|
-
|
|
15687
|
-
|
|
15688
|
-
|
|
15735
|
+
if (!customRange) return;
|
|
15736
|
+
const fontSize = ptToPixel(config.fontStyle.originFontSize);
|
|
15737
|
+
const toPixels = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0 ? value * fontSize : void 0;
|
|
15738
|
+
const metrics = {
|
|
15739
|
+
ascent: toPixels(customRange.glyphAscentEm),
|
|
15740
|
+
descent: toPixels(customRange.glyphDescentEm),
|
|
15741
|
+
width: toPixels(customRange.glyphWidthEm)
|
|
15742
|
+
};
|
|
15743
|
+
return metrics.ascent == null && metrics.descent == null && metrics.width == null ? void 0 : metrics;
|
|
15689
15744
|
}
|
|
15690
15745
|
function getNullSkeleton() {
|
|
15691
15746
|
return {
|
|
@@ -16056,10 +16111,25 @@ function createSkeletonCellPages(ctx, viewModel, cellNode, sectionBreakConfig, t
|
|
|
16056
16111
|
var _sectionBreakConfig$d2, _ctx$dataModel, _ctx$dataModel$getBod;
|
|
16057
16112
|
const sectionNode = cellNode.children[0];
|
|
16058
16113
|
const { page: areaPage, sectionBreakConfig: cellSectionBreakConfig } = createNullCellPage(ctx, sectionBreakConfig, tableConfig, row, col, availableHeight, maxCellPageHeight);
|
|
16059
|
-
const
|
|
16114
|
+
const segmentId = tableConfig.tableId;
|
|
16115
|
+
const retainedPages = [];
|
|
16116
|
+
let currentPage = areaPage;
|
|
16117
|
+
let pages = [];
|
|
16118
|
+
for (let count = 0; count <= 10; count++) {
|
|
16119
|
+
const layoutAnchor = ctx.layoutStartPointer[segmentId];
|
|
16120
|
+
ctx.layoutStartPointer[segmentId] = null;
|
|
16121
|
+
const result = dealWithSection(ctx, viewModel, sectionNode, currentPage, cellSectionBreakConfig, layoutAnchor);
|
|
16122
|
+
pages = [...retainedPages, ...result.pages];
|
|
16123
|
+
if (!ctx.isDirty || ctx.layoutStartPointer[segmentId] == null || count === 10) break;
|
|
16124
|
+
const retryPage = pages.at(-1);
|
|
16125
|
+
if (retryPage == null) break;
|
|
16126
|
+
retainedPages.splice(0, retainedPages.length, ...pages.slice(0, -1));
|
|
16127
|
+
currentPage = retryPage;
|
|
16128
|
+
resetContext(ctx);
|
|
16129
|
+
}
|
|
16060
16130
|
for (const p of pages) {
|
|
16061
16131
|
p.type = 3;
|
|
16062
|
-
p.segmentId =
|
|
16132
|
+
p.segmentId = segmentId;
|
|
16063
16133
|
}
|
|
16064
16134
|
updateBlockIndex(pages, cellNode.startIndex, (_sectionBreakConfig$d2 = sectionBreakConfig.documentCompatibilityPolicy) !== null && _sectionBreakConfig$d2 !== void 0 ? _sectionBreakConfig$d2 : getDocumentCompatibilityPolicy());
|
|
16065
16135
|
applyTrailingBlockRangeSpaceBelow(pages, (_ctx$dataModel = ctx.dataModel) === null || _ctx$dataModel === void 0 || (_ctx$dataModel$getBod = _ctx$dataModel.getBody) === null || _ctx$dataModel$getBod === void 0 ? void 0 : _ctx$dataModel$getBod.call(_ctx$dataModel), cellNode.endIndex);
|
|
@@ -16241,6 +16311,11 @@ function horizontalAlignHandler(line, horizontalAlign, allowOverflowHorizontalOf
|
|
|
16241
16311
|
for (let i = 0; i < divides.length; i++) {
|
|
16242
16312
|
const divide = divides[i];
|
|
16243
16313
|
const { width } = divide;
|
|
16314
|
+
if (divide.glyphGroup.length === 0) {
|
|
16315
|
+
divide.glyphGroupWidth = 0;
|
|
16316
|
+
divide.paddingLeft = 0;
|
|
16317
|
+
continue;
|
|
16318
|
+
}
|
|
16244
16319
|
let glyphGroupWidth = getGlyphGroupWidth(divide);
|
|
16245
16320
|
divide.glyphGroupWidth = glyphGroupWidth;
|
|
16246
16321
|
if (width === Number.POSITIVE_INFINITY) continue;
|
|
@@ -16753,10 +16828,16 @@ function lineBreaking(ctx, viewModel, shapedTextList, curPage, paragraphNode, se
|
|
|
16753
16828
|
segmentDrawingAnchorCache = /* @__PURE__ */ new Map();
|
|
16754
16829
|
drawingAnchor === null || drawingAnchor === void 0 || drawingAnchor.set(segmentId, segmentDrawingAnchorCache);
|
|
16755
16830
|
}
|
|
16831
|
+
const resolvedParagraphStyle = _applyBlockRangeLayoutParagraphStyle((_viewModel$getBody2 = (_viewModel$getBody3 = viewModel.getBody) === null || _viewModel$getBody3 === void 0 ? void 0 : _viewModel$getBody3.call(viewModel)) !== null && _viewModel$getBody2 !== void 0 ? _viewModel$getBody2 : null, paragraph, paragraphStyle, documentStyle, shouldApplyDocumentDefaults);
|
|
16832
|
+
const borderBottom = resolvedParagraphStyle.borderBottom;
|
|
16833
|
+
if (borderBottom) {
|
|
16834
|
+
var _borderBottom$padding, _borderBottom$width;
|
|
16835
|
+
_withMinSpacing(resolvedParagraphStyle, "spaceBelow", Math.max(0, (_borderBottom$padding = borderBottom.padding) !== null && _borderBottom$padding !== void 0 ? _borderBottom$padding : 0) + Math.max(0, (_borderBottom$width = borderBottom.width) !== null && _borderBottom$width !== void 0 ? _borderBottom$width : 1) / 2);
|
|
16836
|
+
}
|
|
16756
16837
|
const paragraphConfig = {
|
|
16757
16838
|
paragraphIndex: endIndex,
|
|
16758
16839
|
documentCompatibilityPolicy,
|
|
16759
|
-
paragraphStyle:
|
|
16840
|
+
paragraphStyle: resolvedParagraphStyle,
|
|
16760
16841
|
docxFallbackAnchorLeft: _getFollowingIndentedParagraphAnchorLeft(viewModel, paragraph, paragraphNode, drawings, isTraditionalDocumentCompatibility(documentCompatibilityPolicy)),
|
|
16761
16842
|
useWordStyleLineHeight,
|
|
16762
16843
|
paragraphNonInlineSkeDrawings,
|
|
@@ -17317,7 +17398,7 @@ function otherHandler(index, charArray, viewModel, paragraphNode, sectionBreakCo
|
|
|
17317
17398
|
if (char == null) break;
|
|
17318
17399
|
if (hasSpace(char) || startWithEmoji(charArray.substring(step))) break;
|
|
17319
17400
|
const config = getFontCreateConfig(index + step, viewModel, paragraphNode, sectionBreakConfig, paragraph);
|
|
17320
|
-
const glyph = createSkeletonLetterGlyph(char, config,
|
|
17401
|
+
const glyph = createSkeletonLetterGlyph(char, config, getCustomRangeGlyphMetrics(index + step, viewModel, paragraphNode, config));
|
|
17321
17402
|
glyphGroup.push(glyph);
|
|
17322
17403
|
src = src.substring(char.length);
|
|
17323
17404
|
step += char.length;
|
|
@@ -17475,7 +17556,7 @@ function shaping(ctx, content, viewModel, paragraphNode, sectionBreakConfig, use
|
|
|
17475
17556
|
const newSpan = createSkeletonLetterGlyph(char, config);
|
|
17476
17557
|
shapedGlyphs.push(newSpan);
|
|
17477
17558
|
} else {
|
|
17478
|
-
const newSpan = createSkeletonLetterGlyph(char, config,
|
|
17559
|
+
const newSpan = createSkeletonLetterGlyph(char, config, getCustomRangeGlyphMetrics(start, viewModel, paragraphNode, config), glyphInfo);
|
|
17479
17560
|
shapedGlyphs.push(newSpan);
|
|
17480
17561
|
}
|
|
17481
17562
|
}
|
|
@@ -17516,7 +17597,7 @@ function shaping(ctx, content, viewModel, paragraphNode, sectionBreakConfig, use
|
|
|
17516
17597
|
else if (char === _univerjs_core.DataStreamTreeTokenType.PARAGRAPH) {
|
|
17517
17598
|
var _sectionBreakConfig$r;
|
|
17518
17599
|
if (((_sectionBreakConfig$r = sectionBreakConfig.renderConfig) === null || _sectionBreakConfig$r === void 0 ? void 0 : _sectionBreakConfig$r.zeroWidthParagraphBreak) === _univerjs_core.BooleanNumber.TRUE) newGlyph = createSkeletonLetterGlyph(char, config, 0);
|
|
17519
|
-
else newGlyph = createSkeletonLetterGlyph(char, config,
|
|
17600
|
+
else newGlyph = createSkeletonLetterGlyph(char, config, getCustomRangeGlyphMetrics(i, viewModel, paragraphNode, config));
|
|
17520
17601
|
} else newGlyph = createSkeletonLetterGlyph(char, config);
|
|
17521
17602
|
shapedGlyphs.push(newGlyph);
|
|
17522
17603
|
i += char.length;
|
|
@@ -17821,7 +17902,7 @@ function dealWithSection(ctx, viewModel, sectionNode, curPage, sectionBreakConfi
|
|
|
17821
17902
|
let currentPageCache = curPage;
|
|
17822
17903
|
if (allCurrentSkeletonPages.length > 0) currentPageCache = allCurrentSkeletonPages[allCurrentSkeletonPages.length - 1];
|
|
17823
17904
|
if (paragraphNode.nodeType === _univerjs_core.DataStreamTreeNodeType.PARAGRAPH) {
|
|
17824
|
-
if (ctx.paragraphsOpenNewPage.
|
|
17905
|
+
if (ctx.paragraphsOpenNewPage.delete(paragraphNode.endIndex) && currentPageCache.sections.some((section) => section.columns.some((column) => column.lines.length > 0))) currentPageCache = createSkeletonPage(ctx, sectionBreakConfig, ctx.skeletonResourceReference, currentPageCache.pageNumber + 1);
|
|
17825
17906
|
skeletonPages = dealWidthParagraph(ctx, viewModel, paragraphNode, currentPageCache, sectionBreakConfig);
|
|
17826
17907
|
}
|
|
17827
17908
|
if (paragraphNode.nodeType === _univerjs_core.DataStreamTreeNodeType.COLUMN_GROUP) {
|
|
@@ -18963,7 +19044,8 @@ var DocumentSkeleton = class DocumentSkeleton extends _univerjs_core.Skeleton {
|
|
|
18963
19044
|
ctx.sectionBreakConfigCache.set(sectionNode.endIndex, sectionBreakConfig);
|
|
18964
19045
|
if (sectionType === _univerjs_core.SectionType.CONTINUOUS && curSkeletonPage != null) {
|
|
18965
19046
|
updateBlockIndex(allSkeletonPages, -1, ctx.docsConfig.documentCompatibilityPolicy);
|
|
18966
|
-
this.
|
|
19047
|
+
if (layoutAnchor != null && layoutAnchor >= sectionNode.startIndex && layoutAnchor <= sectionNode.endIndex) this._restoreContinuousSection(curSkeletonPage, columnProperties, columnSeparatorType);
|
|
19048
|
+
else this._addNewSectionByContinuous(curSkeletonPage, columnProperties, columnSeparatorType);
|
|
18967
19049
|
isContinuous = true;
|
|
18968
19050
|
} else if (layoutAnchor == null || curSkeletonPage == null) {
|
|
18969
19051
|
var _curSkeletonPage$page;
|
|
@@ -19005,6 +19087,19 @@ var DocumentSkeleton = class DocumentSkeleton extends _univerjs_core.Skeleton {
|
|
|
19005
19087
|
newSection.parent = curSkeletonPage;
|
|
19006
19088
|
sections.push(newSection);
|
|
19007
19089
|
}
|
|
19090
|
+
_restoreContinuousSection(curSkeletonPage, columnProperties, columnSeparatorType) {
|
|
19091
|
+
const section = curSkeletonPage.sections[curSkeletonPage.sections.length - 1];
|
|
19092
|
+
if (section == null) return;
|
|
19093
|
+
const pageContentWidth = curSkeletonPage.pageWidth - curSkeletonPage.marginLeft - curSkeletonPage.marginRight;
|
|
19094
|
+
const pageContentHeight = curSkeletonPage.pageHeight - curSkeletonPage.marginTop - curSkeletonPage.marginBottom;
|
|
19095
|
+
const restoredSection = createSkeletonSection(columnProperties, columnSeparatorType, section.top, 0, pageContentWidth, pageContentHeight - section.top);
|
|
19096
|
+
for (const column of restoredSection.columns.slice(section.columns.length)) {
|
|
19097
|
+
column.parent = section;
|
|
19098
|
+
section.columns.push(column);
|
|
19099
|
+
}
|
|
19100
|
+
section.colCount = restoredSection.colCount;
|
|
19101
|
+
section.height = restoredSection.height;
|
|
19102
|
+
}
|
|
19008
19103
|
_findNodeByIndex(charIndex, segmentId = "", segmentPageIndex = -1) {
|
|
19009
19104
|
const skeletonData = this.getSkeletonData();
|
|
19010
19105
|
if (skeletonData == null) return;
|
|
@@ -24192,6 +24287,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
24192
24287
|
this._startRotation(ctx, finalAngle);
|
|
24193
24288
|
for (const section of sections) {
|
|
24194
24289
|
const { columns } = section;
|
|
24290
|
+
this._drawLiquid.translateSave();
|
|
24195
24291
|
this._drawLiquid.translateSection(section);
|
|
24196
24292
|
for (const column of columns) {
|
|
24197
24293
|
const { lines, width: columnWidth } = column;
|
|
@@ -24234,7 +24330,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
24234
24330
|
this._drawLiquid.translateSave();
|
|
24235
24331
|
this._drawLiquid.translateLine(line, true, true);
|
|
24236
24332
|
rotateTranslateXListApply && this._drawLiquid.translate(rotateTranslateXListApply[i]);
|
|
24237
|
-
this._drawLineBackground(ctx, page, line);
|
|
24333
|
+
this._drawLineBackground(ctx, page, line, column.width);
|
|
24238
24334
|
const divideLength = divides.length;
|
|
24239
24335
|
for (let i = 0; i < divideLength; i++) {
|
|
24240
24336
|
const divide = divides[i];
|
|
@@ -24263,12 +24359,13 @@ var Documents = class Documents extends DocComponent {
|
|
|
24263
24359
|
}
|
|
24264
24360
|
this._drawLiquid.translateRestore();
|
|
24265
24361
|
}
|
|
24266
|
-
if (line.borderBottom) this._drawBorderBottom(ctx, page, line);
|
|
24362
|
+
if (line.borderBottom) this._drawBorderBottom(ctx, page, line, column.width);
|
|
24267
24363
|
this._drawLiquid.translateRestore();
|
|
24268
24364
|
}
|
|
24269
24365
|
}
|
|
24270
24366
|
this._drawLiquid.translateRestore();
|
|
24271
24367
|
}
|
|
24368
|
+
this._drawLiquid.translateRestore();
|
|
24272
24369
|
}
|
|
24273
24370
|
if (skeColumnGroups.size > 0) this._drawColumnGroups(ctx, page, skeColumnGroups, extensions, backgroundExtension, glyphExtensionsExcludeBackground, alignOffsetNoAngle, centerAngle, vertexAngle, renderConfig, parentScale);
|
|
24274
24371
|
this._resetRotation(ctx, finalAngle);
|
|
@@ -24401,30 +24498,30 @@ var Documents = class Documents extends DocComponent {
|
|
|
24401
24498
|
const skeleton = this.getSkeleton();
|
|
24402
24499
|
return getDocumentCompatibilityPolicy(skeleton === null || skeleton === void 0 || (_skeleton$getViewMode2 = skeleton.getViewModel) === null || _skeleton$getViewMode2 === void 0 || (_skeleton$getViewMode2 = _skeleton$getViewMode2.call(skeleton)) === null || _skeleton$getViewMode2 === void 0 || (_skeleton$getViewMode3 = _skeleton$getViewMode2.getSnapshot) === null || _skeleton$getViewMode3 === void 0 || (_skeleton$getViewMode3 = _skeleton$getViewMode3.call(_skeleton$getViewMode2)) === null || _skeleton$getViewMode3 === void 0 || (_skeleton$getViewMode3 = _skeleton$getViewMode3.documentStyle) === null || _skeleton$getViewMode3 === void 0 ? void 0 : _skeleton$getViewMode3.documentFlavor);
|
|
24403
24500
|
}
|
|
24404
|
-
_drawLineBackground(ctx, page, line, left = 0, top = 0) {
|
|
24501
|
+
_drawLineBackground(ctx, page, line, width = page.pageWidth - page.marginLeft - page.marginRight, left = 0, top = 0) {
|
|
24405
24502
|
var _line$backgroundColor;
|
|
24406
24503
|
const color = (_line$backgroundColor = line.backgroundColor) === null || _line$backgroundColor === void 0 ? void 0 : _line$backgroundColor.rgb;
|
|
24407
24504
|
if (!color || this._drawLiquid == null) return;
|
|
24408
24505
|
let { x, y } = this._drawLiquid;
|
|
24409
|
-
const {
|
|
24506
|
+
const { marginLeft, marginTop } = page;
|
|
24410
24507
|
x += marginLeft + (left !== null && left !== void 0 ? left : 0);
|
|
24411
24508
|
y -= line.marginTop;
|
|
24412
24509
|
y -= line.paddingTop;
|
|
24413
24510
|
y += marginTop + top;
|
|
24414
24511
|
ctx.save();
|
|
24415
24512
|
ctx.fillStyle = color;
|
|
24416
|
-
fillRectByPrecisionBounds(ctx, x, y,
|
|
24513
|
+
fillRectByPrecisionBounds(ctx, x, y, width, line.lineHeight);
|
|
24417
24514
|
ctx.restore();
|
|
24418
24515
|
}
|
|
24419
|
-
_drawBorderBottom(ctx, page, line, left = 0, top = 0) {
|
|
24516
|
+
_drawBorderBottom(ctx, page, line, width = page.pageWidth - page.marginLeft - page.marginRight, left = 0, top = 0) {
|
|
24420
24517
|
var _line$borderBottom$pa, _line$borderBottom, _border$width, _border$color$rgb;
|
|
24421
24518
|
if (this._drawLiquid == null) return;
|
|
24422
24519
|
let { x, y } = this._drawLiquid;
|
|
24423
|
-
const {
|
|
24520
|
+
const { marginLeft, marginTop } = page;
|
|
24424
24521
|
x += marginLeft + (left !== null && left !== void 0 ? left : 0);
|
|
24425
24522
|
y -= line.marginTop;
|
|
24426
24523
|
y -= line.paddingTop;
|
|
24427
|
-
y += marginTop + top + line.lineHeight + ((_line$borderBottom$pa = (_line$borderBottom = line.borderBottom) === null || _line$borderBottom === void 0 ? void 0 : _line$borderBottom.padding) !== null && _line$borderBottom$pa !== void 0 ? _line$borderBottom$pa : 0);
|
|
24524
|
+
y += marginTop + top + line.lineHeight - line.marginBottom + ((_line$borderBottom$pa = (_line$borderBottom = line.borderBottom) === null || _line$borderBottom === void 0 ? void 0 : _line$borderBottom.padding) !== null && _line$borderBottom$pa !== void 0 ? _line$borderBottom$pa : 0);
|
|
24428
24525
|
ctx.save();
|
|
24429
24526
|
const border = line.borderBottom;
|
|
24430
24527
|
ctx.setLineWidthByPrecision(Math.max(0, (_border$width = border === null || border === void 0 ? void 0 : border.width) !== null && _border$width !== void 0 ? _border$width : 1));
|
|
@@ -24433,7 +24530,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
24433
24530
|
drawLineByBorderType(ctx, "b", 0, {
|
|
24434
24531
|
startX: x,
|
|
24435
24532
|
startY: y,
|
|
24436
|
-
endX: x +
|
|
24533
|
+
endX: x + width,
|
|
24437
24534
|
endY: y
|
|
24438
24535
|
});
|
|
24439
24536
|
ctx.restore();
|
|
@@ -24506,7 +24603,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
24506
24603
|
} else {
|
|
24507
24604
|
this._drawLiquid.translateSave();
|
|
24508
24605
|
this._drawLiquid.translateLine(line, true, true);
|
|
24509
|
-
this._drawLineBackground(ctx, nestedPage, line);
|
|
24606
|
+
this._drawLineBackground(ctx, nestedPage, line, column.width);
|
|
24510
24607
|
const divideLength = divides.length;
|
|
24511
24608
|
for (let i = 0; i < divideLength; i++) {
|
|
24512
24609
|
const divide = divides[i];
|
|
@@ -24535,7 +24632,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
24535
24632
|
}
|
|
24536
24633
|
this._drawLiquid.translateRestore();
|
|
24537
24634
|
}
|
|
24538
|
-
if (line.borderBottom) this._drawBorderBottom(ctx, nestedPage, line, parentPage.marginLeft, parentPage.marginTop);
|
|
24635
|
+
if (line.borderBottom) this._drawBorderBottom(ctx, nestedPage, line, column.width, parentPage.marginLeft, parentPage.marginTop);
|
|
24539
24636
|
this._drawLiquid.translateRestore();
|
|
24540
24637
|
}
|
|
24541
24638
|
}
|
|
@@ -24657,7 +24754,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
24657
24754
|
continue;
|
|
24658
24755
|
}
|
|
24659
24756
|
}
|
|
24660
|
-
this._drawLineBackground(ctx, page, line, parentPage.marginLeft);
|
|
24757
|
+
this._drawLineBackground(ctx, page, line, column.width, parentPage.marginLeft);
|
|
24661
24758
|
const divideLength = divides.length;
|
|
24662
24759
|
for (let i = 0; i < divideLength; i++) {
|
|
24663
24760
|
const divide = divides[i];
|
|
@@ -24686,7 +24783,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
24686
24783
|
}
|
|
24687
24784
|
this._drawLiquid.translateRestore();
|
|
24688
24785
|
}
|
|
24689
|
-
if (line.borderBottom) this._drawBorderBottom(ctx, page, line, parentPage.marginLeft);
|
|
24786
|
+
if (line.borderBottom) this._drawBorderBottom(ctx, page, line, column.width, parentPage.marginLeft);
|
|
24690
24787
|
this._drawLiquid.translateRestore();
|
|
24691
24788
|
}
|
|
24692
24789
|
}
|
|
@@ -27602,7 +27699,7 @@ Engine = __decorate([__decorateParam(2, ICanvasColorService)], Engine);
|
|
|
27602
27699
|
//#endregion
|
|
27603
27700
|
//#region package.json
|
|
27604
27701
|
var name = "@univerjs/engine-render";
|
|
27605
|
-
var version = "1.0.0-alpha.
|
|
27702
|
+
var version = "1.0.0-alpha.7";
|
|
27606
27703
|
|
|
27607
27704
|
//#endregion
|
|
27608
27705
|
//#region src/config/config.ts
|
|
@@ -29001,14 +29098,15 @@ var Transformer = class extends _univerjs_core.Disposable {
|
|
|
29001
29098
|
}
|
|
29002
29099
|
_createRotateIcon(applyObject, zIndex, left, top) {
|
|
29003
29100
|
const { rotateSize, rotateIconStroke, rotateIconStrokeWidth, borderStroke } = this._getConfig(applyObject);
|
|
29004
|
-
const
|
|
29101
|
+
const iconSize = Math.min(ROTATE_ICON_SIZE, Math.max(rotateSize - 4, 1));
|
|
29102
|
+
const iconOffset = (rotateSize - iconSize) / 2;
|
|
29005
29103
|
return new TransformerRotateIcon(`__SpreadsheetTransformerRotate___ICON_${zIndex}`, {
|
|
29006
29104
|
zIndex,
|
|
29007
29105
|
evented: false,
|
|
29008
29106
|
left: left + iconOffset,
|
|
29009
29107
|
top: top + iconOffset,
|
|
29010
|
-
width:
|
|
29011
|
-
height:
|
|
29108
|
+
width: iconSize,
|
|
29109
|
+
height: iconSize,
|
|
29012
29110
|
fill: null,
|
|
29013
29111
|
stroke: rotateIconStroke !== null && rotateIconStroke !== void 0 ? rotateIconStroke : borderStroke,
|
|
29014
29112
|
strokeWidth: rotateIconStrokeWidth,
|
|
@@ -29424,7 +29522,7 @@ var Transformer = class extends _univerjs_core.Disposable {
|
|
|
29424
29522
|
height: rotateAnchorOffset,
|
|
29425
29523
|
width: 1,
|
|
29426
29524
|
strokeWidth: borderStrokeWidth,
|
|
29427
|
-
stroke: borderStroke
|
|
29525
|
+
stroke: rotateStroke !== null && rotateStroke !== void 0 ? rotateStroke : borderStroke
|
|
29428
29526
|
});
|
|
29429
29527
|
const { left: rotateLeft, top: rotateTop } = this._getRotateAnchorPosition("__SpreadsheetTransformerRotate__", height, width, applyObject);
|
|
29430
29528
|
const cursor = this._getRotateAnchorCursor("__SpreadsheetTransformerRotate__");
|