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