@univerjs/engine-render 0.4.0 → 0.4.1-nightly.202410201605
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 +1 -1
- package/lib/es/index.js +112 -76
- package/lib/types/components/docs/document.d.ts +0 -2
- package/lib/types/context.d.ts +9 -2
- package/lib/types/layer.d.ts +2 -2
- package/lib/umd/index.js +1 -1
- package/package.json +3 -3
- package/LICENSE +0 -176
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,
|
|
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,7 @@ const _UniverRenderingContext2D = class _UniverRenderingContext2D {
|
|
|
3632
3632
|
__publicField(this, "_context");
|
|
3633
3633
|
__publicField(this, "_systemType");
|
|
3634
3634
|
__publicField(this, "_browserType");
|
|
3635
|
-
this.
|
|
3635
|
+
this.canvas = context.canvas, this._context = context;
|
|
3636
3636
|
}
|
|
3637
3637
|
isContextLost() {
|
|
3638
3638
|
return this._context.isContextLost();
|
|
@@ -3823,11 +3823,15 @@ const _UniverRenderingContext2D = class _UniverRenderingContext2D {
|
|
|
3823
3823
|
set textBaseline(val) {
|
|
3824
3824
|
this._context.textBaseline = val;
|
|
3825
3825
|
}
|
|
3826
|
+
/**
|
|
3827
|
+
* Get scale from ctx.
|
|
3828
|
+
* DOMMatrix.a DOMMatrix.d would affect by ctx.rotate()
|
|
3829
|
+
*/
|
|
3826
3830
|
_getScale() {
|
|
3827
|
-
const
|
|
3828
|
-
return
|
|
3829
|
-
scaleX
|
|
3830
|
-
scaleY
|
|
3831
|
+
const transform = this.getTransform(), { a, b, c, d } = transform, scaleX = Math.sqrt(a * a + b * b), scaleY = Math.sqrt(c * c + d * d);
|
|
3832
|
+
return {
|
|
3833
|
+
scaleX,
|
|
3834
|
+
scaleY
|
|
3831
3835
|
};
|
|
3832
3836
|
}
|
|
3833
3837
|
getScale() {
|
|
@@ -3850,7 +3854,7 @@ const _UniverRenderingContext2D = class _UniverRenderingContext2D {
|
|
|
3850
3854
|
x = fixLineWidthByScale(x, scaleX), y = fixLineWidthByScale(y, scaleY), w = fixLineWidthByScale(w, scaleX), h = fixLineWidthByScale(h, scaleY), this.roundRect(x, y, w, h, radii);
|
|
3851
3855
|
}
|
|
3852
3856
|
getTransform() {
|
|
3853
|
-
return this._context.getTransform();
|
|
3857
|
+
return this._transformCache || this._context.getTransform();
|
|
3854
3858
|
}
|
|
3855
3859
|
resetTransform() {
|
|
3856
3860
|
this._transformCache = null, this._context.resetTransform();
|
|
@@ -4089,6 +4093,10 @@ const _UniverRenderingContext2D = class _UniverRenderingContext2D {
|
|
|
4089
4093
|
const { scaleX, scaleY } = this._getScale();
|
|
4090
4094
|
x = fixLineWidthByScale(x, scaleX), y = fixLineWidthByScale(y, scaleY), this.moveTo(x, y);
|
|
4091
4095
|
}
|
|
4096
|
+
moveToByPrecisionLog(x, y) {
|
|
4097
|
+
const { scaleX, scaleY } = this._getScale(), afterX = fixLineWidthByScale(x, scaleX), afterY = fixLineWidthByScale(y, scaleY);
|
|
4098
|
+
this.moveTo(afterX, afterY);
|
|
4099
|
+
}
|
|
4092
4100
|
/**
|
|
4093
4101
|
* rect function.
|
|
4094
4102
|
* @method
|
|
@@ -4130,7 +4138,7 @@ const _UniverRenderingContext2D = class _UniverRenderingContext2D {
|
|
|
4130
4138
|
* @method
|
|
4131
4139
|
*/
|
|
4132
4140
|
rotate(angle) {
|
|
4133
|
-
this._context.rotate(angle);
|
|
4141
|
+
this._transformCache = null, this._context.rotate(angle);
|
|
4134
4142
|
}
|
|
4135
4143
|
/**
|
|
4136
4144
|
* save function.
|
|
@@ -4144,7 +4152,7 @@ const _UniverRenderingContext2D = class _UniverRenderingContext2D {
|
|
|
4144
4152
|
* @method
|
|
4145
4153
|
*/
|
|
4146
4154
|
scale(x, y) {
|
|
4147
|
-
this._context.scale(x, y);
|
|
4155
|
+
this._transformCache = null, this._context.scale(x, y);
|
|
4148
4156
|
}
|
|
4149
4157
|
/**
|
|
4150
4158
|
* setLineDash function.
|
|
@@ -4190,20 +4198,21 @@ const _UniverRenderingContext2D = class _UniverRenderingContext2D {
|
|
|
4190
4198
|
* @method
|
|
4191
4199
|
*/
|
|
4192
4200
|
transform(a, b, c, d, e, f) {
|
|
4193
|
-
this._context.transform(a, b, c, d, e, f)
|
|
4201
|
+
this._transformCache = null, this._context.transform(a, b, c, d, e, f);
|
|
4194
4202
|
}
|
|
4195
4203
|
/**
|
|
4196
4204
|
* translate function.
|
|
4197
4205
|
* @method
|
|
4198
4206
|
*/
|
|
4199
4207
|
translate(x, y) {
|
|
4200
|
-
this._context.translate(x, y);
|
|
4208
|
+
this._transformCache = null, this._context.translate(x, y);
|
|
4201
4209
|
}
|
|
4202
4210
|
translateWithPrecision(x, y) {
|
|
4203
4211
|
const { scaleX, scaleY } = this._getScale();
|
|
4204
|
-
x = fixLineWidthByScale(x, scaleX), y = fixLineWidthByScale(y, scaleY), this._context.translate(x, y);
|
|
4212
|
+
x = fixLineWidthByScale(x, scaleX), y = fixLineWidthByScale(y, scaleY), this._transformCache = null, this._context.translate(x, y);
|
|
4205
4213
|
}
|
|
4206
4214
|
translateWithPrecisionRatio(x, y) {
|
|
4215
|
+
this._transformCache = null;
|
|
4207
4216
|
const { scaleX, scaleY } = this._getScale();
|
|
4208
4217
|
this._context.translate(x / scaleX, y / scaleY);
|
|
4209
4218
|
}
|
|
@@ -4233,15 +4242,8 @@ const _UniverPrintingContext = class _UniverPrintingContext extends UniverRender
|
|
|
4233
4242
|
super(...arguments);
|
|
4234
4243
|
__publicField(this, "__mode", "printing");
|
|
4235
4244
|
}
|
|
4236
|
-
__getScale() {
|
|
4237
|
-
const m = this.getTransform();
|
|
4238
|
-
return {
|
|
4239
|
-
scaleX: m.a,
|
|
4240
|
-
scaleY: m.d
|
|
4241
|
-
};
|
|
4242
|
-
}
|
|
4243
4245
|
clearRect(x, y, width, height) {
|
|
4244
|
-
const { scaleX, scaleY } = this.
|
|
4246
|
+
const { scaleX, scaleY } = this._getScale();
|
|
4245
4247
|
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
4248
|
}
|
|
4247
4249
|
clearRectForTexture(x, y, width, height) {
|
|
@@ -7321,10 +7323,46 @@ const DEFAULT_SECTION_BREAK = {
|
|
|
7321
7323
|
columnSeparatorType: ColumnSeparatorType.NONE,
|
|
7322
7324
|
sectionType: SectionType.SECTION_TYPE_UNSPECIFIED,
|
|
7323
7325
|
startIndex: 0
|
|
7324
|
-
}, DEFAULT_PAGE_SIZE = { width: Number.POSITIVE_INFINITY, height: Number.POSITIVE_INFINITY }
|
|
7326
|
+
}, DEFAULT_PAGE_SIZE = { width: Number.POSITIVE_INFINITY, height: Number.POSITIVE_INFINITY }, DEFAULT_MODERN_DOCUMENT_STYLE = {
|
|
7327
|
+
pageNumberStart: 1,
|
|
7328
|
+
pageSize: {
|
|
7329
|
+
width: ptToPixel(595),
|
|
7330
|
+
height: Number.POSITIVE_INFINITY
|
|
7331
|
+
},
|
|
7332
|
+
marginTop: ptToPixel(50),
|
|
7333
|
+
marginBottom: ptToPixel(50),
|
|
7334
|
+
marginRight: ptToPixel(50),
|
|
7335
|
+
marginLeft: ptToPixel(50),
|
|
7336
|
+
renderConfig: {
|
|
7337
|
+
vertexAngle: 0,
|
|
7338
|
+
centerAngle: 0,
|
|
7339
|
+
background: {
|
|
7340
|
+
rgb: "#FFFFFF"
|
|
7341
|
+
}
|
|
7342
|
+
},
|
|
7343
|
+
defaultHeaderId: "",
|
|
7344
|
+
defaultFooterId: "",
|
|
7345
|
+
evenPageHeaderId: "",
|
|
7346
|
+
evenPageFooterId: "",
|
|
7347
|
+
firstPageHeaderId: "",
|
|
7348
|
+
firstPageFooterId: "",
|
|
7349
|
+
evenAndOddHeaders: BooleanNumber.FALSE,
|
|
7350
|
+
useFirstPageHeaderFooter: BooleanNumber.FALSE,
|
|
7351
|
+
marginHeader: 0,
|
|
7352
|
+
marginFooter: 0
|
|
7353
|
+
}, DEFAULT_MODERN_SECTION_BREAK = {
|
|
7354
|
+
columnProperties: [],
|
|
7355
|
+
columnSeparatorType: ColumnSeparatorType.NONE,
|
|
7356
|
+
sectionType: SectionType.SECTION_TYPE_UNSPECIFIED
|
|
7357
|
+
};
|
|
7325
7358
|
function prepareSectionBreakConfig(ctx, nodeIndex) {
|
|
7326
7359
|
var _a10;
|
|
7327
|
-
const { viewModel, dataModel, docsConfig } = ctx, sectionNode = viewModel.children[nodeIndex]
|
|
7360
|
+
const { viewModel, dataModel, docsConfig } = ctx, sectionNode = viewModel.children[nodeIndex];
|
|
7361
|
+
let { documentStyle } = dataModel;
|
|
7362
|
+
const { documentFlavor } = documentStyle;
|
|
7363
|
+
let sectionBreak = viewModel.getSectionBreak(sectionNode.endIndex) || DEFAULT_SECTION_BREAK;
|
|
7364
|
+
documentFlavor === DocumentFlavor.MODERN && (sectionBreak = Object.assign({}, sectionBreak, DEFAULT_MODERN_SECTION_BREAK), documentStyle = Object.assign({}, documentStyle, DEFAULT_MODERN_DOCUMENT_STYLE));
|
|
7365
|
+
const {
|
|
7328
7366
|
pageNumberStart: global_pageNumberStart = 1,
|
|
7329
7367
|
// pageNumberStart
|
|
7330
7368
|
pageSize: global_pageSize = DEFAULT_PAGE_SIZE,
|
|
@@ -27952,11 +27990,11 @@ const UNIQUE_KEY = "DefaultDocsLineExtension", DOC_EXTENSION_Z_INDEX = 40, _Line
|
|
|
27952
27990
|
}
|
|
27953
27991
|
draw(ctx, parentScale, glyph) {
|
|
27954
27992
|
var _a10;
|
|
27955
|
-
const line2 = (_a10 = glyph.parent) == null ? void 0 : _a10.parent, {
|
|
27993
|
+
const line2 = (_a10 = glyph.parent) == null ? void 0 : _a10.parent, { ts: textStyle, bBox, content } = glyph;
|
|
27956
27994
|
if (line2 == null || textStyle == null || content === "\r")
|
|
27957
27995
|
return;
|
|
27958
27996
|
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 (
|
|
27997
|
+
if (underline) {
|
|
27960
27998
|
const startY = asc + dsc;
|
|
27961
27999
|
this._drawLine(ctx, glyph, underline, startY, scale);
|
|
27962
28000
|
}
|
|
@@ -27964,7 +28002,7 @@ const UNIQUE_KEY = "DefaultDocsLineExtension", DOC_EXTENSION_Z_INDEX = 40, _Line
|
|
|
27964
28002
|
const startY = asc + dsc + 3;
|
|
27965
28003
|
this._drawLine(ctx, glyph, bottomBorderLine, startY, scale, 2);
|
|
27966
28004
|
}
|
|
27967
|
-
if (
|
|
28005
|
+
if (strikethrough) {
|
|
27968
28006
|
let startY = asc + bd - strikeoutPosition - DELTA;
|
|
27969
28007
|
baselineOffset === BaselineOffset.SUPERSCRIPT ? startY -= spo : baselineOffset === BaselineOffset.SUBSCRIPT && (startY += sbo), this._drawLine(ctx, glyph, strikethrough, startY, scale);
|
|
27970
28008
|
}
|
|
@@ -27986,11 +28024,11 @@ const UNIQUE_KEY = "DefaultDocsLineExtension", DOC_EXTENSION_Z_INDEX = 40, _Line
|
|
|
27986
28024
|
originTranslate = Vector2.create(0, 0),
|
|
27987
28025
|
alignOffset = Vector2.create(0, 0),
|
|
27988
28026
|
renderConfig = {}
|
|
27989
|
-
} = this.extensionOffset, { left, width } = glyph, { centerAngle: centerAngleDeg = 0, vertexAngle: vertexAngleDeg = 0 } = renderConfig
|
|
27990
|
-
ctx.save()
|
|
28027
|
+
} = this.extensionOffset, { left, width } = glyph, { centerAngle: centerAngleDeg = 0, vertexAngle: vertexAngleDeg = 0 } = renderConfig;
|
|
28028
|
+
ctx.save();
|
|
27991
28029
|
const color = (c === BooleanNumber.TRUE ? getColorStyle((_a10 = glyph.ts) == null ? void 0 : _a10.cl) : getColorStyle(colorStyle)) || COLOR_BLACK_RGB;
|
|
27992
28030
|
ctx.strokeStyle = color, ctx.lineWidth = lineWidth, this._setLineType(ctx, lineType || TextDecoration.SINGLE);
|
|
27993
|
-
const start = calculateRectRotate(
|
|
28031
|
+
const centerAngle = degToRad(centerAngleDeg), vertexAngle = degToRad(vertexAngleDeg), start = calculateRectRotate(
|
|
27994
28032
|
originTranslate.addByPoint(left, startY),
|
|
27995
28033
|
Vector2.create(0, 0),
|
|
27996
28034
|
centerAngle,
|
|
@@ -28017,8 +28055,6 @@ const _Documents = class _Documents extends DocComponent {
|
|
|
28017
28055
|
super(oKey, documentSkeleton, config);
|
|
28018
28056
|
__publicField(this, "_pageRender$", new Subject());
|
|
28019
28057
|
__publicField(this, "pageRender$", this._pageRender$.asObservable());
|
|
28020
|
-
__publicField(this, "docsLeft", 0);
|
|
28021
|
-
__publicField(this, "docsTop", 0);
|
|
28022
28058
|
__publicField(this, "_drawLiquid", new Liquid());
|
|
28023
28059
|
this._initialDefaultExtension(), this.makeDirty(!0);
|
|
28024
28060
|
}
|
|
@@ -29122,7 +29158,9 @@ const PAGE_STROKE_COLOR = "rgba(198, 198, 198, 1)", PAGE_FILL_COLOR = "rgba(255,
|
|
|
29122
29158
|
const skeletonData = (_a10 = this.getSkeleton()) == null ? void 0 : _a10.getSkeletonData(), docDataModel = (_b = this.getSkeleton()) == null ? void 0 : _b.getViewModel().getDataModel();
|
|
29123
29159
|
if (skeletonData == null || docDataModel == null)
|
|
29124
29160
|
return;
|
|
29125
|
-
const documentFlavor = docDataModel.getSnapshot().documentStyle
|
|
29161
|
+
const { documentFlavor } = docDataModel.getSnapshot().documentStyle;
|
|
29162
|
+
if (documentFlavor !== DocumentFlavor.TRADITIONAL)
|
|
29163
|
+
return;
|
|
29126
29164
|
this._drawLiquid.reset();
|
|
29127
29165
|
const { pages } = skeletonData;
|
|
29128
29166
|
let pageTop = 0, pageLeft = 0;
|
|
@@ -29148,51 +29186,49 @@ const PAGE_STROKE_COLOR = "rgba(198, 198, 198, 1)", PAGE_FILL_COLOR = "rgba(255,
|
|
|
29148
29186
|
fill: PAGE_FILL_COLOR,
|
|
29149
29187
|
zIndex: 3
|
|
29150
29188
|
};
|
|
29151
|
-
|
|
29152
|
-
|
|
29153
|
-
|
|
29154
|
-
|
|
29155
|
-
|
|
29156
|
-
|
|
29157
|
-
|
|
29158
|
-
|
|
29159
|
-
|
|
29160
|
-
|
|
29161
|
-
|
|
29162
|
-
|
|
29163
|
-
|
|
29164
|
-
|
|
29165
|
-
|
|
29166
|
-
|
|
29167
|
-
|
|
29168
|
-
|
|
29169
|
-
|
|
29170
|
-
|
|
29171
|
-
|
|
29172
|
-
|
|
29173
|
-
|
|
29174
|
-
|
|
29175
|
-
|
|
29176
|
-
|
|
29177
|
-
|
|
29178
|
-
|
|
29179
|
-
|
|
29180
|
-
|
|
29181
|
-
|
|
29182
|
-
|
|
29183
|
-
|
|
29184
|
-
|
|
29185
|
-
|
|
29186
|
-
|
|
29187
|
-
|
|
29188
|
-
|
|
29189
|
-
|
|
29190
|
-
|
|
29191
|
-
|
|
29192
|
-
|
|
29193
|
-
|
|
29194
|
-
}
|
|
29195
|
-
ctx.restore();
|
|
29189
|
+
Rect.drawWith(ctx, backgroundOptions);
|
|
29190
|
+
const IDENTIFIER_WIDTH = 15, marginIdentification = {
|
|
29191
|
+
dataArray: [{
|
|
29192
|
+
command: "M",
|
|
29193
|
+
points: [marginLeft - IDENTIFIER_WIDTH, originMarginTop]
|
|
29194
|
+
}, {
|
|
29195
|
+
command: "L",
|
|
29196
|
+
points: [marginLeft, originMarginTop]
|
|
29197
|
+
}, {
|
|
29198
|
+
command: "L",
|
|
29199
|
+
points: [marginLeft, originMarginTop - IDENTIFIER_WIDTH]
|
|
29200
|
+
}, {
|
|
29201
|
+
command: "M",
|
|
29202
|
+
points: [pageWidth - marginRight + IDENTIFIER_WIDTH, originMarginTop]
|
|
29203
|
+
}, {
|
|
29204
|
+
command: "L",
|
|
29205
|
+
points: [pageWidth - marginRight, originMarginTop]
|
|
29206
|
+
}, {
|
|
29207
|
+
command: "L",
|
|
29208
|
+
points: [pageWidth - marginRight, originMarginTop - IDENTIFIER_WIDTH]
|
|
29209
|
+
}, {
|
|
29210
|
+
command: "M",
|
|
29211
|
+
points: [marginLeft - IDENTIFIER_WIDTH, pageHeight - originMarginBottom]
|
|
29212
|
+
}, {
|
|
29213
|
+
command: "L",
|
|
29214
|
+
points: [marginLeft, pageHeight - originMarginBottom]
|
|
29215
|
+
}, {
|
|
29216
|
+
command: "L",
|
|
29217
|
+
points: [marginLeft, pageHeight - originMarginBottom + IDENTIFIER_WIDTH]
|
|
29218
|
+
}, {
|
|
29219
|
+
command: "M",
|
|
29220
|
+
points: [pageWidth - marginRight + IDENTIFIER_WIDTH, pageHeight - originMarginBottom]
|
|
29221
|
+
}, {
|
|
29222
|
+
command: "L",
|
|
29223
|
+
points: [pageWidth - marginRight, pageHeight - originMarginBottom]
|
|
29224
|
+
}, {
|
|
29225
|
+
command: "L",
|
|
29226
|
+
points: [pageWidth - marginRight, pageHeight - originMarginBottom + IDENTIFIER_WIDTH]
|
|
29227
|
+
}],
|
|
29228
|
+
strokeWidth: 1.5,
|
|
29229
|
+
stroke: MARGIN_STROKE_COLOR
|
|
29230
|
+
};
|
|
29231
|
+
Path.drawWith(ctx, marginIdentification), ctx.restore();
|
|
29196
29232
|
const { x, y } = this._drawLiquid.translatePage(
|
|
29197
29233
|
page,
|
|
29198
29234
|
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;
|
package/lib/types/context.d.ts
CHANGED
|
@@ -77,7 +77,14 @@ export declare class UniverRenderingContext2D implements CanvasRenderingContext2
|
|
|
77
77
|
set textAlign(val: CanvasTextAlign);
|
|
78
78
|
get textBaseline(): CanvasTextBaseline;
|
|
79
79
|
set textBaseline(val: CanvasTextBaseline);
|
|
80
|
-
|
|
80
|
+
/**
|
|
81
|
+
* Get scale from ctx.
|
|
82
|
+
* DOMMatrix.a DOMMatrix.d would affect by ctx.rotate()
|
|
83
|
+
*/
|
|
84
|
+
protected _getScale(): {
|
|
85
|
+
scaleX: number;
|
|
86
|
+
scaleY: number;
|
|
87
|
+
};
|
|
81
88
|
getScale(): {
|
|
82
89
|
scaleX: number;
|
|
83
90
|
scaleY: number;
|
|
@@ -266,6 +273,7 @@ export declare class UniverRenderingContext2D implements CanvasRenderingContext2
|
|
|
266
273
|
* @method
|
|
267
274
|
*/
|
|
268
275
|
moveToByPrecision(x: number, y: number): void;
|
|
276
|
+
moveToByPrecisionLog(x: number, y: number): void;
|
|
269
277
|
/**
|
|
270
278
|
* rect function.
|
|
271
279
|
* @method
|
|
@@ -366,7 +374,6 @@ export declare class UniverRenderingContext extends UniverRenderingContext2D {
|
|
|
366
374
|
}
|
|
367
375
|
export declare class UniverPrintingContext extends UniverRenderingContext2D {
|
|
368
376
|
__mode: string;
|
|
369
|
-
private __getScale;
|
|
370
377
|
clearRect(x: number, y: number, width: number, height: number): void;
|
|
371
378
|
clearRectForTexture(x: number, y: number, width: number, height: number): void;
|
|
372
379
|
setGlobalCompositeOperation(val: GlobalCompositeOperation): void;
|
package/lib/types/layer.d.ts
CHANGED
|
@@ -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;
|