@univerjs/engine-render 1.0.4 → 1.1.0
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 +392 -338
- package/lib/es/index.js +387 -333
- package/lib/index.js +387 -333
- package/lib/types/basics/i-document-skeleton-cached.d.ts +4 -0
- package/lib/types/basics/interfaces.d.ts +3 -0
- package/lib/types/components/docs/document.d.ts +1 -0
- package/lib/types/components/docs/layout/block/paragraph/layout-ruler.d.ts +1 -1
- package/lib/types/components/docs/layout/block/section.d.ts +1 -0
- package/lib/types/components/docs/layout/doc-simple-skeleton.d.ts +2 -1
- package/lib/types/components/docs/layout/doc-skeleton.d.ts +3 -0
- package/lib/types/components/docs/layout/model/page.d.ts +2 -2
- package/lib/types/components/sheets/extensions/font.d.ts +1 -1
- package/lib/types/components/sheets/sheet.render-skeleton.d.ts +1 -0
- package/lib/types/shape/text.d.ts +2 -0
- package/lib/umd/index.js +5 -5
- package/package.json +5 -5
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AlignTypeH, AlignTypeV, BaselineOffset, BooleanNumber, BorderStyleTypes, BulletAlignment, COLORS, CellValueType, ColorKit, ColumnResponsiveType, ColumnSeparatorType, CustomDecorationType, CustomRangeType, DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_STYLES, DashStyleType, DataStreamTreeNodeType, DataStreamTreeTokenType, Disposable, DisposableCollection, DocumentBlockRangeType, DocumentDataModel, DocumentFlavor, DocxBreakType, EventSubject, FontStyleType, GridType, HorizontalAlign, IConfigService, IContextService, IUniverInstanceService, Inject, Injector, JSON1, ListGlyphType, LocaleService, LookUp, MODERN_DOCUMENT_DEFAULT_MARGIN, MODERN_DOCUMENT_WIDTH, MOVE_BUFFER_VALUE, ModernDocumentWidthMode, NAMED_STYLE_MAP, NAMED_STYLE_SPACE_MAP, NumberUnitType, ObjectMatrix, ObjectRelativeFromH, ObjectRelativeFromV, PRESET_LIST_TYPE, PageOrientType, Plugin, PositionedObjectLayoutType, Range, Rectangle, Registry, SectionType, SheetSkeleton, Skeleton, SpacingRule, TabStopAlignment, TableAlignmentType, TableRowHeightRule, TableSizeType, TableTextWrapType, TextDecoration, TextX, TextXActionType, ThemeService, Tools, UniverInstanceType, VerticalAlign, VerticalAlignmentType, WrapStrategy, WrapTextType, characterSpacingControlType, checkParagraphHasIndentByStyle, createIdentifier, deleteContent, getColorStyle, getDisplayValueFromCell, getRichTextEditPath, horizontalLineSegmentsSubtraction, insertTextToContent, invertColorByMatrix, isCellCoverable, isClassDependencyItem, isDefaultFormat, isNullCell, isWhiteColor, merge, noop, numberToABC, numberToListABC, numfmt, regexp, registerDependencies, remove, requestImmediateMacroTask, resolveDocumentParagraphStyle, resolveSectionHeaderFooterReferences, searchArray, sortRules, sortRulesByDesc, toDisposable } from "@univerjs/core";
|
|
1
|
+
import { AlignTypeH, AlignTypeV, BaselineOffset, BooleanNumber, BorderStyleTypes, BulletAlignment, COLORS, CellValueType, ColorKit, ColumnResponsiveType, ColumnSeparatorType, CustomDecorationType, CustomRangeType, DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_STYLES, DashStyleType, DataStreamTreeNodeType, DataStreamTreeTokenType, Disposable, DisposableCollection, DocumentBlockRangeType, DocumentDataModel, DocumentFlavor, DocxBreakType, EventSubject, FontStyleType, GridType, HorizontalAlign, IConfigService, IContextService, IUniverInstanceService, Inject, Injector, JSON1, ListGlyphType, LocaleService, LookUp, MODERN_DOCUMENT_DEFAULT_MARGIN, MODERN_DOCUMENT_WIDTH, MOVE_BUFFER_VALUE, ModernDocumentWidthMode, NAMED_STYLE_MAP, NAMED_STYLE_SPACE_MAP, NumberUnitType, ObjectMatrix, ObjectRelativeFromH, ObjectRelativeFromV, PRESET_LIST_TYPE, PageOrientType, Plugin, PositionedObjectLayoutType, Range, Rectangle, Registry, SHEET_TEXT_LINE_GAP, SectionType, SheetSkeleton, Skeleton, SpacingRule, TabStopAlignment, TableAlignmentType, TableRowHeightRule, TableSizeType, TableTextWrapType, TextDecoration, TextX, TextXActionType, ThemeService, Tools, UniverInstanceType, VerticalAlign, VerticalAlignmentType, WrapStrategy, WrapTextType, characterSpacingControlType, checkParagraphHasIndentByStyle, createIdentifier, deleteContent, getColorStyle, getDisplayValueFromCell, getRichTextEditPath, horizontalLineSegmentsSubtraction, insertTextToContent, invertColorByMatrix, isCellCoverable, isClassDependencyItem, isDefaultFormat, isNullCell, isWhiteColor, merge, noop, numberToABC, numberToListABC, numfmt, regexp, registerDependencies, remove, requestImmediateMacroTask, resolveDocumentParagraphStyle, resolveSectionHeaderFooterReferences, searchArray, sortRules, sortRulesByDesc, toDisposable } from "@univerjs/core";
|
|
2
2
|
import { BehaviorSubject, Observable, Subject, Subscription, distinctUntilChanged, merge as merge$1, shareReplay, startWith } from "rxjs";
|
|
3
3
|
import { franc } from "franc-min";
|
|
4
4
|
import { getOverflowAncestors } from "@floating-ui/dom";
|
|
@@ -22,7 +22,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
//#endregion
|
|
25
|
-
//#region \0@oxc-project+runtime@0.
|
|
25
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
|
|
26
26
|
function _typeof(o) {
|
|
27
27
|
"@babel/helpers - typeof";
|
|
28
28
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -33,7 +33,7 @@ function _typeof(o) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
//#endregion
|
|
36
|
-
//#region \0@oxc-project+runtime@0.
|
|
36
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
|
|
37
37
|
function toPrimitive(t, r) {
|
|
38
38
|
if ("object" != _typeof(t) || !t) return t;
|
|
39
39
|
var e = t[Symbol.toPrimitive];
|
|
@@ -46,14 +46,14 @@ function toPrimitive(t, r) {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
//#endregion
|
|
49
|
-
//#region \0@oxc-project+runtime@0.
|
|
49
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
|
|
50
50
|
function toPropertyKey(t) {
|
|
51
51
|
var i = toPrimitive(t, "string");
|
|
52
52
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
//#endregion
|
|
56
|
-
//#region \0@oxc-project+runtime@0.
|
|
56
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
|
|
57
57
|
function _defineProperty(e, r, t) {
|
|
58
58
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
59
59
|
value: t,
|
|
@@ -11919,12 +11919,13 @@ var LineBreaker = class {
|
|
|
11919
11919
|
* limitations under the License.
|
|
11920
11920
|
*/
|
|
11921
11921
|
var DocSimpleSkeleton = class {
|
|
11922
|
-
constructor(_text, _fontStyle, _warp, _width, _height) {
|
|
11922
|
+
constructor(_text, _fontStyle, _warp, _width, _height, _lineGap = 0) {
|
|
11923
11923
|
this._text = _text;
|
|
11924
11924
|
this._fontStyle = _fontStyle;
|
|
11925
11925
|
this._warp = _warp;
|
|
11926
11926
|
this._width = _width;
|
|
11927
11927
|
this._height = _height;
|
|
11928
|
+
this._lineGap = _lineGap;
|
|
11928
11929
|
_defineProperty(this, "_lineBreaker", void 0);
|
|
11929
11930
|
_defineProperty(this, "_lines", []);
|
|
11930
11931
|
_defineProperty(this, "_dirty", true);
|
|
@@ -11976,7 +11977,7 @@ var DocSimpleSkeleton = class {
|
|
|
11976
11977
|
if (textSize.width > this._width) {
|
|
11977
11978
|
if (currentLine.text.length > 0) {
|
|
11978
11979
|
this._lines.push(currentLine);
|
|
11979
|
-
totalHeight += currentLine.height;
|
|
11980
|
+
totalHeight += currentLine.height + (this._lines.length > 1 ? this._lineGap : 0);
|
|
11980
11981
|
if (totalHeight > this._height) break;
|
|
11981
11982
|
currentLine = {
|
|
11982
11983
|
text: "",
|
|
@@ -12032,7 +12033,7 @@ var DocSimpleSkeleton = class {
|
|
|
12032
12033
|
remainingText = remainingText.slice(charCount);
|
|
12033
12034
|
if (remainingText.length > 0) {
|
|
12034
12035
|
this._lines.push(currentLine);
|
|
12035
|
-
totalHeight += currentLine.height;
|
|
12036
|
+
totalHeight += currentLine.height + (this._lines.length > 1 ? this._lineGap : 0);
|
|
12036
12037
|
if (totalHeight > this._height) break;
|
|
12037
12038
|
currentLine = {
|
|
12038
12039
|
text: "",
|
|
@@ -12045,7 +12046,7 @@ var DocSimpleSkeleton = class {
|
|
|
12045
12046
|
}
|
|
12046
12047
|
} else if (currentLine.text.length > 0) {
|
|
12047
12048
|
this._lines.push(currentLine);
|
|
12048
|
-
totalHeight += currentLine.height;
|
|
12049
|
+
totalHeight += currentLine.height + (this._lines.length > 1 ? this._lineGap : 0);
|
|
12049
12050
|
if (totalHeight > this._height) break;
|
|
12050
12051
|
currentLine = {
|
|
12051
12052
|
text,
|
|
@@ -12068,7 +12069,7 @@ var DocSimpleSkeleton = class {
|
|
|
12068
12069
|
}
|
|
12069
12070
|
if (isMandatoryBreak) {
|
|
12070
12071
|
this._lines.push(currentLine);
|
|
12071
|
-
totalHeight += currentLine.height;
|
|
12072
|
+
totalHeight += currentLine.height + (this._lines.length > 1 ? this._lineGap : 0);
|
|
12072
12073
|
if (totalHeight > this._height) break;
|
|
12073
12074
|
currentLine = {
|
|
12074
12075
|
text: "",
|
|
@@ -12086,7 +12087,7 @@ var DocSimpleSkeleton = class {
|
|
|
12086
12087
|
return this._lines;
|
|
12087
12088
|
}
|
|
12088
12089
|
getTotalHeight() {
|
|
12089
|
-
return this._lines.reduce((acc, line) => acc + line.height, 0);
|
|
12090
|
+
return this._lines.reduce((acc, line) => acc + line.height, 0) + Math.max(0, this._lines.length - 1) * this._lineGap;
|
|
12090
12091
|
}
|
|
12091
12092
|
getTotalWidth() {
|
|
12092
12093
|
return this._lines.reduce((acc, line) => Math.max(acc, line.width), 0);
|
|
@@ -12440,6 +12441,7 @@ const TEXT_OBJECT_ARRAY = [
|
|
|
12440
12441
|
"text",
|
|
12441
12442
|
"fontStyle",
|
|
12442
12443
|
"warp",
|
|
12444
|
+
"lineGap",
|
|
12443
12445
|
"hAlign",
|
|
12444
12446
|
"vAlign",
|
|
12445
12447
|
"width",
|
|
@@ -12452,6 +12454,7 @@ var Text = class Text extends Shape {
|
|
|
12452
12454
|
_defineProperty(this, "text", void 0);
|
|
12453
12455
|
_defineProperty(this, "fontStyle", void 0);
|
|
12454
12456
|
_defineProperty(this, "warp", void 0);
|
|
12457
|
+
_defineProperty(this, "lineGap", void 0);
|
|
12455
12458
|
_defineProperty(this, "hAlign", void 0);
|
|
12456
12459
|
_defineProperty(this, "vAlign", void 0);
|
|
12457
12460
|
_defineProperty(this, "skeleton", void 0);
|
|
@@ -12460,14 +12463,15 @@ var Text = class Text extends Shape {
|
|
|
12460
12463
|
this.text = props.text;
|
|
12461
12464
|
this.fontStyle = props.fontStyle;
|
|
12462
12465
|
this.warp = props.warp ?? false;
|
|
12466
|
+
this.lineGap = props.lineGap ?? 0;
|
|
12463
12467
|
this.hAlign = props.hAlign ?? HorizontalAlign.LEFT;
|
|
12464
12468
|
this.vAlign = props.vAlign ?? VerticalAlign.TOP;
|
|
12465
|
-
this.skeleton = new DocSimpleSkeleton(props.text, props.fontStyle, Boolean(props.warp), props.width, props.height);
|
|
12469
|
+
this.skeleton = new DocSimpleSkeleton(props.text, props.fontStyle, Boolean(props.warp), props.width, props.height, this.lineGap);
|
|
12466
12470
|
}
|
|
12467
12471
|
static drawWith(ctx, props, _skeleton) {
|
|
12468
|
-
const { text, fontStyle, warp, hAlign, vAlign, width, height, left = 0, top = 0, cellValueType } = props;
|
|
12472
|
+
const { text, fontStyle, warp, lineGap = 0, hAlign, vAlign, width, height, left = 0, top = 0, cellValueType } = props;
|
|
12469
12473
|
const cachedLayout = !_skeleton && !warp ? Text._getCachedLayout(text, fontStyle) : null;
|
|
12470
|
-
const skeleton = cachedLayout ? null : _skeleton ?? new DocSimpleSkeleton(text, fontStyle, Boolean(warp), width, vAlign === VerticalAlign.TOP ? height : Infinity);
|
|
12474
|
+
const skeleton = cachedLayout ? null : _skeleton ?? new DocSimpleSkeleton(text, fontStyle, Boolean(warp), width, vAlign === VerticalAlign.TOP ? height : Infinity, lineGap);
|
|
12471
12475
|
const lines = (cachedLayout === null || cachedLayout === void 0 ? void 0 : cachedLayout.lines) ?? skeleton.calculate();
|
|
12472
12476
|
const totalHeight = (cachedLayout === null || cachedLayout === void 0 ? void 0 : cachedLayout.totalHeight) ?? skeleton.getTotalHeight();
|
|
12473
12477
|
let lineTop = top + (vAlign === VerticalAlign.TOP ? 0 : vAlign === VerticalAlign.MIDDLE ? (height - totalHeight) / 2 : height - totalHeight);
|
|
@@ -12512,7 +12516,7 @@ var Text = class Text extends Shape {
|
|
|
12512
12516
|
lineWidth: 1,
|
|
12513
12517
|
lineType: TextDecoration.SINGLE
|
|
12514
12518
|
});
|
|
12515
|
-
lineTop = lineTop + lineHeight;
|
|
12519
|
+
lineTop = lineTop + lineHeight + lineGap;
|
|
12516
12520
|
}
|
|
12517
12521
|
ctx.restore();
|
|
12518
12522
|
return totalHeight;
|
|
@@ -16977,7 +16981,7 @@ function dealWithSection(ctx, viewModel, sectionNode, curPage, sectionBreakConfi
|
|
|
16977
16981
|
if (ctx.isDirty) break;
|
|
16978
16982
|
}
|
|
16979
16983
|
const { segmentId } = curPage;
|
|
16980
|
-
if (ctx.isDirty && ctx.layoutStartPointer[segmentId] != null)
|
|
16984
|
+
if (ctx.isDirty && ctx.layoutStartPointer[segmentId] != null) rollbackSectionPages(ctx.layoutStartPointer[segmentId], allCurrentSkeletonPages);
|
|
16981
16985
|
return {
|
|
16982
16986
|
pages: allCurrentSkeletonPages,
|
|
16983
16987
|
renderedBlockIdMap,
|
|
@@ -16985,7 +16989,7 @@ function dealWithSection(ctx, viewModel, sectionNode, curPage, sectionBreakConfi
|
|
|
16985
16989
|
complete: paragraphEndIndex >= sectionNode.children.length
|
|
16986
16990
|
};
|
|
16987
16991
|
}
|
|
16988
|
-
function
|
|
16992
|
+
function rollbackSectionPages(paragraphIndex, allCurrentSkeletonPages) {
|
|
16989
16993
|
let findFirstDirtyLine = false;
|
|
16990
16994
|
for (let pageIndex = 0; pageIndex < allCurrentSkeletonPages.length; pageIndex++) {
|
|
16991
16995
|
const page = allCurrentSkeletonPages[pageIndex];
|
|
@@ -17485,8 +17489,13 @@ function resetCellDrawingAnchors(ctx, cellNode, tableId) {
|
|
|
17485
17489
|
if (!anchors) return;
|
|
17486
17490
|
for (const paragraph of cellNode.children[0].children) anchors.delete(paragraph.endIndex);
|
|
17487
17491
|
}
|
|
17488
|
-
function createSkeletonCellPages(
|
|
17492
|
+
function createSkeletonCellPages(parentContext, viewModel, cellNode, sectionBreakConfig, tableConfig, row, col, availableHeight = Number.POSITIVE_INFINITY, maxCellPageHeight = Number.POSITIVE_INFINITY, cellPageHeights) {
|
|
17489
17493
|
var _ctx$dataModel, _ctx$dataModel$getBod;
|
|
17494
|
+
const ctx = {
|
|
17495
|
+
...parentContext,
|
|
17496
|
+
isDirty: false,
|
|
17497
|
+
layoutStartPointer: { ...parentContext.layoutStartPointer }
|
|
17498
|
+
};
|
|
17490
17499
|
const sectionNode = cellNode.children[0];
|
|
17491
17500
|
const body = (_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);
|
|
17492
17501
|
const { enableDocumentTableLineGrid, inheritDocumentLinePitch } = getCellLineGridOptions(sectionBreakConfig);
|
|
@@ -17525,7 +17534,12 @@ function createSkeletonCellPages(ctx, viewModel, cellNode, sectionBreakConfig, t
|
|
|
17525
17534
|
finishVerticalCellLayout(pages, verticalCellWidth);
|
|
17526
17535
|
return pages;
|
|
17527
17536
|
}
|
|
17528
|
-
function startSkeletonCellPagesBuild(
|
|
17537
|
+
function startSkeletonCellPagesBuild(parentContext, viewModel, cellNode, sectionBreakConfig, tableConfig, row, col, availableHeight = Number.POSITIVE_INFINITY, maxCellPageHeight = Number.POSITIVE_INFINITY, cellPageHeights) {
|
|
17538
|
+
const ctx = {
|
|
17539
|
+
...parentContext,
|
|
17540
|
+
isDirty: false,
|
|
17541
|
+
layoutStartPointer: { ...parentContext.layoutStartPointer }
|
|
17542
|
+
};
|
|
17529
17543
|
const sectionNode = cellNode.children[0];
|
|
17530
17544
|
const { enableDocumentTableLineGrid, inheritDocumentLinePitch } = getCellLineGridOptions(sectionBreakConfig);
|
|
17531
17545
|
const { page, sectionBreakConfig: cellSectionBreakConfig, verticalCellWidth } = createNullCellPage(ctx, sectionBreakConfig, tableConfig, row, col, availableHeight, maxCellPageHeight, inheritDocumentLinePitch, enableDocumentTableLineGrid, cellPageHeights);
|
|
@@ -18231,6 +18245,7 @@ function _getParagraphLineMetrics(ctx, glyphGroup, lastPage, column, sectionBrea
|
|
|
18231
18245
|
marginTop: 0,
|
|
18232
18246
|
spaceBelowApply: (preLine === null || preLine === void 0 ? void 0 : preLine.spaceBelowApply) ?? 0
|
|
18233
18247
|
} : __getParagraphSpace(((_sectionBreakConfig$d2 = sectionBreakConfig.documentCompatibilityPolicy) === null || _sectionBreakConfig$d2 === void 0 ? void 0 : _sectionBreakConfig$d2.mode) === "drawingml", lineSpacingApply, suppressCellAutoSpaceAbove ? void 0 : spaceAbove, spaceBelow, isParagraphFirstShapedText, preLine, _shouldSuppressPageTopSpacing(lastPage, column, paragraphConfig, preLine, firstPageNumber, startingSection != null), drawingMLLineHeight);
|
|
18248
|
+
if (preLine) marginTop += sectionBreakConfig.lineGap ?? 0;
|
|
18234
18249
|
if (startingSection && marginTop > 0 && isTraditionalDocumentCompatibility(paragraphConfig.documentCompatibilityPolicy)) marginTop = _collapseSectionBeforeSpacing(ctx, startingSection.children[0].startIndex - 2, marginTop);
|
|
18235
18250
|
if (positionedCustomBlockOnly) spaceBelowApply = 0;
|
|
18236
18251
|
const isHiddenCellEndMark = lastPage.type === 3 && isTraditionalDocumentCompatibility(paragraphConfig.documentCompatibilityPolicy) && sectionBreakConfig.cellHiddenEndMarkIndex === paragraphIndex && paragraphConfig.bulletSkeleton == null && glyphGroup.length > 0 && glyphGroup.every(__isStructuralTerminatorGlyph);
|
|
@@ -18430,7 +18445,11 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
18430
18445
|
if (borderTopSpace > 0) newLine.borderTopSpace = borderTopSpace;
|
|
18431
18446
|
if (borderBottomSpace > 0) newLine.borderBottomSpace = borderBottomSpace;
|
|
18432
18447
|
const blockAnchorTop = deferredTopBottomAnchorDrawings.length > 0 ? newLineTop : lineTop;
|
|
18433
|
-
if (!isStandalonePageBoundary)
|
|
18448
|
+
if (!isStandalonePageBoundary) {
|
|
18449
|
+
createAndUpdateBlockAnchor(paragraphIndex, newLine, blockAnchorTop, pDrawingAnchor);
|
|
18450
|
+
const paragraphDrawingAnchor = pDrawingAnchor === null || pDrawingAnchor === void 0 ? void 0 : pDrawingAnchor.get(paragraphIndex);
|
|
18451
|
+
if (paragraphDrawingAnchor) paragraphDrawingAnchor.left = paragraphAnchorLeft;
|
|
18452
|
+
}
|
|
18434
18453
|
if (deferredTopBottomAnchorDrawings.length > 0) {
|
|
18435
18454
|
__updateAndPositionDrawings(ctx, newLineTop, lineHeight, column, deferredTopBottomAnchorDrawings, paragraphConfig.paragraphIndex, isParagraphFirstShapedText, blockAnchorTop, paragraphAnchorLeft, false, true);
|
|
18436
18455
|
__updateTopBottomCustomBlockFlowBottom(paragraphConfig, deferredTopBottomAnchorDrawings, section.top);
|
|
@@ -18445,6 +18464,10 @@ function __updateAndPositionDrawings(ctx, lineTop, lineHeight, column, targetDra
|
|
|
18445
18464
|
if (targetDrawings.length === 0) return;
|
|
18446
18465
|
const drawings = __getDrawingPosition(ctx, lineTop, lineHeight, column, isParagraphFirstShapedText, drawingAnchorTop, targetDrawings, drawingAnchorLeft);
|
|
18447
18466
|
if (drawings == null || drawings.size === 0) return;
|
|
18467
|
+
for (const drawing of drawings.values()) if (drawing.drawingOrigin.docTransform.positionV.relativeFrom === ObjectRelativeFromV.LINE) {
|
|
18468
|
+
var _ctx$skeletonResource;
|
|
18469
|
+
drawing.blockAnchorLeft = ((_ctx$skeletonResource = ctx.skeletonResourceReference) === null || _ctx$skeletonResource === void 0 || (_ctx$skeletonResource = _ctx$skeletonResource.drawingAnchor) === null || _ctx$skeletonResource === void 0 || (_ctx$skeletonResource = _ctx$skeletonResource.get(column.parent.parent.segmentId)) === null || _ctx$skeletonResource === void 0 || (_ctx$skeletonResource = _ctx$skeletonResource.get(paragraphIndex)) === null || _ctx$skeletonResource === void 0 ? void 0 : _ctx$skeletonResource.left) ?? drawing.blockAnchorLeft;
|
|
18470
|
+
}
|
|
18448
18471
|
const floatObjects = [...drawings.values()].filter((drawing) => {
|
|
18449
18472
|
const layoutType = drawing.drawingOrigin.layoutType;
|
|
18450
18473
|
return layoutType !== PositionedObjectLayoutType.INLINE && layoutType !== PositionedObjectLayoutType.WRAP_NONE;
|
|
@@ -18917,7 +18940,7 @@ function getLineHeightMetrics(glyphLineHeight, paragraphLineGapDefault, linePitc
|
|
|
18917
18940
|
lineSpacingApply: exactLineSpacingApply
|
|
18918
18941
|
};
|
|
18919
18942
|
}
|
|
18920
|
-
function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, unitId = "", blockAnchorTop, paragraphNonInlineSkeDrawings, documentCompatibilityPolicy) {
|
|
18943
|
+
function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, unitId = "", blockAnchorTop, paragraphNonInlineSkeDrawings, documentCompatibilityPolicy, blockAnchorLeft = 0, normalizeTraditionalColumnAnchor = false) {
|
|
18921
18944
|
var _line$parent;
|
|
18922
18945
|
const column = line.parent;
|
|
18923
18946
|
const section = column === null || column === void 0 ? void 0 : column.parent;
|
|
@@ -18983,6 +19006,9 @@ function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, unitId =
|
|
|
18983
19006
|
drawing.lineTop = lineTop;
|
|
18984
19007
|
drawing.columnLeft = column.left;
|
|
18985
19008
|
drawing.blockAnchorTop = blockAnchorTop == null ? lineTop : sectionTop + blockAnchorTop;
|
|
19009
|
+
drawing.blockAnchorLeft = blockAnchorLeft;
|
|
19010
|
+
drawing.normalizeTraditionalColumnAnchor = normalizeTraditionalColumnAnchor;
|
|
19011
|
+
drawing.pageAnchorLeft = normalizeTraditionalColumnAnchor ? page.marginLeft : 0;
|
|
18986
19012
|
drawing.lineHeight = line.lineHeight;
|
|
18987
19013
|
drawings.set(drawing.drawingId, drawing);
|
|
18988
19014
|
}
|
|
@@ -19040,6 +19066,9 @@ function __getDrawingPosition(ctx, lineTop, lineHeight, column, isParagraphFirst
|
|
|
19040
19066
|
} : void 0;
|
|
19041
19067
|
drawing.initialState = true;
|
|
19042
19068
|
drawing.columnLeft = column.left;
|
|
19069
|
+
drawing.blockAnchorLeft = blockAnchorLeft;
|
|
19070
|
+
drawing.normalizeTraditionalColumnAnchor = normalizeTraditionalColumnAnchor && ctx.dataModel.documentStyle.documentFlavor === DocumentFlavor.TRADITIONAL;
|
|
19071
|
+
drawing.pageAnchorLeft = ctx.dataModel.documentStyle.documentFlavor === DocumentFlavor.TRADITIONAL ? page.marginLeft : 0;
|
|
19043
19072
|
drawing.lineTop = absoluteLineTop;
|
|
19044
19073
|
drawing.lineHeight = lineHeight;
|
|
19045
19074
|
drawing.isPageBreak = isPageBreak;
|
|
@@ -19455,7 +19484,7 @@ function updateInlineDrawingCoordsAndBorder(ctx, pages) {
|
|
|
19455
19484
|
const drawingAnchor = (_ctx$skeletonResource = ctx.skeletonResourceReference) === null || _ctx$skeletonResource === void 0 || (_ctx$skeletonResource = _ctx$skeletonResource.drawingAnchor) === null || _ctx$skeletonResource === void 0 || (_ctx$skeletonResource = _ctx$skeletonResource.get(segmentId)) === null || _ctx$skeletonResource === void 0 ? void 0 : _ctx$skeletonResource.get(line.paragraphIndex);
|
|
19456
19485
|
if (affectInlineDrawings && affectInlineDrawings.size > 0) {
|
|
19457
19486
|
var _ctx$dataModel$getUni, _ctx$dataModel;
|
|
19458
|
-
updateInlineDrawingPosition(line, affectInlineDrawings, ((_ctx$dataModel$getUni = (_ctx$dataModel = ctx.dataModel).getUnitId) === null || _ctx$dataModel$getUni === void 0 ? void 0 : _ctx$dataModel$getUni.call(_ctx$dataModel)) ?? "", drawingAnchor === null || drawingAnchor === void 0 ? void 0 : drawingAnchor.top, affectNonInlineDrawings, paragraphConfig === null || paragraphConfig === void 0 ? void 0 : paragraphConfig.documentCompatibilityPolicy);
|
|
19487
|
+
updateInlineDrawingPosition(line, affectInlineDrawings, ((_ctx$dataModel$getUni = (_ctx$dataModel = ctx.dataModel).getUnitId) === null || _ctx$dataModel$getUni === void 0 ? void 0 : _ctx$dataModel$getUni.call(_ctx$dataModel)) ?? "", drawingAnchor === null || drawingAnchor === void 0 ? void 0 : drawingAnchor.top, affectNonInlineDrawings, paragraphConfig === null || paragraphConfig === void 0 ? void 0 : paragraphConfig.documentCompatibilityPolicy, drawingAnchor === null || drawingAnchor === void 0 ? void 0 : drawingAnchor.left, ctx.dataModel.documentStyle.documentFlavor === DocumentFlavor.TRADITIONAL);
|
|
19459
19488
|
}
|
|
19460
19489
|
const paragraphStyle = paragraphConfig === null || paragraphConfig === void 0 ? void 0 : paragraphConfig.paragraphStyle;
|
|
19461
19490
|
const paragraphBackgroundColor = paragraphStyle === null || paragraphStyle === void 0 || (_paragraphStyle$shadi = paragraphStyle.shading) === null || _paragraphStyle$shadi === void 0 ? void 0 : _paragraphStyle$shadi.backgroundColor;
|
|
@@ -21217,8 +21246,7 @@ function shaping(ctx, content, viewModel, paragraphNode, sectionBreakConfig) {
|
|
|
21217
21246
|
//#endregion
|
|
21218
21247
|
//#region src/components/docs/layout/document-layout-page-patch.ts
|
|
21219
21248
|
function withoutParent(value) {
|
|
21220
|
-
const
|
|
21221
|
-
delete copy.parent;
|
|
21249
|
+
const { parent: _parent, ...copy } = value;
|
|
21222
21250
|
return copy;
|
|
21223
21251
|
}
|
|
21224
21252
|
function serializeDivide(source) {
|
|
@@ -21286,10 +21314,10 @@ function serializeDocumentSkeletonPage(source, omitResourceSources = false) {
|
|
|
21286
21314
|
return {
|
|
21287
21315
|
...geometry,
|
|
21288
21316
|
sections: source.sections.map(serializeSection),
|
|
21289
|
-
noteDecorations
|
|
21317
|
+
...noteDecorations == null ? {} : { noteDecorations: noteDecorations.map((decoration) => ({
|
|
21290
21318
|
...decoration,
|
|
21291
21319
|
page: serializeDocumentSkeletonPage(decoration.page, omitResourceSources)
|
|
21292
|
-
})),
|
|
21320
|
+
})) },
|
|
21293
21321
|
...notes == null ? {} : { notes: notes.map((note) => ({
|
|
21294
21322
|
...withoutParent(note),
|
|
21295
21323
|
page: serializeDocumentSkeletonPage(note.page, omitResourceSources)
|
|
@@ -21429,18 +21457,18 @@ function hydrateDocumentSkeletonPageMaterializationPlaceholder(source, parent) {
|
|
|
21429
21457
|
return placeholder;
|
|
21430
21458
|
}
|
|
21431
21459
|
function hydrateDocumentSkeletonPageInternal(source, parent, snapshot, resourceSegmentId) {
|
|
21432
|
-
|
|
21460
|
+
const { notes, noteDecorations, ...geometry } = source;
|
|
21433
21461
|
const page = {
|
|
21434
|
-
...
|
|
21462
|
+
...geometry,
|
|
21435
21463
|
sections: [],
|
|
21436
|
-
noteDecorations
|
|
21464
|
+
...noteDecorations == null ? {} : { noteDecorations: noteDecorations.map((decoration) => ({
|
|
21437
21465
|
...decoration,
|
|
21438
21466
|
page: hydrateDocumentSkeletonPageInternal(decoration.page, void 0, snapshot, decoration.page.segmentId)
|
|
21439
|
-
})),
|
|
21440
|
-
notes
|
|
21467
|
+
})) },
|
|
21468
|
+
...notes == null ? {} : { notes: notes.map((note) => ({
|
|
21441
21469
|
...note,
|
|
21442
21470
|
page: hydrateDocumentSkeletonPageInternal(note.page, void 0, snapshot, note.noteId)
|
|
21443
|
-
})),
|
|
21471
|
+
})) },
|
|
21444
21472
|
skeDrawings: new Map(source.skeDrawings.map(([drawingId, drawing]) => [drawingId, hydrateDrawing(drawing, snapshot, resourceSegmentId)])),
|
|
21445
21473
|
skeTables: /* @__PURE__ */ new Map(),
|
|
21446
21474
|
skeColumnGroups: /* @__PURE__ */ new Map(),
|
|
@@ -23435,7 +23463,9 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
23435
23463
|
_defineProperty(this, "_isolateIncrementalPublications", void 0);
|
|
23436
23464
|
_defineProperty(this, "_modernPageWidth", void 0);
|
|
23437
23465
|
_defineProperty(this, "_modernHorizontalMargin", void 0);
|
|
23466
|
+
_defineProperty(this, "_lineGap", void 0);
|
|
23438
23467
|
this._isolateIncrementalPublications = options.isolateIncrementalPublications !== false;
|
|
23468
|
+
this._lineGap = options.lineGap ?? 0;
|
|
23439
23469
|
}
|
|
23440
23470
|
static create(docViewModel, localeService, options) {
|
|
23441
23471
|
return new DocumentSkeleton(docViewModel, localeService, options);
|
|
@@ -24861,11 +24891,13 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
24861
24891
|
if (!isHitTestAddressableGlyph(glyph)) continue;
|
|
24862
24892
|
const startX = divideLeft + glyph.left;
|
|
24863
24893
|
const endX = startX + glyph.width;
|
|
24894
|
+
const contentTop = startY + (line.marginTop ?? 0) + (line.paddingTop ?? 0);
|
|
24864
24895
|
const node = {
|
|
24865
24896
|
node: glyph,
|
|
24866
24897
|
...segment,
|
|
24867
24898
|
ratioX: x / (startX + endX),
|
|
24868
|
-
ratioY: y / (startY + endY)
|
|
24899
|
+
ratioY: y / (startY + endY),
|
|
24900
|
+
isInsideGlyph: x >= startX && x <= endX && y >= contentTop && y <= contentTop + line.contentHeight
|
|
24869
24901
|
};
|
|
24870
24902
|
if (sameLine && x >= startX && x <= endX) return node;
|
|
24871
24903
|
if (distanceY < nearestDistanceY) {
|
|
@@ -24916,7 +24948,8 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
24916
24948
|
node: glyph,
|
|
24917
24949
|
...segment,
|
|
24918
24950
|
ratioX: x / (startX + endX),
|
|
24919
|
-
ratioY: y / (startY + endY)
|
|
24951
|
+
ratioY: y / (startY + endY),
|
|
24952
|
+
isInsideGlyph: x >= startX && x <= endX && sameLine
|
|
24920
24953
|
};
|
|
24921
24954
|
const hitsGlyphAdvance = x >= startX && x <= endX;
|
|
24922
24955
|
if (sameLine) {
|
|
@@ -25486,6 +25519,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
25486
25519
|
const section = sections[sectionIndex];
|
|
25487
25520
|
const paragraphIndex = Math.max(0, (section === null || section === void 0 ? void 0 : section.children.findIndex(({ endIndex }) => endIndex === layoutAnchor)) ?? 0);
|
|
25488
25521
|
const processedBeforeSection = sections.slice(0, sectionIndex).reduce((count, item) => count + item.children.length, 0);
|
|
25522
|
+
rollbackSectionPages(layoutAnchor, ctx.skeleton.pages);
|
|
25489
25523
|
state.sectionIndex = sectionIndex;
|
|
25490
25524
|
state.paragraphIndex = paragraphIndex;
|
|
25491
25525
|
state.sectionInitialized = false;
|
|
@@ -25596,6 +25630,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
25596
25630
|
};
|
|
25597
25631
|
const { paragraphLineGapDefault = 0, defaultTabStop = 10.5, textStyle = {}, adjustLineHeightInTable = BooleanNumber.FALSE } = documentStyle;
|
|
25598
25632
|
const docsConfig = {
|
|
25633
|
+
lineGap: this._lineGap,
|
|
25599
25634
|
headerTreeMap,
|
|
25600
25635
|
footerTreeMap,
|
|
25601
25636
|
lists,
|
|
@@ -25891,7 +25926,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
25891
25926
|
};
|
|
25892
25927
|
|
|
25893
25928
|
//#endregion
|
|
25894
|
-
//#region \0@oxc-project+runtime@0.
|
|
25929
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
|
|
25895
25930
|
function __decorateParam(paramIndex, decorator) {
|
|
25896
25931
|
return function(target, key) {
|
|
25897
25932
|
decorator(target, key, paramIndex);
|
|
@@ -25899,7 +25934,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
25899
25934
|
}
|
|
25900
25935
|
|
|
25901
25936
|
//#endregion
|
|
25902
|
-
//#region \0@oxc-project+runtime@0.
|
|
25937
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
25903
25938
|
function __decorate(decorators, target, key, desc) {
|
|
25904
25939
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
25905
25940
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -26026,6 +26061,8 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
26026
26061
|
_defineProperty(this, "_gridlinesColor", void 0);
|
|
26027
26062
|
_defineProperty(this, "_defaultGridlinesColor", void 0);
|
|
26028
26063
|
_defineProperty(this, "_scene", null);
|
|
26064
|
+
_defineProperty(this, "textLineGap", void 0);
|
|
26065
|
+
this.textLineGap = _configService.getConfig(SHEET_TEXT_LINE_GAP) ?? 0;
|
|
26029
26066
|
const themeService = _injector.get(ThemeService);
|
|
26030
26067
|
this.disposeWithMe(themeService.currentTheme$.subscribe(() => {
|
|
26031
26068
|
var _this$_scene, _this$_scene2;
|
|
@@ -26356,7 +26393,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
26356
26393
|
const documentViewModel = new DocumentViewModel(documentModel);
|
|
26357
26394
|
const { vertexAngle: angle } = convertTextRotation(textRotation);
|
|
26358
26395
|
if (typeof colWidth === "number" && wrapStrategy === WrapStrategy.WRAP) documentModel.updateDocumentDataPageSize(colWidth);
|
|
26359
|
-
const documentSkeleton = DocumentSkeleton.create(documentViewModel, this._localeService);
|
|
26396
|
+
const documentSkeleton = DocumentSkeleton.create(documentViewModel, this._localeService, { lineGap: this.textLineGap });
|
|
26360
26397
|
documentSkeleton.calculate();
|
|
26361
26398
|
let { height: h = 0 } = getDocsSkeletonPageSize(documentSkeleton, angle) ?? {};
|
|
26362
26399
|
if (documentSkeleton) {
|
|
@@ -26374,7 +26411,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
26374
26411
|
const paddingTop = ((_style$pd3 = style.pd) === null || _style$pd3 === void 0 ? void 0 : _style$pd3.t) ?? DEFAULT_PADDING_DATA.t;
|
|
26375
26412
|
const paddingBottom = ((_style$pd4 = style.pd) === null || _style$pd4 === void 0 ? void 0 : _style$pd4.b) ?? DEFAULT_PADDING_DATA.b;
|
|
26376
26413
|
if ((style === null || style === void 0 ? void 0 : style.tb) === WrapStrategy.WRAP) {
|
|
26377
|
-
const skeleton = new DocSimpleSkeleton(getDisplayValueFromCell(cell), getFontStyleString(style).fontCache, (style === null || style === void 0 ? void 0 : style.tb) === WrapStrategy.WRAP, colWidth - paddingLeft - paddingRight, Infinity);
|
|
26414
|
+
const skeleton = new DocSimpleSkeleton(getDisplayValueFromCell(cell), getFontStyleString(style).fontCache, (style === null || style === void 0 ? void 0 : style.tb) === WrapStrategy.WRAP, colWidth - paddingLeft - paddingRight, Infinity, this.textLineGap);
|
|
26378
26415
|
skeleton.calculate();
|
|
26379
26416
|
return skeleton.getTotalHeight() + paddingTop + paddingBottom;
|
|
26380
26417
|
} else {
|
|
@@ -26490,7 +26527,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
26490
26527
|
const { vertexAngle: angle } = convertTextRotation(textRotation);
|
|
26491
26528
|
if ((style === null || style === void 0 ? void 0 : style.tb) === WrapStrategy.WRAP) documentModel.updateDocumentDataPageSize(currColWidth, Infinity);
|
|
26492
26529
|
else documentModel.updateDocumentDataPageSize(Infinity, Infinity);
|
|
26493
|
-
const documentSkeleton = DocumentSkeleton.create(documentViewModel, this._localeService);
|
|
26530
|
+
const documentSkeleton = DocumentSkeleton.create(documentViewModel, this._localeService, { lineGap: this.textLineGap });
|
|
26494
26531
|
documentSkeleton.calculate();
|
|
26495
26532
|
measuredWidth = (getDocsSkeletonPageSize(documentSkeleton, angle) ?? { width: 0 }).width;
|
|
26496
26533
|
if (documentSkeleton) {
|
|
@@ -26773,7 +26810,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
26773
26810
|
if (fontCache.documentSkeleton) {
|
|
26774
26811
|
const snapshot = fontCache.documentSkeleton.getViewModel().getDataModel().getSnapshot();
|
|
26775
26812
|
const documentModel = new DocumentDataModel(scaleDocumentDataForShrinkToFit(snapshot, scale, fallbackFontSize));
|
|
26776
|
-
const documentSkeleton = DocumentSkeleton.create(new DocumentViewModel(documentModel), this._localeService);
|
|
26813
|
+
const documentSkeleton = DocumentSkeleton.create(new DocumentViewModel(documentModel), this._localeService, { lineGap: this.textLineGap });
|
|
26777
26814
|
documentSkeleton.calculate();
|
|
26778
26815
|
fontCache.documentSkeleton = documentSkeleton;
|
|
26779
26816
|
} else fontCache.fontString = getFontStyleString({
|
|
@@ -26826,7 +26863,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
26826
26863
|
if (FULL_WIDTH_HORIZONTAL_ALIGNMENTS.has(horizontalAlign)) updateDocumentPageWidth(documentModel, this.getCellWithCoordByIndex(row, col, false));
|
|
26827
26864
|
const documentViewModel = new DocumentViewModel(documentModel);
|
|
26828
26865
|
if (documentViewModel) {
|
|
26829
|
-
const documentSkeleton = DocumentSkeleton.create(documentViewModel, this._localeService);
|
|
26866
|
+
const documentSkeleton = DocumentSkeleton.create(documentViewModel, this._localeService, { lineGap: this.textLineGap });
|
|
26830
26867
|
documentSkeleton.calculate();
|
|
26831
26868
|
config = {
|
|
26832
26869
|
documentSkeleton,
|
|
@@ -27290,7 +27327,7 @@ var Font = class extends SheetExtension {
|
|
|
27290
27327
|
this._clipByRenderBounds(renderFontCtx, row, col);
|
|
27291
27328
|
ctx.translate(renderFontCtx.startX + FIX_ONE_PIXEL_BLUR_OFFSET, renderFontCtx.startY + FIX_ONE_PIXEL_BLUR_OFFSET);
|
|
27292
27329
|
if (fontCache.documentSkeleton) this._renderDocuments(ctx, row, col, renderFontCtx, spreadsheetSkeleton.overflowCache);
|
|
27293
|
-
else this._renderText(ctx,
|
|
27330
|
+
else this._renderText(ctx, renderFontCtx);
|
|
27294
27331
|
ctx.restore();
|
|
27295
27332
|
if (fontCache.documentSkeleton) {
|
|
27296
27333
|
var _documentDataModel$ge;
|
|
@@ -27385,7 +27422,7 @@ var Font = class extends SheetExtension {
|
|
|
27385
27422
|
if (image.getAttribute("data-error") === "true") this._drawFallbackImage(ctx, -rotatedWidth / 2, -rotatedHeight / 2, width, height);
|
|
27386
27423
|
else try {
|
|
27387
27424
|
ctx.drawImage(image, -rotatedWidth / 2, -rotatedHeight / 2, width, height);
|
|
27388
|
-
} catch
|
|
27425
|
+
} catch {
|
|
27389
27426
|
this._drawFallbackImage(ctx, -rotatedWidth / 2, -rotatedHeight / 2, width, height);
|
|
27390
27427
|
}
|
|
27391
27428
|
ctx.restore();
|
|
@@ -27398,7 +27435,7 @@ var Font = class extends SheetExtension {
|
|
|
27398
27435
|
* @param renderFontContext
|
|
27399
27436
|
* @param row
|
|
27400
27437
|
* @param col
|
|
27401
|
-
* @param
|
|
27438
|
+
* @param padding
|
|
27402
27439
|
*/
|
|
27403
27440
|
_clipByRenderBounds(renderFontContext, row, col, padding = 0) {
|
|
27404
27441
|
var _fontCache$cellData3, _fontCache$cellData4;
|
|
@@ -27442,7 +27479,7 @@ var Font = class extends SheetExtension {
|
|
|
27442
27479
|
renderFontContext.endX = endX;
|
|
27443
27480
|
renderFontContext.endY = endY;
|
|
27444
27481
|
}
|
|
27445
|
-
_renderText(ctx,
|
|
27482
|
+
_renderText(ctx, renderFontCtx) {
|
|
27446
27483
|
var _fontCache$style5, _fontCache$style6, _fontCache$style7, _fontCache$style8, _fontCache$style9;
|
|
27447
27484
|
const { fontCache } = renderFontCtx;
|
|
27448
27485
|
if (!fontCache) return;
|
|
@@ -27462,6 +27499,7 @@ var Font = class extends SheetExtension {
|
|
|
27462
27499
|
text,
|
|
27463
27500
|
fontStyle: fontCache.fontString,
|
|
27464
27501
|
warp: wrapStrategy === WrapStrategy.WRAP && vertexAngle === 0,
|
|
27502
|
+
lineGap: renderFontCtx.spreadsheetSkeleton.textLineGap,
|
|
27465
27503
|
hAlign,
|
|
27466
27504
|
vAlign: fontCache.verticalAlign,
|
|
27467
27505
|
width: cellWidth,
|
|
@@ -27885,6 +27923,290 @@ var SpreadsheetRowHeader = class extends SpreadsheetHeader {
|
|
|
27885
27923
|
}
|
|
27886
27924
|
};
|
|
27887
27925
|
|
|
27926
|
+
//#endregion
|
|
27927
|
+
//#region src/group.ts
|
|
27928
|
+
var Group = class extends BaseObject {
|
|
27929
|
+
constructor(key, ...objects) {
|
|
27930
|
+
super(key);
|
|
27931
|
+
_defineProperty(this, "_objects", []);
|
|
27932
|
+
_defineProperty(this, "_selfSizeMode", false);
|
|
27933
|
+
this.addObjects(...objects);
|
|
27934
|
+
}
|
|
27935
|
+
get classType() {
|
|
27936
|
+
return "Group";
|
|
27937
|
+
}
|
|
27938
|
+
set cursor(val) {
|
|
27939
|
+
this.setCursor(val);
|
|
27940
|
+
}
|
|
27941
|
+
getState() {
|
|
27942
|
+
if (this._selfSizeMode) return super.getState();
|
|
27943
|
+
return getGroupState(this.left, this.top, this._objects.map((o) => o.getState()));
|
|
27944
|
+
}
|
|
27945
|
+
get width() {
|
|
27946
|
+
if (this._selfSizeMode) return super.width;
|
|
27947
|
+
return this.getState().width || 0;
|
|
27948
|
+
}
|
|
27949
|
+
get height() {
|
|
27950
|
+
if (this._selfSizeMode) return super.height;
|
|
27951
|
+
return this.getState().height || 0;
|
|
27952
|
+
}
|
|
27953
|
+
set width(val) {
|
|
27954
|
+
if (this._selfSizeMode) {
|
|
27955
|
+
super.width = val;
|
|
27956
|
+
return;
|
|
27957
|
+
}
|
|
27958
|
+
const numDelta = val - this.width;
|
|
27959
|
+
this._objects.forEach((o) => {
|
|
27960
|
+
o.resize(o.width + numDelta);
|
|
27961
|
+
});
|
|
27962
|
+
}
|
|
27963
|
+
set height(val) {
|
|
27964
|
+
if (this._selfSizeMode) {
|
|
27965
|
+
super.height = val;
|
|
27966
|
+
return;
|
|
27967
|
+
}
|
|
27968
|
+
const numDelta = val - this.height;
|
|
27969
|
+
this._objects.forEach((o) => {
|
|
27970
|
+
o.resize(void 0, o.height + numDelta);
|
|
27971
|
+
});
|
|
27972
|
+
}
|
|
27973
|
+
get maxZIndex() {
|
|
27974
|
+
let maxZIndex = 0;
|
|
27975
|
+
for (const object of this._objects) maxZIndex = Math.max(maxZIndex, object.zIndex);
|
|
27976
|
+
return maxZIndex;
|
|
27977
|
+
}
|
|
27978
|
+
openSelfSizeMode() {
|
|
27979
|
+
this._selfSizeMode = true;
|
|
27980
|
+
}
|
|
27981
|
+
closeSelfSizeMode() {
|
|
27982
|
+
this._selfSizeMode = false;
|
|
27983
|
+
}
|
|
27984
|
+
reCalculateObjects() {
|
|
27985
|
+
if (this._selfSizeMode) return;
|
|
27986
|
+
const { left = 0, top = 0 } = this.getState();
|
|
27987
|
+
for (const object of this._objects) object.transformByState({
|
|
27988
|
+
left: object.left - left,
|
|
27989
|
+
top: object.top - top
|
|
27990
|
+
});
|
|
27991
|
+
this.transformByState({
|
|
27992
|
+
left,
|
|
27993
|
+
top
|
|
27994
|
+
});
|
|
27995
|
+
}
|
|
27996
|
+
addObjects(...objects) {
|
|
27997
|
+
for (const object of objects) this.addObject(object);
|
|
27998
|
+
}
|
|
27999
|
+
addObject(o) {
|
|
28000
|
+
let object = o;
|
|
28001
|
+
if (isString(o)) {
|
|
28002
|
+
const scene = this.getScene();
|
|
28003
|
+
object = scene === null || scene === void 0 ? void 0 : scene.getObject(o);
|
|
28004
|
+
if (!object) return;
|
|
28005
|
+
object.parent = this;
|
|
28006
|
+
object.isInGroup = true;
|
|
28007
|
+
object.groupKey = this.oKey;
|
|
28008
|
+
this._objects.push(object);
|
|
28009
|
+
} else {
|
|
28010
|
+
o.parent = this;
|
|
28011
|
+
o.isInGroup = true;
|
|
28012
|
+
o.groupKey = this.oKey;
|
|
28013
|
+
this._objects.push(o);
|
|
28014
|
+
}
|
|
28015
|
+
}
|
|
28016
|
+
removeObject(object) {
|
|
28017
|
+
const objects = this.getObjects();
|
|
28018
|
+
const objectsLength = objects.length;
|
|
28019
|
+
if (isString(object)) for (let i = 0; i < objectsLength; i++) {
|
|
28020
|
+
const o = objects[i];
|
|
28021
|
+
if (o.oKey === object) {
|
|
28022
|
+
objects.splice(i, 1);
|
|
28023
|
+
this.parent.removeObject(o);
|
|
28024
|
+
return;
|
|
28025
|
+
}
|
|
28026
|
+
}
|
|
28027
|
+
else for (let i = 0; i < objectsLength; i++) {
|
|
28028
|
+
const o = objects[i];
|
|
28029
|
+
if (o === object) {
|
|
28030
|
+
objects.splice(i, 1);
|
|
28031
|
+
this.parent.removeObject(o);
|
|
28032
|
+
return;
|
|
28033
|
+
}
|
|
28034
|
+
}
|
|
28035
|
+
}
|
|
28036
|
+
removeSelfObjectAndTransform(oKey, width, height, isTransform = false) {
|
|
28037
|
+
const objects = [...this.getObjects()];
|
|
28038
|
+
const objectsLength = objects.length;
|
|
28039
|
+
if (width == null) width = this.width;
|
|
28040
|
+
if (height == null) height = this.height;
|
|
28041
|
+
for (let i = 0; i < objectsLength; i++) {
|
|
28042
|
+
const o = objects[i];
|
|
28043
|
+
if (o.oKey === oKey) {
|
|
28044
|
+
objects.splice(i, 1);
|
|
28045
|
+
isTransform && this._transformObject(o, width, height);
|
|
28046
|
+
o.parent = this.parent;
|
|
28047
|
+
o.groupKey = void 0;
|
|
28048
|
+
o.isInGroup = false;
|
|
28049
|
+
this._objects = objects;
|
|
28050
|
+
return;
|
|
28051
|
+
}
|
|
28052
|
+
}
|
|
28053
|
+
}
|
|
28054
|
+
_transformObject(object, groupWidth, groupHeight) {
|
|
28055
|
+
const transform = transformObjectOutOfGroup(object.getState(), this.getState(), groupWidth, groupHeight);
|
|
28056
|
+
if (object.classType === "Group") object.transformByState({
|
|
28057
|
+
left: transform.left,
|
|
28058
|
+
top: transform.top
|
|
28059
|
+
});
|
|
28060
|
+
else object.transformByState(transform);
|
|
28061
|
+
}
|
|
28062
|
+
getObjectsByOrder() {
|
|
28063
|
+
const objects = [];
|
|
28064
|
+
this._objects.sort(sortRules);
|
|
28065
|
+
for (const o of this._objects) if (o.visible) objects.push(o);
|
|
28066
|
+
return objects;
|
|
28067
|
+
}
|
|
28068
|
+
getObjects() {
|
|
28069
|
+
return this._objects;
|
|
28070
|
+
}
|
|
28071
|
+
render(ctx, bounds) {
|
|
28072
|
+
ctx.save();
|
|
28073
|
+
const m = this.transform.getMatrix();
|
|
28074
|
+
ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
|
28075
|
+
const objects = this.getObjectsByOrder();
|
|
28076
|
+
for (let i = 0; i < objects.length; i++) objects[i].render(ctx, bounds);
|
|
28077
|
+
ctx.restore();
|
|
28078
|
+
}
|
|
28079
|
+
_clear() {
|
|
28080
|
+
this._objects = [];
|
|
28081
|
+
}
|
|
28082
|
+
dispose() {
|
|
28083
|
+
[...this.getObjects()].forEach((o) => {
|
|
28084
|
+
o.dispose();
|
|
28085
|
+
});
|
|
28086
|
+
this._clear();
|
|
28087
|
+
super.dispose();
|
|
28088
|
+
}
|
|
28089
|
+
};
|
|
28090
|
+
|
|
28091
|
+
//#endregion
|
|
28092
|
+
//#region src/drawing-group.ts
|
|
28093
|
+
var DrawingGroupObject = class extends Group {
|
|
28094
|
+
constructor(..._args) {
|
|
28095
|
+
super(..._args);
|
|
28096
|
+
_defineProperty(this, "_selfSizeMode", true);
|
|
28097
|
+
_defineProperty(this, "_baseBound", {
|
|
28098
|
+
left: 0,
|
|
28099
|
+
top: 0,
|
|
28100
|
+
width: 0,
|
|
28101
|
+
height: 0
|
|
28102
|
+
});
|
|
28103
|
+
_defineProperty(this, "_outerShadow", void 0);
|
|
28104
|
+
_defineProperty(this, "_glow", void 0);
|
|
28105
|
+
}
|
|
28106
|
+
setOuterShadow(shadow) {
|
|
28107
|
+
this._outerShadow = shadow;
|
|
28108
|
+
this.makeDirty(true);
|
|
28109
|
+
}
|
|
28110
|
+
setGlow(glow) {
|
|
28111
|
+
this._glow = glow;
|
|
28112
|
+
this.makeDirty(true);
|
|
28113
|
+
}
|
|
28114
|
+
/**
|
|
28115
|
+
* Set the baseBound (chOff/chExt in OOXML) for this group.
|
|
28116
|
+
* This defines the coordinate space of children within the group.
|
|
28117
|
+
* When set, the group automatically enters selfSizeMode so its dimensions
|
|
28118
|
+
* are tracked independently of children.
|
|
28119
|
+
*/
|
|
28120
|
+
setBaseBound(bound) {
|
|
28121
|
+
this._baseBound = { ...bound };
|
|
28122
|
+
}
|
|
28123
|
+
/**
|
|
28124
|
+
* Get the baseBound (chOff/chExt in OOXML) for this group.
|
|
28125
|
+
*/
|
|
28126
|
+
getBaseBound() {
|
|
28127
|
+
return { ...this._baseBound };
|
|
28128
|
+
}
|
|
28129
|
+
/**
|
|
28130
|
+
* Override ancestorTransform to use the same render transform as render(),
|
|
28131
|
+
* which uses [m[0], m[1], m[2], m[3], centerX, centerY] from realBound
|
|
28132
|
+
* instead of the standard transform translation.
|
|
28133
|
+
* This ensures children (e.g., Image.isHit) that compose with
|
|
28134
|
+
* parent.ancestorTransform get the correct coordinate space.
|
|
28135
|
+
*/
|
|
28136
|
+
get ancestorTransform() {
|
|
28137
|
+
const { left: realLeft, top: realTop, width: realWidth, height: realHeight } = this.getRealBound();
|
|
28138
|
+
const m = this.transform.getMatrix();
|
|
28139
|
+
const centerX = realLeft + realWidth / 2;
|
|
28140
|
+
const centerY = realTop + realHeight / 2;
|
|
28141
|
+
const renderTransform = new Transform([
|
|
28142
|
+
m[0],
|
|
28143
|
+
m[1],
|
|
28144
|
+
m[2],
|
|
28145
|
+
m[3],
|
|
28146
|
+
centerX,
|
|
28147
|
+
centerY
|
|
28148
|
+
]);
|
|
28149
|
+
const parent = this.getParent();
|
|
28150
|
+
if (this.isInGroup && (parent === null || parent === void 0 ? void 0 : parent.classType) === "Group") return parent.ancestorTransform.multiply(renderTransform);
|
|
28151
|
+
return renderTransform;
|
|
28152
|
+
}
|
|
28153
|
+
render(ctx, bounds) {
|
|
28154
|
+
const { left: realLeft, top: realTop, width: realWidth, height: realHeight } = this.getRealBound();
|
|
28155
|
+
ctx.save();
|
|
28156
|
+
const m = this.transform.getMatrix();
|
|
28157
|
+
const centerX = realLeft + realWidth / 2;
|
|
28158
|
+
const centerY = realTop + realHeight / 2;
|
|
28159
|
+
ctx.transform(m[0], m[1], m[2], m[3], centerX, centerY);
|
|
28160
|
+
const effectFilter = createDrawingEffectFilter(this._glow, void 0);
|
|
28161
|
+
if (effectFilter) ctx.filter = combineDrawingEffectFilter(ctx.filter, effectFilter);
|
|
28162
|
+
if (this._outerShadow) {
|
|
28163
|
+
ctx.shadowColor = this._outerShadow.shadowColor;
|
|
28164
|
+
ctx.shadowBlur = this._outerShadow.shadowBlur;
|
|
28165
|
+
ctx.shadowOffsetX = this._outerShadow.shadowOffsetX;
|
|
28166
|
+
ctx.shadowOffsetY = this._outerShadow.shadowOffsetY;
|
|
28167
|
+
}
|
|
28168
|
+
const objects = this.getObjectsByOrder();
|
|
28169
|
+
for (let i = 0; i < objects.length; i++) objects[i].render(ctx, bounds);
|
|
28170
|
+
ctx.restore();
|
|
28171
|
+
}
|
|
28172
|
+
addObjects(...objects) {
|
|
28173
|
+
for (const object of objects) this.addObject(object);
|
|
28174
|
+
}
|
|
28175
|
+
isHit(coord) {
|
|
28176
|
+
const { left: realLeft, top: realTop, width: realWidth, height: realHeight } = this.getRealBound();
|
|
28177
|
+
const m = this.transform.getMatrix();
|
|
28178
|
+
const centerX = realLeft + realWidth / 2;
|
|
28179
|
+
const centerY = realTop + realHeight / 2;
|
|
28180
|
+
const renderTransform = new Transform([
|
|
28181
|
+
m[0],
|
|
28182
|
+
m[1],
|
|
28183
|
+
m[2],
|
|
28184
|
+
m[3],
|
|
28185
|
+
centerX,
|
|
28186
|
+
centerY
|
|
28187
|
+
]);
|
|
28188
|
+
const parent = this.getParent();
|
|
28189
|
+
const oCoord = (this.isInGroup && (parent === null || parent === void 0 ? void 0 : parent.classType) === "Group" ? parent.ancestorTransform.multiply(renderTransform) : renderTransform).invert().applyPoint(coord);
|
|
28190
|
+
const halfWidth = realWidth / 2;
|
|
28191
|
+
const halfHeight = realHeight / 2;
|
|
28192
|
+
if (oCoord.x < -halfWidth || oCoord.x > halfWidth || oCoord.y < -halfHeight || oCoord.y > halfHeight) return false;
|
|
28193
|
+
const objects = this.getObjectsByOrder();
|
|
28194
|
+
for (let i = 0; i < objects.length; i++) if (objects[i].isHit(coord)) return true;
|
|
28195
|
+
return false;
|
|
28196
|
+
}
|
|
28197
|
+
dispose() {
|
|
28198
|
+
const objects = [...this.getObjects()];
|
|
28199
|
+
const scene = this.getScene();
|
|
28200
|
+
objects.forEach((o) => {
|
|
28201
|
+
o.dispose();
|
|
28202
|
+
scene === null || scene === void 0 || scene.removeObject(o);
|
|
28203
|
+
});
|
|
28204
|
+
this._objects = [];
|
|
28205
|
+
super.dispose();
|
|
28206
|
+
scene === null || scene === void 0 || scene.removeObject(this);
|
|
28207
|
+
}
|
|
28208
|
+
};
|
|
28209
|
+
|
|
27888
28210
|
//#endregion
|
|
27889
28211
|
//#region src/components/docs/doc-component.ts
|
|
27890
28212
|
var DocComponent = class extends RenderComponent {
|
|
@@ -28331,7 +28653,9 @@ var FontAndBaseLine = class extends docExtension {
|
|
|
28331
28653
|
const { ts: textStyle, content, fontStyle, bBox } = glyph;
|
|
28332
28654
|
const { spanPointWithFont = Vector2.create(0, 0) } = this.extensionOffset;
|
|
28333
28655
|
if (content == null) return;
|
|
28334
|
-
|
|
28656
|
+
const currentKerning = ctx.fontKerning;
|
|
28657
|
+
const fontKerning = (fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontKerning) ?? "auto";
|
|
28658
|
+
if (currentKerning != null && currentKerning !== fontKerning) ctx.fontKerning = fontKerning;
|
|
28335
28659
|
if (!textStyle) {
|
|
28336
28660
|
this._fillText(ctx, glyph, spanPointWithFont);
|
|
28337
28661
|
return;
|
|
@@ -29093,8 +29417,21 @@ var Documents = class Documents extends DocComponent {
|
|
|
29093
29417
|
return this.getScene().getEngine();
|
|
29094
29418
|
}
|
|
29095
29419
|
isHit(coord) {
|
|
29420
|
+
if (super.isHit(coord)) {
|
|
29421
|
+
var _this$getScene;
|
|
29422
|
+
const drawingHit = (_this$getScene = this.getScene()) === null || _this$getScene === void 0 ? void 0 : _this$getScene.getAllObjectsByOrderForPick().some((object) => (object.isDrawingObject || object instanceof DrawingGroupObject) && !object.isInGroup && object.visible && object.evented && object.isHit(coord));
|
|
29423
|
+
const skeleton = this.getSkeleton();
|
|
29424
|
+
if (drawingHit && skeleton) {
|
|
29425
|
+
const node = skeleton.findNodeByCoord(this.getInverseCoord(coord), this.pageLayoutType, this.pageMarginLeft, this.pageMarginTop);
|
|
29426
|
+
if (node === null || node === void 0 ? void 0 : node.isInsideGlyph) return true;
|
|
29427
|
+
return this._isHitTable(coord);
|
|
29428
|
+
}
|
|
29429
|
+
return true;
|
|
29430
|
+
}
|
|
29431
|
+
return this._isHitTable(coord);
|
|
29432
|
+
}
|
|
29433
|
+
_isHitTable(coord) {
|
|
29096
29434
|
var _this$getSkeleton;
|
|
29097
|
-
if (super.isHit(coord)) return true;
|
|
29098
29435
|
const skeletonData = (_this$getSkeleton = this.getSkeleton()) === null || _this$getSkeleton === void 0 ? void 0 : _this$getSkeleton.getSkeletonData();
|
|
29099
29436
|
if (!skeletonData) return false;
|
|
29100
29437
|
const localCoord = this.getInverseCoord(coord);
|
|
@@ -34402,290 +34739,6 @@ var CustomObject = class extends BaseObject {
|
|
|
34402
34739
|
}
|
|
34403
34740
|
};
|
|
34404
34741
|
|
|
34405
|
-
//#endregion
|
|
34406
|
-
//#region src/group.ts
|
|
34407
|
-
var Group = class extends BaseObject {
|
|
34408
|
-
constructor(key, ...objects) {
|
|
34409
|
-
super(key);
|
|
34410
|
-
_defineProperty(this, "_objects", []);
|
|
34411
|
-
_defineProperty(this, "_selfSizeMode", false);
|
|
34412
|
-
this.addObjects(...objects);
|
|
34413
|
-
}
|
|
34414
|
-
get classType() {
|
|
34415
|
-
return "Group";
|
|
34416
|
-
}
|
|
34417
|
-
set cursor(val) {
|
|
34418
|
-
this.setCursor(val);
|
|
34419
|
-
}
|
|
34420
|
-
getState() {
|
|
34421
|
-
if (this._selfSizeMode) return super.getState();
|
|
34422
|
-
return getGroupState(this.left, this.top, this._objects.map((o) => o.getState()));
|
|
34423
|
-
}
|
|
34424
|
-
get width() {
|
|
34425
|
-
if (this._selfSizeMode) return super.width;
|
|
34426
|
-
return this.getState().width || 0;
|
|
34427
|
-
}
|
|
34428
|
-
get height() {
|
|
34429
|
-
if (this._selfSizeMode) return super.height;
|
|
34430
|
-
return this.getState().height || 0;
|
|
34431
|
-
}
|
|
34432
|
-
set width(val) {
|
|
34433
|
-
if (this._selfSizeMode) {
|
|
34434
|
-
super.width = val;
|
|
34435
|
-
return;
|
|
34436
|
-
}
|
|
34437
|
-
const numDelta = val - this.width;
|
|
34438
|
-
this._objects.forEach((o) => {
|
|
34439
|
-
o.resize(o.width + numDelta);
|
|
34440
|
-
});
|
|
34441
|
-
}
|
|
34442
|
-
set height(val) {
|
|
34443
|
-
if (this._selfSizeMode) {
|
|
34444
|
-
super.height = val;
|
|
34445
|
-
return;
|
|
34446
|
-
}
|
|
34447
|
-
const numDelta = val - this.height;
|
|
34448
|
-
this._objects.forEach((o) => {
|
|
34449
|
-
o.resize(void 0, o.height + numDelta);
|
|
34450
|
-
});
|
|
34451
|
-
}
|
|
34452
|
-
get maxZIndex() {
|
|
34453
|
-
let maxZIndex = 0;
|
|
34454
|
-
for (const object of this._objects) maxZIndex = Math.max(maxZIndex, object.zIndex);
|
|
34455
|
-
return maxZIndex;
|
|
34456
|
-
}
|
|
34457
|
-
openSelfSizeMode() {
|
|
34458
|
-
this._selfSizeMode = true;
|
|
34459
|
-
}
|
|
34460
|
-
closeSelfSizeMode() {
|
|
34461
|
-
this._selfSizeMode = false;
|
|
34462
|
-
}
|
|
34463
|
-
reCalculateObjects() {
|
|
34464
|
-
if (this._selfSizeMode) return;
|
|
34465
|
-
const { left = 0, top = 0 } = this.getState();
|
|
34466
|
-
for (const object of this._objects) object.transformByState({
|
|
34467
|
-
left: object.left - left,
|
|
34468
|
-
top: object.top - top
|
|
34469
|
-
});
|
|
34470
|
-
this.transformByState({
|
|
34471
|
-
left,
|
|
34472
|
-
top
|
|
34473
|
-
});
|
|
34474
|
-
}
|
|
34475
|
-
addObjects(...objects) {
|
|
34476
|
-
for (const object of objects) this.addObject(object);
|
|
34477
|
-
}
|
|
34478
|
-
addObject(o) {
|
|
34479
|
-
let object = o;
|
|
34480
|
-
if (isString(o)) {
|
|
34481
|
-
const scene = this.getScene();
|
|
34482
|
-
object = scene === null || scene === void 0 ? void 0 : scene.getObject(o);
|
|
34483
|
-
if (!object) return;
|
|
34484
|
-
object.parent = this;
|
|
34485
|
-
object.isInGroup = true;
|
|
34486
|
-
object.groupKey = this.oKey;
|
|
34487
|
-
this._objects.push(object);
|
|
34488
|
-
} else {
|
|
34489
|
-
o.parent = this;
|
|
34490
|
-
o.isInGroup = true;
|
|
34491
|
-
o.groupKey = this.oKey;
|
|
34492
|
-
this._objects.push(o);
|
|
34493
|
-
}
|
|
34494
|
-
}
|
|
34495
|
-
removeObject(object) {
|
|
34496
|
-
const objects = this.getObjects();
|
|
34497
|
-
const objectsLength = objects.length;
|
|
34498
|
-
if (isString(object)) for (let i = 0; i < objectsLength; i++) {
|
|
34499
|
-
const o = objects[i];
|
|
34500
|
-
if (o.oKey === object) {
|
|
34501
|
-
objects.splice(i, 1);
|
|
34502
|
-
this.parent.removeObject(o);
|
|
34503
|
-
return;
|
|
34504
|
-
}
|
|
34505
|
-
}
|
|
34506
|
-
else for (let i = 0; i < objectsLength; i++) {
|
|
34507
|
-
const o = objects[i];
|
|
34508
|
-
if (o === object) {
|
|
34509
|
-
objects.splice(i, 1);
|
|
34510
|
-
this.parent.removeObject(o);
|
|
34511
|
-
return;
|
|
34512
|
-
}
|
|
34513
|
-
}
|
|
34514
|
-
}
|
|
34515
|
-
removeSelfObjectAndTransform(oKey, width, height, isTransform = false) {
|
|
34516
|
-
const objects = [...this.getObjects()];
|
|
34517
|
-
const objectsLength = objects.length;
|
|
34518
|
-
if (width == null) width = this.width;
|
|
34519
|
-
if (height == null) height = this.height;
|
|
34520
|
-
for (let i = 0; i < objectsLength; i++) {
|
|
34521
|
-
const o = objects[i];
|
|
34522
|
-
if (o.oKey === oKey) {
|
|
34523
|
-
objects.splice(i, 1);
|
|
34524
|
-
isTransform && this._transformObject(o, width, height);
|
|
34525
|
-
o.parent = this.parent;
|
|
34526
|
-
o.groupKey = void 0;
|
|
34527
|
-
o.isInGroup = false;
|
|
34528
|
-
this._objects = objects;
|
|
34529
|
-
return;
|
|
34530
|
-
}
|
|
34531
|
-
}
|
|
34532
|
-
}
|
|
34533
|
-
_transformObject(object, groupWidth, groupHeight) {
|
|
34534
|
-
const transform = transformObjectOutOfGroup(object.getState(), this.getState(), groupWidth, groupHeight);
|
|
34535
|
-
if (object.classType === "Group") object.transformByState({
|
|
34536
|
-
left: transform.left,
|
|
34537
|
-
top: transform.top
|
|
34538
|
-
});
|
|
34539
|
-
else object.transformByState(transform);
|
|
34540
|
-
}
|
|
34541
|
-
getObjectsByOrder() {
|
|
34542
|
-
const objects = [];
|
|
34543
|
-
this._objects.sort(sortRules);
|
|
34544
|
-
for (const o of this._objects) if (o.visible) objects.push(o);
|
|
34545
|
-
return objects;
|
|
34546
|
-
}
|
|
34547
|
-
getObjects() {
|
|
34548
|
-
return this._objects;
|
|
34549
|
-
}
|
|
34550
|
-
render(ctx, bounds) {
|
|
34551
|
-
ctx.save();
|
|
34552
|
-
const m = this.transform.getMatrix();
|
|
34553
|
-
ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
|
34554
|
-
const objects = this.getObjectsByOrder();
|
|
34555
|
-
for (let i = 0; i < objects.length; i++) objects[i].render(ctx, bounds);
|
|
34556
|
-
ctx.restore();
|
|
34557
|
-
}
|
|
34558
|
-
_clear() {
|
|
34559
|
-
this._objects = [];
|
|
34560
|
-
}
|
|
34561
|
-
dispose() {
|
|
34562
|
-
[...this.getObjects()].forEach((o) => {
|
|
34563
|
-
o.dispose();
|
|
34564
|
-
});
|
|
34565
|
-
this._clear();
|
|
34566
|
-
super.dispose();
|
|
34567
|
-
}
|
|
34568
|
-
};
|
|
34569
|
-
|
|
34570
|
-
//#endregion
|
|
34571
|
-
//#region src/drawing-group.ts
|
|
34572
|
-
var DrawingGroupObject = class extends Group {
|
|
34573
|
-
constructor(..._args) {
|
|
34574
|
-
super(..._args);
|
|
34575
|
-
_defineProperty(this, "_selfSizeMode", true);
|
|
34576
|
-
_defineProperty(this, "_baseBound", {
|
|
34577
|
-
left: 0,
|
|
34578
|
-
top: 0,
|
|
34579
|
-
width: 0,
|
|
34580
|
-
height: 0
|
|
34581
|
-
});
|
|
34582
|
-
_defineProperty(this, "_outerShadow", void 0);
|
|
34583
|
-
_defineProperty(this, "_glow", void 0);
|
|
34584
|
-
}
|
|
34585
|
-
setOuterShadow(shadow) {
|
|
34586
|
-
this._outerShadow = shadow;
|
|
34587
|
-
this.makeDirty(true);
|
|
34588
|
-
}
|
|
34589
|
-
setGlow(glow) {
|
|
34590
|
-
this._glow = glow;
|
|
34591
|
-
this.makeDirty(true);
|
|
34592
|
-
}
|
|
34593
|
-
/**
|
|
34594
|
-
* Set the baseBound (chOff/chExt in OOXML) for this group.
|
|
34595
|
-
* This defines the coordinate space of children within the group.
|
|
34596
|
-
* When set, the group automatically enters selfSizeMode so its dimensions
|
|
34597
|
-
* are tracked independently of children.
|
|
34598
|
-
*/
|
|
34599
|
-
setBaseBound(bound) {
|
|
34600
|
-
this._baseBound = { ...bound };
|
|
34601
|
-
}
|
|
34602
|
-
/**
|
|
34603
|
-
* Get the baseBound (chOff/chExt in OOXML) for this group.
|
|
34604
|
-
*/
|
|
34605
|
-
getBaseBound() {
|
|
34606
|
-
return { ...this._baseBound };
|
|
34607
|
-
}
|
|
34608
|
-
/**
|
|
34609
|
-
* Override ancestorTransform to use the same render transform as render(),
|
|
34610
|
-
* which uses [m[0], m[1], m[2], m[3], centerX, centerY] from realBound
|
|
34611
|
-
* instead of the standard transform translation.
|
|
34612
|
-
* This ensures children (e.g., Image.isHit) that compose with
|
|
34613
|
-
* parent.ancestorTransform get the correct coordinate space.
|
|
34614
|
-
*/
|
|
34615
|
-
get ancestorTransform() {
|
|
34616
|
-
const { left: realLeft, top: realTop, width: realWidth, height: realHeight } = this.getRealBound();
|
|
34617
|
-
const m = this.transform.getMatrix();
|
|
34618
|
-
const centerX = realLeft + realWidth / 2;
|
|
34619
|
-
const centerY = realTop + realHeight / 2;
|
|
34620
|
-
const renderTransform = new Transform([
|
|
34621
|
-
m[0],
|
|
34622
|
-
m[1],
|
|
34623
|
-
m[2],
|
|
34624
|
-
m[3],
|
|
34625
|
-
centerX,
|
|
34626
|
-
centerY
|
|
34627
|
-
]);
|
|
34628
|
-
const parent = this.getParent();
|
|
34629
|
-
if (this.isInGroup && (parent === null || parent === void 0 ? void 0 : parent.classType) === "Group") return parent.ancestorTransform.multiply(renderTransform);
|
|
34630
|
-
return renderTransform;
|
|
34631
|
-
}
|
|
34632
|
-
render(ctx, bounds) {
|
|
34633
|
-
const { left: realLeft, top: realTop, width: realWidth, height: realHeight } = this.getRealBound();
|
|
34634
|
-
ctx.save();
|
|
34635
|
-
const m = this.transform.getMatrix();
|
|
34636
|
-
const centerX = realLeft + realWidth / 2;
|
|
34637
|
-
const centerY = realTop + realHeight / 2;
|
|
34638
|
-
ctx.transform(m[0], m[1], m[2], m[3], centerX, centerY);
|
|
34639
|
-
const effectFilter = createDrawingEffectFilter(this._glow, void 0);
|
|
34640
|
-
if (effectFilter) ctx.filter = combineDrawingEffectFilter(ctx.filter, effectFilter);
|
|
34641
|
-
if (this._outerShadow) {
|
|
34642
|
-
ctx.shadowColor = this._outerShadow.shadowColor;
|
|
34643
|
-
ctx.shadowBlur = this._outerShadow.shadowBlur;
|
|
34644
|
-
ctx.shadowOffsetX = this._outerShadow.shadowOffsetX;
|
|
34645
|
-
ctx.shadowOffsetY = this._outerShadow.shadowOffsetY;
|
|
34646
|
-
}
|
|
34647
|
-
const objects = this.getObjectsByOrder();
|
|
34648
|
-
for (let i = 0; i < objects.length; i++) objects[i].render(ctx, bounds);
|
|
34649
|
-
ctx.restore();
|
|
34650
|
-
}
|
|
34651
|
-
addObjects(...objects) {
|
|
34652
|
-
for (const object of objects) this.addObject(object);
|
|
34653
|
-
}
|
|
34654
|
-
isHit(coord) {
|
|
34655
|
-
const { left: realLeft, top: realTop, width: realWidth, height: realHeight } = this.getRealBound();
|
|
34656
|
-
const m = this.transform.getMatrix();
|
|
34657
|
-
const centerX = realLeft + realWidth / 2;
|
|
34658
|
-
const centerY = realTop + realHeight / 2;
|
|
34659
|
-
const renderTransform = new Transform([
|
|
34660
|
-
m[0],
|
|
34661
|
-
m[1],
|
|
34662
|
-
m[2],
|
|
34663
|
-
m[3],
|
|
34664
|
-
centerX,
|
|
34665
|
-
centerY
|
|
34666
|
-
]);
|
|
34667
|
-
const parent = this.getParent();
|
|
34668
|
-
const oCoord = (this.isInGroup && (parent === null || parent === void 0 ? void 0 : parent.classType) === "Group" ? parent.ancestorTransform.multiply(renderTransform) : renderTransform).invert().applyPoint(coord);
|
|
34669
|
-
const halfWidth = realWidth / 2;
|
|
34670
|
-
const halfHeight = realHeight / 2;
|
|
34671
|
-
if (oCoord.x < -halfWidth || oCoord.x > halfWidth || oCoord.y < -halfHeight || oCoord.y > halfHeight) return false;
|
|
34672
|
-
const objects = this.getObjectsByOrder();
|
|
34673
|
-
for (let i = 0; i < objects.length; i++) if (objects[i].isHit(coord)) return true;
|
|
34674
|
-
return false;
|
|
34675
|
-
}
|
|
34676
|
-
dispose() {
|
|
34677
|
-
const objects = [...this.getObjects()];
|
|
34678
|
-
const scene = this.getScene();
|
|
34679
|
-
objects.forEach((o) => {
|
|
34680
|
-
o.dispose();
|
|
34681
|
-
scene === null || scene === void 0 || scene.removeObject(o);
|
|
34682
|
-
});
|
|
34683
|
-
this._objects = [];
|
|
34684
|
-
super.dispose();
|
|
34685
|
-
scene === null || scene === void 0 || scene.removeObject(this);
|
|
34686
|
-
}
|
|
34687
|
-
};
|
|
34688
|
-
|
|
34689
34742
|
//#endregion
|
|
34690
34743
|
//#region src/floating/util.ts
|
|
34691
34744
|
/**
|
|
@@ -35528,7 +35581,7 @@ Engine = __decorate([__decorateParam(2, ICanvasColorService)], Engine);
|
|
|
35528
35581
|
//#endregion
|
|
35529
35582
|
//#region package.json
|
|
35530
35583
|
var name = "@univerjs/engine-render";
|
|
35531
|
-
var version = "1.0
|
|
35584
|
+
var version = "1.1.0";
|
|
35532
35585
|
|
|
35533
35586
|
//#endregion
|
|
35534
35587
|
//#region src/config/config.ts
|
|
@@ -40414,7 +40467,8 @@ var DocumentLayoutSession = class extends Disposable {
|
|
|
40414
40467
|
})))]) : null,
|
|
40415
40468
|
drawingAnchor: complete ? [...skeletonData.drawingAnchor ?? []].map(([segmentId, anchors]) => [segmentId, [...anchors].map(([paragraphIndex, anchor]) => [paragraphIndex, {
|
|
40416
40469
|
paragraphIndex: anchor.paragraphIndex,
|
|
40417
|
-
top: anchor.top
|
|
40470
|
+
top: anchor.top,
|
|
40471
|
+
...anchor.left == null ? {} : { left: anchor.left }
|
|
40418
40472
|
}])]) : null
|
|
40419
40473
|
};
|
|
40420
40474
|
}
|