@univerjs/engine-render 0.4.0 → 0.4.1-experimental.20241022-507567a

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/es/index.js CHANGED
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
3
  var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
- import { Tools, DEFAULT_STYLES, FontStyleType, BaselineOffset, getCellInfoInMergeData, Rectangle, ColorKit, Disposable, EventSubject, checkParagraphHasIndentByStyle, DataStreamTreeTokenType, BorderStyleTypes, BooleanNumber, DisposableCollection, toDisposable, sortRules, Registry, Range, numberToABC, Inject, LocaleService, insertTextToContent, horizontalLineSegmentsSubtraction, deleteContent, DataStreamTreeNodeType, DocumentDataModel, GridType, BulletAlignment, PositionedObjectLayoutType, WrapTextType, ColumnSeparatorType, TableAlignmentType, ObjectRelativeFromV, TableTextWrapType, SpacingRule, CustomDecorationType, CustomRangeType, ObjectMatrix, SectionType, NumberUnitType, PageOrientType, HorizontalAlign, VerticalAlign, WrapStrategy, AlignTypeH, ObjectRelativeFromH, AlignTypeV, mergeWith, GlyphType as GlyphType$1, numberToListABC, PRESET_LIST_TYPE, searchArray, extractPureTextFromCell, CellValueType, isCellCoverable, isNullCell, getColorStyle, isWhiteColor, IContextService, BuildTextUtils, TextX, DEFAULT_EMPTY_DOCUMENT_VALUE, TextDecoration, COLORS, DocumentFlavor, requestImmediateMacroTask, MOVE_BUFFER_VALUE, sortRulesByDesc, Injector, isClassDependencyItem, createIdentifier, remove, UniverInstanceType, IUniverInstanceService, Plugin, IConfigService } from "@univerjs/core";
5
+ import { Tools, DEFAULT_STYLES, FontStyleType, BaselineOffset, getCellInfoInMergeData, Rectangle, ColorKit, Disposable, EventSubject, checkParagraphHasIndentByStyle, DataStreamTreeTokenType, BorderStyleTypes, BooleanNumber, DisposableCollection, toDisposable, sortRules, Registry, Range, numberToABC, Inject, LocaleService, insertTextToContent, horizontalLineSegmentsSubtraction, deleteContent, DataStreamTreeNodeType, DocumentDataModel, GridType, BulletAlignment, PositionedObjectLayoutType, WrapTextType, ColumnSeparatorType, TableAlignmentType, ObjectRelativeFromV, TableTextWrapType, SpacingRule, CustomDecorationType, CustomRangeType, ObjectMatrix, SectionType, NumberUnitType, DocumentFlavor, PageOrientType, HorizontalAlign, VerticalAlign, WrapStrategy, AlignTypeH, ObjectRelativeFromH, AlignTypeV, mergeWith, GlyphType as GlyphType$1, numberToListABC, PRESET_LIST_TYPE, searchArray, extractPureTextFromCell, CellValueType, isCellCoverable, isNullCell, getColorStyle, isWhiteColor, IContextService, BuildTextUtils, TextX, DEFAULT_EMPTY_DOCUMENT_VALUE, TextDecoration, COLORS, requestImmediateMacroTask, MOVE_BUFFER_VALUE, sortRulesByDesc, Injector, isClassDependencyItem, createIdentifier, remove, UniverInstanceType, IUniverInstanceService, Plugin, IConfigService } from "@univerjs/core";
6
6
  import { BehaviorSubject, Subject, startWith, distinctUntilChanged, Subscription, Observable, shareReplay } from "rxjs";
7
7
  var SHAPE_TYPE = /* @__PURE__ */ ((SHAPE_TYPE2) => (SHAPE_TYPE2.RECT = "rect", SHAPE_TYPE2.CIRCLE = "circle", SHAPE_TYPE2.PATH = "path", SHAPE_TYPE2))(SHAPE_TYPE || {}), LINK_VIEW_PORT_TYPE = /* @__PURE__ */ ((LINK_VIEW_PORT_TYPE2) => (LINK_VIEW_PORT_TYPE2[LINK_VIEW_PORT_TYPE2.XY = 0] = "XY", LINK_VIEW_PORT_TYPE2[LINK_VIEW_PORT_TYPE2.X = 1] = "X", LINK_VIEW_PORT_TYPE2[LINK_VIEW_PORT_TYPE2.Y = 2] = "Y", LINK_VIEW_PORT_TYPE2))(LINK_VIEW_PORT_TYPE || {});
8
8
  const MIDDLE_CELL_POS_MAGIC_NUMBER = 1, DEFAULT_FONTFACE_PLANE = '"Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif', DEFAULT_SKELETON_HEADER_FOOTER = {
@@ -3632,7 +3632,14 @@ const _UniverRenderingContext2D = class _UniverRenderingContext2D {
3632
3632
  __publicField(this, "_context");
3633
3633
  __publicField(this, "_systemType");
3634
3634
  __publicField(this, "_browserType");
3635
- this._context = context, this.canvas = context.canvas;
3635
+ __publicField(this, "_id");
3636
+ this.canvas = context.canvas, this._context = context;
3637
+ }
3638
+ getId() {
3639
+ return this._id;
3640
+ }
3641
+ setId(id) {
3642
+ this._id = id;
3636
3643
  }
3637
3644
  isContextLost() {
3638
3645
  return this._context.isContextLost();
@@ -3823,11 +3830,15 @@ const _UniverRenderingContext2D = class _UniverRenderingContext2D {
3823
3830
  set textBaseline(val) {
3824
3831
  this._context.textBaseline = val;
3825
3832
  }
3833
+ /**
3834
+ * Get scale from ctx.
3835
+ * DOMMatrix.a DOMMatrix.d would affect by ctx.rotate()
3836
+ */
3826
3837
  _getScale() {
3827
- const m = this._transformCache || this.getTransform();
3828
- return !this._transformCache && m && (this._transformCache = m), {
3829
- scaleX: m.a,
3830
- scaleY: m.d
3838
+ const transform = this.getTransform(), { a, b, c, d } = transform, scaleX = Math.sqrt(a * a + b * b), scaleY = Math.sqrt(c * c + d * d);
3839
+ return {
3840
+ scaleX,
3841
+ scaleY
3831
3842
  };
3832
3843
  }
3833
3844
  getScale() {
@@ -3850,7 +3861,7 @@ const _UniverRenderingContext2D = class _UniverRenderingContext2D {
3850
3861
  x = fixLineWidthByScale(x, scaleX), y = fixLineWidthByScale(y, scaleY), w = fixLineWidthByScale(w, scaleX), h = fixLineWidthByScale(h, scaleY), this.roundRect(x, y, w, h, radii);
3851
3862
  }
3852
3863
  getTransform() {
3853
- return this._context.getTransform();
3864
+ return this._transformCache || this._context.getTransform();
3854
3865
  }
3855
3866
  resetTransform() {
3856
3867
  this._transformCache = null, this._context.resetTransform();
@@ -4089,6 +4100,10 @@ const _UniverRenderingContext2D = class _UniverRenderingContext2D {
4089
4100
  const { scaleX, scaleY } = this._getScale();
4090
4101
  x = fixLineWidthByScale(x, scaleX), y = fixLineWidthByScale(y, scaleY), this.moveTo(x, y);
4091
4102
  }
4103
+ moveToByPrecisionLog(x, y) {
4104
+ const { scaleX, scaleY } = this._getScale(), afterX = fixLineWidthByScale(x, scaleX), afterY = fixLineWidthByScale(y, scaleY);
4105
+ this.moveTo(afterX, afterY);
4106
+ }
4092
4107
  /**
4093
4108
  * rect function.
4094
4109
  * @method
@@ -4130,7 +4145,7 @@ const _UniverRenderingContext2D = class _UniverRenderingContext2D {
4130
4145
  * @method
4131
4146
  */
4132
4147
  rotate(angle) {
4133
- this._context.rotate(angle);
4148
+ this._transformCache = null, this._context.rotate(angle);
4134
4149
  }
4135
4150
  /**
4136
4151
  * save function.
@@ -4144,7 +4159,7 @@ const _UniverRenderingContext2D = class _UniverRenderingContext2D {
4144
4159
  * @method
4145
4160
  */
4146
4161
  scale(x, y) {
4147
- this._context.scale(x, y);
4162
+ this._transformCache = null, this._context.scale(x, y);
4148
4163
  }
4149
4164
  /**
4150
4165
  * setLineDash function.
@@ -4190,20 +4205,21 @@ const _UniverRenderingContext2D = class _UniverRenderingContext2D {
4190
4205
  * @method
4191
4206
  */
4192
4207
  transform(a, b, c, d, e, f) {
4193
- this._context.transform(a, b, c, d, e, f), this._transformCache = null;
4208
+ this._transformCache = null, this._context.transform(a, b, c, d, e, f);
4194
4209
  }
4195
4210
  /**
4196
4211
  * translate function.
4197
4212
  * @method
4198
4213
  */
4199
4214
  translate(x, y) {
4200
- this._context.translate(x, y);
4215
+ this._transformCache = null, this._context.translate(x, y);
4201
4216
  }
4202
4217
  translateWithPrecision(x, y) {
4203
4218
  const { scaleX, scaleY } = this._getScale();
4204
- x = fixLineWidthByScale(x, scaleX), y = fixLineWidthByScale(y, scaleY), this._context.translate(x, y);
4219
+ x = fixLineWidthByScale(x, scaleX), y = fixLineWidthByScale(y, scaleY), this._transformCache = null, this._context.translate(x, y);
4205
4220
  }
4206
4221
  translateWithPrecisionRatio(x, y) {
4222
+ this._transformCache = null;
4207
4223
  const { scaleX, scaleY } = this._getScale();
4208
4224
  this._context.translate(x / scaleX, y / scaleY);
4209
4225
  }
@@ -4233,15 +4249,8 @@ const _UniverPrintingContext = class _UniverPrintingContext extends UniverRender
4233
4249
  super(...arguments);
4234
4250
  __publicField(this, "__mode", "printing");
4235
4251
  }
4236
- __getScale() {
4237
- const m = this.getTransform();
4238
- return {
4239
- scaleX: m.a,
4240
- scaleY: m.d
4241
- };
4242
- }
4243
4252
  clearRect(x, y, width, height) {
4244
- const { scaleX, scaleY } = this.__getScale();
4253
+ const { scaleX, scaleY } = this._getScale();
4245
4254
  x = fixLineWidthByScale(x, scaleX), y = fixLineWidthByScale(y, scaleY), width = fixLineWidthByScale(width, scaleX), height = fixLineWidthByScale(height, scaleY), this._context.save(), this._context.fillStyle = getColor([255, 255, 255]), this._context.fillRect(x, y, width, height), this._context.restore();
4246
4255
  }
4247
4256
  clearRectForTexture(x, y, width, height) {
@@ -7321,10 +7330,46 @@ const DEFAULT_SECTION_BREAK = {
7321
7330
  columnSeparatorType: ColumnSeparatorType.NONE,
7322
7331
  sectionType: SectionType.SECTION_TYPE_UNSPECIFIED,
7323
7332
  startIndex: 0
7324
- }, DEFAULT_PAGE_SIZE = { width: Number.POSITIVE_INFINITY, height: Number.POSITIVE_INFINITY };
7333
+ }, DEFAULT_PAGE_SIZE = { width: Number.POSITIVE_INFINITY, height: Number.POSITIVE_INFINITY }, DEFAULT_MODERN_DOCUMENT_STYLE = {
7334
+ pageNumberStart: 1,
7335
+ pageSize: {
7336
+ width: ptToPixel(595),
7337
+ height: Number.POSITIVE_INFINITY
7338
+ },
7339
+ marginTop: ptToPixel(50),
7340
+ marginBottom: ptToPixel(50),
7341
+ marginRight: ptToPixel(50),
7342
+ marginLeft: ptToPixel(50),
7343
+ renderConfig: {
7344
+ vertexAngle: 0,
7345
+ centerAngle: 0,
7346
+ background: {
7347
+ rgb: "#FFFFFF"
7348
+ }
7349
+ },
7350
+ defaultHeaderId: "",
7351
+ defaultFooterId: "",
7352
+ evenPageHeaderId: "",
7353
+ evenPageFooterId: "",
7354
+ firstPageHeaderId: "",
7355
+ firstPageFooterId: "",
7356
+ evenAndOddHeaders: BooleanNumber.FALSE,
7357
+ useFirstPageHeaderFooter: BooleanNumber.FALSE,
7358
+ marginHeader: 0,
7359
+ marginFooter: 0
7360
+ }, DEFAULT_MODERN_SECTION_BREAK = {
7361
+ columnProperties: [],
7362
+ columnSeparatorType: ColumnSeparatorType.NONE,
7363
+ sectionType: SectionType.SECTION_TYPE_UNSPECIFIED
7364
+ };
7325
7365
  function prepareSectionBreakConfig(ctx, nodeIndex) {
7326
7366
  var _a10;
7327
- const { viewModel, dataModel, docsConfig } = ctx, sectionNode = viewModel.children[nodeIndex], sectionBreak = viewModel.getSectionBreak(sectionNode.endIndex) || DEFAULT_SECTION_BREAK, { documentStyle } = dataModel, {
7367
+ const { viewModel, dataModel, docsConfig } = ctx, sectionNode = viewModel.children[nodeIndex];
7368
+ let { documentStyle } = dataModel;
7369
+ const { documentFlavor } = documentStyle;
7370
+ let sectionBreak = viewModel.getSectionBreak(sectionNode.endIndex) || DEFAULT_SECTION_BREAK;
7371
+ documentFlavor === DocumentFlavor.MODERN && (sectionBreak = Object.assign({}, sectionBreak, DEFAULT_MODERN_SECTION_BREAK), documentStyle = Object.assign({}, documentStyle, DEFAULT_MODERN_DOCUMENT_STYLE));
7372
+ const {
7328
7373
  pageNumberStart: global_pageNumberStart = 1,
7329
7374
  // pageNumberStart
7330
7375
  pageSize: global_pageSize = DEFAULT_PAGE_SIZE,
@@ -13826,7 +13871,7 @@ function compareFontInfoDistance(a, b) {
13826
13871
  __name(compareFontInfoDistance, "compareFontInfoDistance");
13827
13872
  async function checkLocalFontsPermission() {
13828
13873
  var _a10;
13829
- return typeof window > "u" ? void 0 : window.navigator == null || ((_a10 = window.navigator) == null ? void 0 : _a10.permissions) == null ? !1 : (await window.navigator.permissions.query({ name: "local-fonts" })).state === "granted";
13874
+ return typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope || typeof window > "u" ? void 0 : window.navigator == null || ((_a10 = window.navigator) == null ? void 0 : _a10.permissions) == null ? !1 : (await window.navigator.permissions.query({ name: "local-fonts" })).state === "granted";
13830
13875
  }
13831
13876
  __name(checkLocalFontsPermission, "checkLocalFontsPermission");
13832
13877
  const _FontLibrary = class _FontLibrary {
@@ -27952,11 +27997,11 @@ const UNIQUE_KEY = "DefaultDocsLineExtension", DOC_EXTENSION_Z_INDEX = 40, _Line
27952
27997
  }
27953
27998
  draw(ctx, parentScale, glyph) {
27954
27999
  var _a10;
27955
- const line2 = (_a10 = glyph.parent) == null ? void 0 : _a10.parent, { renderConfig } = this.extensionOffset, vertexAngle = (renderConfig == null ? void 0 : renderConfig.vertexAngle) || 0, drawStrikeAndUnderline = !(((renderConfig == null ? void 0 : renderConfig.centerAngle) || 0) === 0 && vertexAngle !== 0 && vertexAngle % 90 === 0), { ts: textStyle, bBox, content } = glyph;
28000
+ const line2 = (_a10 = glyph.parent) == null ? void 0 : _a10.parent, { ts: textStyle, bBox, content } = glyph;
27956
28001
  if (line2 == null || textStyle == null || content === "\r")
27957
28002
  return;
27958
28003
  const { asc, dsc } = line2, { sp: strikeoutPosition, spo, sbo, bd } = bBox, scale = getScale(parentScale), DELTA = 0.5, { ul: underline, st: strikethrough, ol: overline, va: baselineOffset, bbl: bottomBorderLine } = textStyle;
27959
- if (drawStrikeAndUnderline && underline) {
28004
+ if (underline) {
27960
28005
  const startY = asc + dsc;
27961
28006
  this._drawLine(ctx, glyph, underline, startY, scale);
27962
28007
  }
@@ -27964,7 +28009,7 @@ const UNIQUE_KEY = "DefaultDocsLineExtension", DOC_EXTENSION_Z_INDEX = 40, _Line
27964
28009
  const startY = asc + dsc + 3;
27965
28010
  this._drawLine(ctx, glyph, bottomBorderLine, startY, scale, 2);
27966
28011
  }
27967
- if (drawStrikeAndUnderline && strikethrough) {
28012
+ if (strikethrough) {
27968
28013
  let startY = asc + bd - strikeoutPosition - DELTA;
27969
28014
  baselineOffset === BaselineOffset.SUPERSCRIPT ? startY -= spo : baselineOffset === BaselineOffset.SUBSCRIPT && (startY += sbo), this._drawLine(ctx, glyph, strikethrough, startY, scale);
27970
28015
  }
@@ -27986,11 +28031,11 @@ const UNIQUE_KEY = "DefaultDocsLineExtension", DOC_EXTENSION_Z_INDEX = 40, _Line
27986
28031
  originTranslate = Vector2.create(0, 0),
27987
28032
  alignOffset = Vector2.create(0, 0),
27988
28033
  renderConfig = {}
27989
- } = this.extensionOffset, { left, width } = glyph, { centerAngle: centerAngleDeg = 0, vertexAngle: vertexAngleDeg = 0 } = renderConfig, centerAngle = degToRad(centerAngleDeg), vertexAngle = degToRad(vertexAngleDeg);
27990
- ctx.save(), ctx.translateWithPrecisionRatio(FIX_ONE_PIXEL_BLUR_OFFSET, FIX_ONE_PIXEL_BLUR_OFFSET);
28034
+ } = this.extensionOffset, { left, width } = glyph, { centerAngle: centerAngleDeg = 0, vertexAngle: vertexAngleDeg = 0 } = renderConfig;
28035
+ ctx.save();
27991
28036
  const color = (c === BooleanNumber.TRUE ? getColorStyle((_a10 = glyph.ts) == null ? void 0 : _a10.cl) : getColorStyle(colorStyle)) || COLOR_BLACK_RGB;
27992
28037
  ctx.strokeStyle = color, ctx.lineWidth = lineWidth, this._setLineType(ctx, lineType || TextDecoration.SINGLE);
27993
- const start = calculateRectRotate(
28038
+ const centerAngle = degToRad(centerAngleDeg), vertexAngle = degToRad(vertexAngleDeg), start = calculateRectRotate(
27994
28039
  originTranslate.addByPoint(left, startY),
27995
28040
  Vector2.create(0, 0),
27996
28041
  centerAngle,
@@ -28017,8 +28062,6 @@ const _Documents = class _Documents extends DocComponent {
28017
28062
  super(oKey, documentSkeleton, config);
28018
28063
  __publicField(this, "_pageRender$", new Subject());
28019
28064
  __publicField(this, "pageRender$", this._pageRender$.asObservable());
28020
- __publicField(this, "docsLeft", 0);
28021
- __publicField(this, "docsTop", 0);
28022
28065
  __publicField(this, "_drawLiquid", new Liquid());
28023
28066
  this._initialDefaultExtension(), this.makeDirty(!0);
28024
28067
  }
@@ -29122,7 +29165,9 @@ const PAGE_STROKE_COLOR = "rgba(198, 198, 198, 1)", PAGE_FILL_COLOR = "rgba(255,
29122
29165
  const skeletonData = (_a10 = this.getSkeleton()) == null ? void 0 : _a10.getSkeletonData(), docDataModel = (_b = this.getSkeleton()) == null ? void 0 : _b.getViewModel().getDataModel();
29123
29166
  if (skeletonData == null || docDataModel == null)
29124
29167
  return;
29125
- const documentFlavor = docDataModel.getSnapshot().documentStyle.documentFlavor;
29168
+ const { documentFlavor } = docDataModel.getSnapshot().documentStyle;
29169
+ if (documentFlavor !== DocumentFlavor.TRADITIONAL)
29170
+ return;
29126
29171
  this._drawLiquid.reset();
29127
29172
  const { pages } = skeletonData;
29128
29173
  let pageTop = 0, pageLeft = 0;
@@ -29148,51 +29193,49 @@ const PAGE_STROKE_COLOR = "rgba(198, 198, 198, 1)", PAGE_FILL_COLOR = "rgba(255,
29148
29193
  fill: PAGE_FILL_COLOR,
29149
29194
  zIndex: 3
29150
29195
  };
29151
- if (Rect.drawWith(ctx, backgroundOptions), documentFlavor === DocumentFlavor.TRADITIONAL) {
29152
- const marginIdentification = {
29153
- dataArray: [{
29154
- command: "M",
29155
- points: [marginLeft - 15, originMarginTop]
29156
- }, {
29157
- command: "L",
29158
- points: [marginLeft, originMarginTop]
29159
- }, {
29160
- command: "L",
29161
- points: [marginLeft, originMarginTop - 15]
29162
- }, {
29163
- command: "M",
29164
- points: [pageWidth - marginRight + 15, originMarginTop]
29165
- }, {
29166
- command: "L",
29167
- points: [pageWidth - marginRight, originMarginTop]
29168
- }, {
29169
- command: "L",
29170
- points: [pageWidth - marginRight, originMarginTop - 15]
29171
- }, {
29172
- command: "M",
29173
- points: [marginLeft - 15, pageHeight - originMarginBottom]
29174
- }, {
29175
- command: "L",
29176
- points: [marginLeft, pageHeight - originMarginBottom]
29177
- }, {
29178
- command: "L",
29179
- points: [marginLeft, pageHeight - originMarginBottom + 15]
29180
- }, {
29181
- command: "M",
29182
- points: [pageWidth - marginRight + 15, pageHeight - originMarginBottom]
29183
- }, {
29184
- command: "L",
29185
- points: [pageWidth - marginRight, pageHeight - originMarginBottom]
29186
- }, {
29187
- command: "L",
29188
- points: [pageWidth - marginRight, pageHeight - originMarginBottom + 15]
29189
- }],
29190
- strokeWidth: 1.5,
29191
- stroke: MARGIN_STROKE_COLOR
29192
- };
29193
- Path.drawWith(ctx, marginIdentification);
29194
- }
29195
- ctx.restore();
29196
+ Rect.drawWith(ctx, backgroundOptions);
29197
+ const IDENTIFIER_WIDTH = 15, marginIdentification = {
29198
+ dataArray: [{
29199
+ command: "M",
29200
+ points: [marginLeft - IDENTIFIER_WIDTH, originMarginTop]
29201
+ }, {
29202
+ command: "L",
29203
+ points: [marginLeft, originMarginTop]
29204
+ }, {
29205
+ command: "L",
29206
+ points: [marginLeft, originMarginTop - IDENTIFIER_WIDTH]
29207
+ }, {
29208
+ command: "M",
29209
+ points: [pageWidth - marginRight + IDENTIFIER_WIDTH, originMarginTop]
29210
+ }, {
29211
+ command: "L",
29212
+ points: [pageWidth - marginRight, originMarginTop]
29213
+ }, {
29214
+ command: "L",
29215
+ points: [pageWidth - marginRight, originMarginTop - IDENTIFIER_WIDTH]
29216
+ }, {
29217
+ command: "M",
29218
+ points: [marginLeft - IDENTIFIER_WIDTH, pageHeight - originMarginBottom]
29219
+ }, {
29220
+ command: "L",
29221
+ points: [marginLeft, pageHeight - originMarginBottom]
29222
+ }, {
29223
+ command: "L",
29224
+ points: [marginLeft, pageHeight - originMarginBottom + IDENTIFIER_WIDTH]
29225
+ }, {
29226
+ command: "M",
29227
+ points: [pageWidth - marginRight + IDENTIFIER_WIDTH, pageHeight - originMarginBottom]
29228
+ }, {
29229
+ command: "L",
29230
+ points: [pageWidth - marginRight, pageHeight - originMarginBottom]
29231
+ }, {
29232
+ command: "L",
29233
+ points: [pageWidth - marginRight, pageHeight - originMarginBottom + IDENTIFIER_WIDTH]
29234
+ }],
29235
+ strokeWidth: 1.5,
29236
+ stroke: MARGIN_STROKE_COLOR
29237
+ };
29238
+ Path.drawWith(ctx, marginIdentification), ctx.restore();
29196
29239
  const { x, y } = this._drawLiquid.translatePage(
29197
29240
  page,
29198
29241
  this.pageLayoutType,
@@ -19,8 +19,6 @@ export interface IDocumentOffsetConfig extends IPageMarginLayout {
19
19
  export declare class Documents extends DocComponent {
20
20
  private readonly _pageRender$;
21
21
  readonly pageRender$: import('rxjs').Observable<IPageRenderConfig>;
22
- docsLeft: number;
23
- docsTop: number;
24
22
  private _drawLiquid;
25
23
  constructor(oKey: string, documentSkeleton?: DocumentSkeleton, config?: IDocumentsConfig);
26
24
  static create(oKey: string, documentSkeleton?: DocumentSkeleton, config?: IDocumentsConfig): Documents;
@@ -23,6 +23,9 @@ export declare class UniverRenderingContext2D implements CanvasRenderingContext2
23
23
  private _systemType;
24
24
  private _browserType;
25
25
  constructor(context: CanvasRenderingContext2D);
26
+ private _id;
27
+ getId(): string;
28
+ setId(id: string): void;
26
29
  isContextLost(): boolean;
27
30
  get globalAlpha(): number;
28
31
  set globalAlpha(val: number);
@@ -77,7 +80,14 @@ export declare class UniverRenderingContext2D implements CanvasRenderingContext2
77
80
  set textAlign(val: CanvasTextAlign);
78
81
  get textBaseline(): CanvasTextBaseline;
79
82
  set textBaseline(val: CanvasTextBaseline);
80
- private _getScale;
83
+ /**
84
+ * Get scale from ctx.
85
+ * DOMMatrix.a DOMMatrix.d would affect by ctx.rotate()
86
+ */
87
+ protected _getScale(): {
88
+ scaleX: number;
89
+ scaleY: number;
90
+ };
81
91
  getScale(): {
82
92
  scaleX: number;
83
93
  scaleY: number;
@@ -266,6 +276,7 @@ export declare class UniverRenderingContext2D implements CanvasRenderingContext2
266
276
  * @method
267
277
  */
268
278
  moveToByPrecision(x: number, y: number): void;
279
+ moveToByPrecisionLog(x: number, y: number): void;
269
280
  /**
270
281
  * rect function.
271
282
  * @method
@@ -366,7 +377,6 @@ export declare class UniverRenderingContext extends UniverRenderingContext2D {
366
377
  }
367
378
  export declare class UniverPrintingContext extends UniverRenderingContext2D {
368
379
  __mode: string;
369
- private __getScale;
370
380
  clearRect(x: number, y: number, width: number, height: number): void;
371
381
  clearRectForTexture(x: number, y: number, width: number, height: number): void;
372
382
  setGlobalCompositeOperation(val: GlobalCompositeOperation): void;
@@ -1,7 +1,7 @@
1
- import { Disposable } from '@univerjs/core';
2
- import { BaseObject } from './base-object';
3
1
  import { UniverRenderingContext } from './context';
4
2
  import { Scene } from './scene';
3
+ import { Disposable } from '@univerjs/core';
4
+ import { BaseObject } from './base-object';
5
5
  export declare class Layer extends Disposable {
6
6
  private _scene;
7
7
  private _zIndex;