@univerjs/engine-render 1.0.0-beta.1 → 1.0.0-beta.2
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 +187 -155
- package/lib/es/index.js +188 -157
- package/lib/index.js +188 -157
- package/lib/types/basics/index.d.ts +1 -0
- package/lib/types/basics/transformer-config.d.ts +27 -0
- package/lib/types/components/docs/layout/block/column.d.ts +15 -1
- package/lib/types/components/docs/layout/style/color.d.ts +17 -0
- package/lib/types/components/sheets/sheet.render-skeleton.d.ts +2 -0
- package/lib/types/context.d.ts +4 -0
- package/lib/types/render-manager/render-manager.service.d.ts +1 -1
- package/lib/types/scene.d.ts +2 -0
- package/lib/types/services/canvas-color.service.d.ts +2 -4
- package/lib/types/shape/scroll-bar.d.ts +2 -0
- package/lib/types/shape/shape.d.ts +6 -0
- package/lib/umd/index.js +2 -2
- package/package.json +3 -3
package/lib/cjs/index.js
CHANGED
|
@@ -3222,6 +3222,36 @@ var Transform = class Transform {
|
|
|
3222
3222
|
}
|
|
3223
3223
|
};
|
|
3224
3224
|
|
|
3225
|
+
//#endregion
|
|
3226
|
+
//#region src/basics/transformer-config.ts
|
|
3227
|
+
const DEFAULT_TRANSFORMER_CONFIG = {
|
|
3228
|
+
resizeEnabled: true,
|
|
3229
|
+
rotateEnabled: true,
|
|
3230
|
+
rotateAnchorOffset: 28,
|
|
3231
|
+
rotateAnchorPosition: "bottom",
|
|
3232
|
+
rotateLineEnabled: false,
|
|
3233
|
+
rotateSize: 18,
|
|
3234
|
+
rotateCornerRadius: 9,
|
|
3235
|
+
rotateFill: "#ffffff",
|
|
3236
|
+
rotateStroke: "#4086f4",
|
|
3237
|
+
rotateStrokeWidth: 1,
|
|
3238
|
+
rotateIconEnabled: true,
|
|
3239
|
+
rotateIconStroke: "#4086f4",
|
|
3240
|
+
rotateIconStrokeWidth: 1.25,
|
|
3241
|
+
borderEnabled: true,
|
|
3242
|
+
borderStroke: "#4086f4",
|
|
3243
|
+
borderStrokeWidth: 1,
|
|
3244
|
+
borderSpacing: 2,
|
|
3245
|
+
anchorFill: "#ffffff",
|
|
3246
|
+
anchorStroke: "#4086f4",
|
|
3247
|
+
anchorStrokeWidth: 1.5,
|
|
3248
|
+
anchorSize: 8,
|
|
3249
|
+
anchorCornerRadius: 2,
|
|
3250
|
+
anchorStyle: "canva",
|
|
3251
|
+
keepRatio: true,
|
|
3252
|
+
moveBoundaryEnabled: true
|
|
3253
|
+
};
|
|
3254
|
+
|
|
3225
3255
|
//#endregion
|
|
3226
3256
|
//#region src/basics/zoom.ts
|
|
3227
3257
|
const MIN_ZOOM_RATIO = .1;
|
|
@@ -4144,6 +4174,8 @@ var UniverRenderingContext2D = class {
|
|
|
4144
4174
|
constructor(context, options) {
|
|
4145
4175
|
_defineProperty(this, "__mode", "rendering");
|
|
4146
4176
|
_defineProperty(this, "_transformCache", void 0);
|
|
4177
|
+
_defineProperty(this, "_bitmapMutationId", 0);
|
|
4178
|
+
_defineProperty(this, "_bitmapMutationTrackingDepth", 0);
|
|
4147
4179
|
_defineProperty(this, "canvas", void 0);
|
|
4148
4180
|
_defineProperty(this, "_context", void 0);
|
|
4149
4181
|
_defineProperty(this, "_systemType", void 0);
|
|
@@ -4162,6 +4194,19 @@ var UniverRenderingContext2D = class {
|
|
|
4162
4194
|
setId(id) {
|
|
4163
4195
|
this._id = id;
|
|
4164
4196
|
}
|
|
4197
|
+
detectBitmapMutation(callback) {
|
|
4198
|
+
const mutationId = this._bitmapMutationId;
|
|
4199
|
+
this._bitmapMutationTrackingDepth++;
|
|
4200
|
+
try {
|
|
4201
|
+
callback();
|
|
4202
|
+
} finally {
|
|
4203
|
+
this._bitmapMutationTrackingDepth--;
|
|
4204
|
+
}
|
|
4205
|
+
return mutationId !== this._bitmapMutationId;
|
|
4206
|
+
}
|
|
4207
|
+
_markBitmapMutation() {
|
|
4208
|
+
if (this._bitmapMutationTrackingDepth > 0) this._bitmapMutationId++;
|
|
4209
|
+
}
|
|
4165
4210
|
isContextLost() {
|
|
4166
4211
|
return this._context.isContextLost();
|
|
4167
4212
|
}
|
|
@@ -4391,7 +4436,9 @@ var UniverRenderingContext2D = class {
|
|
|
4391
4436
|
this._context.resetTransform();
|
|
4392
4437
|
}
|
|
4393
4438
|
drawFocusIfNeeded(...args) {
|
|
4394
|
-
|
|
4439
|
+
const result = this._context.drawFocusIfNeeded(...args);
|
|
4440
|
+
this._markBitmapMutation();
|
|
4441
|
+
return result;
|
|
4395
4442
|
}
|
|
4396
4443
|
/**
|
|
4397
4444
|
* reset canvas context transform
|
|
@@ -4400,6 +4447,7 @@ var UniverRenderingContext2D = class {
|
|
|
4400
4447
|
reset() {
|
|
4401
4448
|
this._transformCache = null;
|
|
4402
4449
|
this._context.reset();
|
|
4450
|
+
this._markBitmapMutation();
|
|
4403
4451
|
}
|
|
4404
4452
|
/**
|
|
4405
4453
|
* arc function.
|
|
@@ -4473,6 +4521,7 @@ var UniverRenderingContext2D = class {
|
|
|
4473
4521
|
*/
|
|
4474
4522
|
clearRect(x, y, width, height) {
|
|
4475
4523
|
this._context.clearRect(x, y, width, height);
|
|
4524
|
+
this._markBitmapMutation();
|
|
4476
4525
|
}
|
|
4477
4526
|
/**
|
|
4478
4527
|
* clearRect function.
|
|
@@ -4546,6 +4595,7 @@ var UniverRenderingContext2D = class {
|
|
|
4546
4595
|
if (a.length === 3) _context.drawImage(args[0], args[1], args[2]);
|
|
4547
4596
|
else if (a.length === 5) _context.drawImage(args[0], args[1], args[2], args[3], args[4]);
|
|
4548
4597
|
else if (a.length === 9) _context.drawImage(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]);
|
|
4598
|
+
this._markBitmapMutation();
|
|
4549
4599
|
}
|
|
4550
4600
|
/**
|
|
4551
4601
|
* ellipse function.
|
|
@@ -4559,6 +4609,7 @@ var UniverRenderingContext2D = class {
|
|
|
4559
4609
|
}
|
|
4560
4610
|
fill(...args) {
|
|
4561
4611
|
this._context.fill(...args);
|
|
4612
|
+
this._markBitmapMutation();
|
|
4562
4613
|
}
|
|
4563
4614
|
/**
|
|
4564
4615
|
* fillRect function.
|
|
@@ -4566,6 +4617,7 @@ var UniverRenderingContext2D = class {
|
|
|
4566
4617
|
*/
|
|
4567
4618
|
fillRect(x, y, width, height) {
|
|
4568
4619
|
this._context.fillRect(x, y, width, height);
|
|
4620
|
+
this._markBitmapMutation();
|
|
4569
4621
|
}
|
|
4570
4622
|
/**
|
|
4571
4623
|
* fillRect function precision.
|
|
@@ -4585,6 +4637,7 @@ var UniverRenderingContext2D = class {
|
|
|
4585
4637
|
*/
|
|
4586
4638
|
strokeRect(x, y, width, height) {
|
|
4587
4639
|
this._context.strokeRect(x, y, width, height);
|
|
4640
|
+
this._markBitmapMutation();
|
|
4588
4641
|
}
|
|
4589
4642
|
/**
|
|
4590
4643
|
* strokeRect function precision.
|
|
@@ -4605,6 +4658,7 @@ var UniverRenderingContext2D = class {
|
|
|
4605
4658
|
fillText(text, x, y, maxWidth) {
|
|
4606
4659
|
if (maxWidth) this._context.fillText(text, x, y, maxWidth);
|
|
4607
4660
|
else this._context.fillText(text, x, y);
|
|
4661
|
+
this._markBitmapMutation();
|
|
4608
4662
|
}
|
|
4609
4663
|
/**
|
|
4610
4664
|
* fillText function.
|
|
@@ -4618,6 +4672,7 @@ var UniverRenderingContext2D = class {
|
|
|
4618
4672
|
maxWidth = fixLineWidthByScale(maxWidth, scaleX);
|
|
4619
4673
|
this._context.fillText(text, x, y, maxWidth);
|
|
4620
4674
|
} else this._context.fillText(text, x, y);
|
|
4675
|
+
this._markBitmapMutation();
|
|
4621
4676
|
}
|
|
4622
4677
|
/**
|
|
4623
4678
|
* measureText function.
|
|
@@ -4698,6 +4753,7 @@ var UniverRenderingContext2D = class {
|
|
|
4698
4753
|
*/
|
|
4699
4754
|
putImageData(imageData, dx, dy) {
|
|
4700
4755
|
this._context.putImageData(imageData, dx, dy);
|
|
4756
|
+
this._markBitmapMutation();
|
|
4701
4757
|
}
|
|
4702
4758
|
/**
|
|
4703
4759
|
* quadraticCurveTo function.
|
|
@@ -4766,6 +4822,7 @@ var UniverRenderingContext2D = class {
|
|
|
4766
4822
|
stroke(path2d) {
|
|
4767
4823
|
if (path2d) this._context.stroke(path2d);
|
|
4768
4824
|
else this._context.stroke();
|
|
4825
|
+
this._markBitmapMutation();
|
|
4769
4826
|
}
|
|
4770
4827
|
/**
|
|
4771
4828
|
* strokeText function.
|
|
@@ -4773,6 +4830,7 @@ var UniverRenderingContext2D = class {
|
|
|
4773
4830
|
*/
|
|
4774
4831
|
strokeText(text, x, y, maxWidth) {
|
|
4775
4832
|
this._context.strokeText(text, x, y, maxWidth);
|
|
4833
|
+
this._markBitmapMutation();
|
|
4776
4834
|
}
|
|
4777
4835
|
/**
|
|
4778
4836
|
* strokeText function precision.
|
|
@@ -4897,7 +4955,7 @@ var Canvas = class {
|
|
|
4897
4955
|
this._canvasEle.style.outline = "0";
|
|
4898
4956
|
const context = this._canvasEle.getContext("2d");
|
|
4899
4957
|
if (context == null) throw new Error("context is not support");
|
|
4900
|
-
if (props.mode === 1) this._context = new UniverPrintingContext(context);
|
|
4958
|
+
if (props.mode === 1) this._context = new UniverPrintingContext(context, { canvasColorService: props.colorService });
|
|
4901
4959
|
else this._context = new UniverRenderingContext(context, { canvasColorService: props.colorService });
|
|
4902
4960
|
this.setSize(props.width, props.height, props.pixelRatio);
|
|
4903
4961
|
}
|
|
@@ -11958,8 +12016,10 @@ const SHAPE_OBJECT_ARRAY = [
|
|
|
11958
12016
|
"globalCompositeOperation",
|
|
11959
12017
|
"paintFirst",
|
|
11960
12018
|
"stroke",
|
|
12019
|
+
"strokeOpacity",
|
|
11961
12020
|
"strokeScaleEnabled",
|
|
11962
12021
|
"fill",
|
|
12022
|
+
"fillOpacity",
|
|
11963
12023
|
"fillAfterStrokeEnabled",
|
|
11964
12024
|
"hitStrokeWidth",
|
|
11965
12025
|
"strokeLineJoin",
|
|
@@ -11989,8 +12049,10 @@ var Shape = class extends BaseObject {
|
|
|
11989
12049
|
_defineProperty(this, "_globalCompositeOperation", "source-over");
|
|
11990
12050
|
_defineProperty(this, "_paintFirst", "fill");
|
|
11991
12051
|
_defineProperty(this, "_stroke", void 0);
|
|
12052
|
+
_defineProperty(this, "_strokeOpacity", void 0);
|
|
11992
12053
|
_defineProperty(this, "_strokeScaleEnabled", false);
|
|
11993
12054
|
_defineProperty(this, "_fill", void 0);
|
|
12055
|
+
_defineProperty(this, "_fillOpacity", void 0);
|
|
11994
12056
|
_defineProperty(this, "_fillAfterStrokeEnabled", false);
|
|
11995
12057
|
_defineProperty(this, "_hitStrokeWidth", 0);
|
|
11996
12058
|
_defineProperty(this, "_strokeLineJoin", "round");
|
|
@@ -12028,12 +12090,18 @@ var Shape = class extends BaseObject {
|
|
|
12028
12090
|
get stroke() {
|
|
12029
12091
|
return this._stroke;
|
|
12030
12092
|
}
|
|
12093
|
+
get strokeOpacity() {
|
|
12094
|
+
return this._strokeOpacity;
|
|
12095
|
+
}
|
|
12031
12096
|
get strokeScaleEnabled() {
|
|
12032
12097
|
return this._strokeScaleEnabled;
|
|
12033
12098
|
}
|
|
12034
12099
|
get fill() {
|
|
12035
12100
|
return this._fill;
|
|
12036
12101
|
}
|
|
12102
|
+
get fillOpacity() {
|
|
12103
|
+
return this._fillOpacity;
|
|
12104
|
+
}
|
|
12037
12105
|
get fillAfterStrokeEnabled() {
|
|
12038
12106
|
return this._fillAfterStrokeEnabled;
|
|
12039
12107
|
}
|
|
@@ -12099,6 +12167,7 @@ var Shape = class extends BaseObject {
|
|
|
12099
12167
|
if (!props.fill) return;
|
|
12100
12168
|
ctx.save();
|
|
12101
12169
|
this._setFillStyles(ctx, props);
|
|
12170
|
+
ctx.globalAlpha *= props.fillOpacity ?? 1;
|
|
12102
12171
|
if (props.fillRule === "evenodd") ctx.fill("evenodd");
|
|
12103
12172
|
else ctx.fill();
|
|
12104
12173
|
ctx.restore();
|
|
@@ -12108,10 +12177,11 @@ var Shape = class extends BaseObject {
|
|
|
12108
12177
|
* @param {UniverRenderingContext} ctx SheetContext to render on
|
|
12109
12178
|
*/
|
|
12110
12179
|
static _renderStroke(ctx, props) {
|
|
12111
|
-
const { stroke, strokeWidth
|
|
12180
|
+
const { stroke, strokeWidth } = props;
|
|
12112
12181
|
if (!stroke || strokeWidth === void 0 || !Number.isFinite(strokeWidth) || strokeWidth <= 0) return;
|
|
12113
12182
|
ctx.save();
|
|
12114
12183
|
this._setStrokeStyles(ctx, props);
|
|
12184
|
+
ctx.globalAlpha *= props.strokeOpacity ?? 1;
|
|
12115
12185
|
ctx.stroke();
|
|
12116
12186
|
ctx.restore();
|
|
12117
12187
|
}
|
|
@@ -15412,13 +15482,14 @@ function getCustomDecorationStyle(customDecoration) {
|
|
|
15412
15482
|
|
|
15413
15483
|
//#endregion
|
|
15414
15484
|
//#region src/components/docs/layout/style/custom-range.ts
|
|
15485
|
+
const CUSTOM_RANGE_COLOR_TOKEN = "blue.600";
|
|
15415
15486
|
function getCustomRangeStyle(customRange) {
|
|
15416
15487
|
if (customRange.rangeType === _univerjs_core.CustomRangeType.HYPERLINK || customRange.rangeType === _univerjs_core.CustomRangeType.MENTION || customRange.rangeType === _univerjs_core.CustomRangeType.CUSTOM) {
|
|
15417
15488
|
var _customRange$properti;
|
|
15418
15489
|
const preserveTextColor = ((_customRange$properti = customRange.properties) === null || _customRange$properti === void 0 ? void 0 : _customRange$properti.textColorMode) === "text";
|
|
15419
15490
|
return {
|
|
15420
|
-
...customRange.active ?? true ? { ul: { s: _univerjs_core.BooleanNumber.TRUE } } : null,
|
|
15421
|
-
...preserveTextColor ? null : { cl: { rgb:
|
|
15491
|
+
...customRange.rangeType === _univerjs_core.CustomRangeType.HYPERLINK || (customRange.active ?? true) ? { ul: { s: _univerjs_core.BooleanNumber.TRUE } } : null,
|
|
15492
|
+
...preserveTextColor ? null : { cl: { rgb: CUSTOM_RANGE_COLOR_TOKEN } }
|
|
15422
15493
|
};
|
|
15423
15494
|
}
|
|
15424
15495
|
return null;
|
|
@@ -15519,7 +15590,10 @@ function getLineHeightConfig(sectionBreakConfig, paragraphConfig) {
|
|
|
15519
15590
|
const gridType = sectionBreakConfig.gridType ?? (useWordStyleLineHeight ? _univerjs_core.GridType.DEFAULT : _univerjs_core.GridType.LINES);
|
|
15520
15591
|
const hasLineGrid = gridType === _univerjs_core.GridType.LINES || gridType === _univerjs_core.GridType.LINES_AND_CHARS;
|
|
15521
15592
|
const defaultSnapToGrid = useWordStyleLineHeight && (!hasLineGrid || isInsideTable && adjustLineHeightInTable !== _univerjs_core.BooleanNumber.TRUE) ? _univerjs_core.BooleanNumber.FALSE : _univerjs_core.BooleanNumber.TRUE;
|
|
15522
|
-
const { lineSpacing = 0, spacingRule = _univerjs_core.SpacingRule.AUTO, snapToGrid = defaultSnapToGrid } = paragraphStyle;
|
|
15593
|
+
const { lineSpacing: requestedLineSpacing = 0, spacingRule: requestedSpacingRule = _univerjs_core.SpacingRule.AUTO, snapToGrid = defaultSnapToGrid } = paragraphStyle;
|
|
15594
|
+
const hasValidLineSpacing = Number.isFinite(requestedLineSpacing) && requestedLineSpacing > 0;
|
|
15595
|
+
const lineSpacing = hasValidLineSpacing ? requestedLineSpacing : 0;
|
|
15596
|
+
const spacingRule = hasValidLineSpacing ? requestedSpacingRule : _univerjs_core.SpacingRule.AUTO;
|
|
15523
15597
|
let lineSpacingApply = lineSpacing;
|
|
15524
15598
|
if (useWordStyleLineHeight && lineSpacing === 0 && spacingRule === _univerjs_core.SpacingRule.AUTO) lineSpacingApply = 1;
|
|
15525
15599
|
else if (!useWordStyleLineHeight && (gridType === _univerjs_core.GridType.LINES || gridType === _univerjs_core.GridType.LINES_AND_CHARS) && lineSpacing === 0 && spacingRule === _univerjs_core.SpacingRule.AUTO) lineSpacingApply = 1;
|
|
@@ -18431,24 +18505,15 @@ function allocateHorizontalWidths(columns, contentWidth) {
|
|
|
18431
18505
|
}
|
|
18432
18506
|
function compressToFit(widths, minWidths, overflow) {
|
|
18433
18507
|
const nextWidths = [...widths];
|
|
18434
|
-
|
|
18435
|
-
let flexibleIndexes = getFlexibleIndexes(nextWidths, minWidths);
|
|
18436
|
-
while (remainingOverflow > 0 && flexibleIndexes.length > 0) {
|
|
18437
|
-
const totalShrink = flexibleIndexes.reduce((sum, item) => sum + item.shrink, 0);
|
|
18438
|
-
for (const item of flexibleIndexes) {
|
|
18439
|
-
const shrink = Math.min(item.shrink, remainingOverflow * item.shrink / totalShrink);
|
|
18440
|
-
nextWidths[item.index] -= shrink;
|
|
18441
|
-
remainingOverflow -= shrink;
|
|
18442
|
-
}
|
|
18443
|
-
flexibleIndexes = getFlexibleIndexes(nextWidths, minWidths);
|
|
18444
|
-
}
|
|
18445
|
-
return nextWidths;
|
|
18446
|
-
}
|
|
18447
|
-
function getFlexibleIndexes(widths, minWidths) {
|
|
18448
|
-
return widths.map((width, index) => ({
|
|
18508
|
+
const flexibleIndexes = nextWidths.map((width, index) => ({
|
|
18449
18509
|
index,
|
|
18450
18510
|
shrink: Math.max(0, width - minWidths[index])
|
|
18451
18511
|
})).filter((item) => item.shrink > 0);
|
|
18512
|
+
const totalShrink = flexibleIndexes.reduce((sum, item) => sum + item.shrink, 0);
|
|
18513
|
+
const appliedOverflow = Math.min(overflow, totalShrink);
|
|
18514
|
+
if (appliedOverflow <= 0 || totalShrink <= 0) return nextWidths;
|
|
18515
|
+
for (const item of flexibleIndexes) nextWidths[item.index] -= appliedOverflow * item.shrink / totalShrink;
|
|
18516
|
+
return nextWidths;
|
|
18452
18517
|
}
|
|
18453
18518
|
function getMinWidth(column) {
|
|
18454
18519
|
var _column$minWidth;
|
|
@@ -20023,7 +20088,17 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends _univerjs_core.Sheet
|
|
|
20023
20088
|
_defineProperty(this, "_handleBorderMatrix", new _univerjs_core.ObjectMatrix());
|
|
20024
20089
|
_defineProperty(this, "_showGridlines", _univerjs_core.BooleanNumber.TRUE);
|
|
20025
20090
|
_defineProperty(this, "_gridlinesColor", void 0);
|
|
20091
|
+
_defineProperty(this, "_defaultGridlinesColor", void 0);
|
|
20026
20092
|
_defineProperty(this, "_scene", null);
|
|
20093
|
+
const themeService = _injector.get(_univerjs_core.ThemeService);
|
|
20094
|
+
this.disposeWithMe(themeService.currentTheme$.subscribe(() => {
|
|
20095
|
+
var _this$_scene, _this$_scene2;
|
|
20096
|
+
const gray200 = themeService.getColorFromTheme("gray.200");
|
|
20097
|
+
const gray900 = themeService.getColorFromTheme("gray.900");
|
|
20098
|
+
this._defaultGridlinesColor = _univerjs_core.ColorKit.mix(gray200, gray900, .07).toHexString();
|
|
20099
|
+
(_this$_scene = this._scene) === null || _this$_scene === void 0 || _this$_scene.getViewports().forEach((viewport) => viewport.markDirty(true));
|
|
20100
|
+
(_this$_scene2 = this._scene) === null || _this$_scene2 === void 0 || _this$_scene2.makeDirty(true);
|
|
20101
|
+
}));
|
|
20027
20102
|
this._updateLayout();
|
|
20028
20103
|
this.disposeWithMe(this._contextService.subscribeContextValue$(RENDER_RAW_FORMULA_KEY).pipe((0, rxjs.startWith)(false), (0, rxjs.distinctUntilChanged)()).subscribe((renderRaw) => {
|
|
20029
20104
|
this._renderRawFormula = renderRaw;
|
|
@@ -20077,6 +20152,9 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends _univerjs_core.Sheet
|
|
|
20077
20152
|
get gridlinesColor() {
|
|
20078
20153
|
return this._gridlinesColor;
|
|
20079
20154
|
}
|
|
20155
|
+
get defaultGridlinesColor() {
|
|
20156
|
+
return this._defaultGridlinesColor;
|
|
20157
|
+
}
|
|
20080
20158
|
dispose() {
|
|
20081
20159
|
super.dispose();
|
|
20082
20160
|
this._drawingRange = {
|
|
@@ -22098,6 +22176,15 @@ var Border$1 = class extends docExtension {
|
|
|
22098
22176
|
};
|
|
22099
22177
|
DocumentsSpanAndLineExtensionRegistry.add(new Border$1());
|
|
22100
22178
|
|
|
22179
|
+
//#endregion
|
|
22180
|
+
//#region src/components/docs/layout/style/color.ts
|
|
22181
|
+
const THEME_COLOR_TOKEN_PATTERN = /^[a-z][a-z0-9-]*\.\d+$/i;
|
|
22182
|
+
function getColorStyleForCanvas(color) {
|
|
22183
|
+
const rgb = color === null || color === void 0 ? void 0 : color.rgb;
|
|
22184
|
+
if (rgb && THEME_COLOR_TOKEN_PATTERN.test(rgb)) return rgb;
|
|
22185
|
+
return (0, _univerjs_core.getColorStyle)(color);
|
|
22186
|
+
}
|
|
22187
|
+
|
|
22101
22188
|
//#endregion
|
|
22102
22189
|
//#region src/components/docs/extensions/font-and-base-line.ts
|
|
22103
22190
|
const UNIQUE_KEY$1 = "DefaultDocsFontAndBaseLineExtension";
|
|
@@ -22142,7 +22229,7 @@ var FontAndBaseLine = class extends docExtension {
|
|
|
22142
22229
|
}
|
|
22143
22230
|
}
|
|
22144
22231
|
const { cl: colorStyle, va: baselineOffset, textFill, glow, outerShadow } = textStyle;
|
|
22145
|
-
const fontColor = (
|
|
22232
|
+
const fontColor = getColorStyleForCanvas(colorStyle) || "rgb(0,0,0)";
|
|
22146
22233
|
if (baselineOffset === _univerjs_core.BaselineOffset.SUPERSCRIPT) spanPointWithFont.y += -bBox.spo;
|
|
22147
22234
|
else if (baselineOffset === _univerjs_core.BaselineOffset.SUBSCRIPT) spanPointWithFont.y += bBox.sbo;
|
|
22148
22235
|
const drawText = () => {
|
|
@@ -22462,7 +22549,7 @@ var Line$1 = class extends docExtension {
|
|
|
22462
22549
|
const lineAlignOffset = isAccounting ? Vector2.create(0, alignOffset.y) : alignOffset;
|
|
22463
22550
|
const { centerAngle: centerAngleDeg = 0, vertexAngle: vertexAngleDeg = 0 } = renderConfig;
|
|
22464
22551
|
ctx.save();
|
|
22465
|
-
ctx.strokeStyle = (c === _univerjs_core.BooleanNumber.TRUE ? (
|
|
22552
|
+
ctx.strokeStyle = (c === _univerjs_core.BooleanNumber.TRUE ? getColorStyleForCanvas((_glyph$ts = glyph.ts) === null || _glyph$ts === void 0 ? void 0 : _glyph$ts.cl) : getColorStyleForCanvas(colorStyle)) || "rgb(0,0,0)";
|
|
22466
22553
|
this._setLineType(ctx, lineType ?? _univerjs_core.TextDecoration.SINGLE, lineWidth);
|
|
22467
22554
|
startY += this._isDouble(lineType) ? -.8 : 0;
|
|
22468
22555
|
const centerAngle = degToRad(centerAngleDeg);
|
|
@@ -23061,7 +23148,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
23061
23148
|
} else {
|
|
23062
23149
|
this._drawLiquid.translateSave();
|
|
23063
23150
|
this._drawLiquid.translateLine(line, true, true);
|
|
23064
|
-
this._drawLineBackground(ctx, nestedPage, line, column.width);
|
|
23151
|
+
this._drawLineBackground(ctx, nestedPage, line, column.width, parentPage.marginLeft, parentPage.marginTop);
|
|
23065
23152
|
const divideLength = divides.length;
|
|
23066
23153
|
for (let i = 0; i < divideLength; i++) {
|
|
23067
23154
|
const divide = divides[i];
|
|
@@ -23346,6 +23433,11 @@ const CUSTOM_EXTENSION_KEY = "DefaultCustomExtension";
|
|
|
23346
23433
|
const MARKER_EXTENSION_KEY = "DefaultMarkerExtension";
|
|
23347
23434
|
const RANGE_PROTECTION_VIEW_EXTENSION_KEY = "RANGE_PROTECTION_CAN_VIEW_RENDER_EXTENSION_KEY";
|
|
23348
23435
|
const RANGE_PROTECTION_HIDDEN_EXTENSION_KEY = "RANGE_PROTECTION_CAN_NOT_VIEW_RENDER_EXTENSION_KEY";
|
|
23436
|
+
const PRINTING_GRIDLINES_COLOR = getColor([
|
|
23437
|
+
214,
|
|
23438
|
+
216,
|
|
23439
|
+
219
|
|
23440
|
+
]);
|
|
23349
23441
|
function pushSparseCellRange(ranges, row, col) {
|
|
23350
23442
|
const last = ranges[ranges.length - 1];
|
|
23351
23443
|
if (last && last.startRow === row && last.endRow === row && last.endColumn + 1 === col) {
|
|
@@ -23572,7 +23664,6 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
23572
23664
|
extension.draw(ctx, parentScale, spreadsheetSkeleton, extensionDiffRanges, {
|
|
23573
23665
|
viewRanges: extensionViewRanges,
|
|
23574
23666
|
checkOutOfViewBound: true,
|
|
23575
|
-
fontRenderRanges: extension === this._fontExtension && !isMergeRepair ? spreadsheetSkeleton.incrementalFontRenderRanges : void 0,
|
|
23576
23667
|
hasMergeData,
|
|
23577
23668
|
viewportKey: viewportInfo.viewportKey,
|
|
23578
23669
|
viewBound: viewportInfo.cacheBound,
|
|
@@ -23956,11 +24047,7 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
23956
24047
|
if (!rowHeightAccumulation || !columnWidthAccumulation || columnTotalWidth === void 0 || rowTotalHeight === void 0) return;
|
|
23957
24048
|
ctx.save();
|
|
23958
24049
|
ctx.setLineWidthByPrecision(1);
|
|
23959
|
-
const defaultGridlinesColor = ctx.__mode === "printing" ?
|
|
23960
|
-
214,
|
|
23961
|
-
216,
|
|
23962
|
-
219
|
|
23963
|
-
]) : "mix(gray.200, gray.900, 0.07)";
|
|
24050
|
+
const defaultGridlinesColor = ctx.__mode === "printing" ? PRINTING_GRIDLINES_COLOR : spreadsheetSkeleton.defaultGridlinesColor;
|
|
23964
24051
|
ctx.strokeStyle = gridlinesColor ?? ctx.renderConfig.gridlinesColor ?? defaultGridlinesColor;
|
|
23965
24052
|
const columnWidthAccumulationLength = columnWidthAccumulation.length;
|
|
23966
24053
|
const rowHeightAccumulationLength = rowHeightAccumulation.length;
|
|
@@ -24305,7 +24392,12 @@ function scrollAndClearCanvas(ctx, pixelRatio, scrollRenderInfos, dirtyBounds) {
|
|
|
24305
24392
|
const targetY = (bounds.top + Math.max(0, offsetY)) * pixelRatio;
|
|
24306
24393
|
const pixelCopyWidth = copyWidth * pixelRatio;
|
|
24307
24394
|
const pixelCopyHeight = copyHeight * pixelRatio;
|
|
24395
|
+
ctx.save();
|
|
24396
|
+
ctx.beginPath();
|
|
24397
|
+
ctx.rect(targetX, targetY, pixelCopyWidth, pixelCopyHeight);
|
|
24398
|
+
ctx.clip();
|
|
24308
24399
|
ctx.drawImage(ctx.canvas, sourceX, sourceY, pixelCopyWidth, pixelCopyHeight, targetX, targetY, pixelCopyWidth, pixelCopyHeight);
|
|
24400
|
+
ctx.restore();
|
|
24309
24401
|
}
|
|
24310
24402
|
clearCanvasBounds(ctx, pixelRatio, dirtyBounds);
|
|
24311
24403
|
ctx.restore();
|
|
@@ -26656,8 +26748,10 @@ var ScrollBar = class ScrollBar extends _univerjs_core.Disposable {
|
|
|
26656
26748
|
_defineProperty(this, "_thumbDefaultBackgroundColor", "gray.300");
|
|
26657
26749
|
_defineProperty(this, "_thumbHoverBackgroundColor", "gray.400");
|
|
26658
26750
|
_defineProperty(this, "_thumbActiveBackgroundColor", "gray.500");
|
|
26659
|
-
_defineProperty(this, "_trackBackgroundColor", "
|
|
26660
|
-
_defineProperty(this, "_trackBorderColor", "
|
|
26751
|
+
_defineProperty(this, "_trackBackgroundColor", "gray.0");
|
|
26752
|
+
_defineProperty(this, "_trackBorderColor", "gray.0");
|
|
26753
|
+
_defineProperty(this, "_trackBackgroundOpacity", .5);
|
|
26754
|
+
_defineProperty(this, "_trackBorderOpacity", .7);
|
|
26661
26755
|
_defineProperty(this, "_trackThickness", DEFAULT_TRACK_SIZE);
|
|
26662
26756
|
_defineProperty(this, "_vThumbMargin", DEFAULT_THUMB_MARGIN);
|
|
26663
26757
|
_defineProperty(this, "_hThumbMargin", DEFAULT_THUMB_MARGIN);
|
|
@@ -26686,6 +26780,8 @@ var ScrollBar = class ScrollBar extends _univerjs_core.Disposable {
|
|
|
26686
26780
|
if (props[key] !== void 0) this[`_${key}`] = props[key];
|
|
26687
26781
|
});
|
|
26688
26782
|
if (_univerjs_core.Tools.isDefine(props.thumbBackgroundColor)) this._thumbDefaultBackgroundColor = props.thumbBackgroundColor;
|
|
26783
|
+
if (_univerjs_core.Tools.isDefine(props.trackBackgroundColor)) this._trackBackgroundOpacity = 1;
|
|
26784
|
+
if (_univerjs_core.Tools.isDefine(props.trackBorderColor)) this._trackBorderOpacity = 1;
|
|
26689
26785
|
if (_univerjs_core.Tools.isDefine(props.barSize)) this._trackThickness = props.barSize;
|
|
26690
26786
|
if (_univerjs_core.Tools.isDefine(props.barBorder)) this._trackBorderThickness = props.barBorder;
|
|
26691
26787
|
if (_univerjs_core.Tools.isDefine(props.thumbMargin)) {
|
|
@@ -27000,8 +27096,10 @@ var ScrollBar = class ScrollBar extends _univerjs_core.Disposable {
|
|
|
27000
27096
|
if (this._enableHorizontal) {
|
|
27001
27097
|
this.horizonScrollTrack = new Rect("__horizonBarRect__", {
|
|
27002
27098
|
fill: this._trackBackgroundColor,
|
|
27099
|
+
fillOpacity: this._trackBackgroundOpacity,
|
|
27003
27100
|
strokeWidth: this._trackBorderThickness,
|
|
27004
|
-
stroke: this._trackBorderColor
|
|
27101
|
+
stroke: this._trackBorderColor,
|
|
27102
|
+
strokeOpacity: this._trackBorderOpacity
|
|
27005
27103
|
});
|
|
27006
27104
|
this.horizonThumbRect = new Rect("__horizonThumbRect__", {
|
|
27007
27105
|
radius: 6,
|
|
@@ -27011,8 +27109,10 @@ var ScrollBar = class ScrollBar extends _univerjs_core.Disposable {
|
|
|
27011
27109
|
if (this._enableVertical) {
|
|
27012
27110
|
this.verticalScrollTrack = new Rect("__verticalBarRect__", {
|
|
27013
27111
|
fill: this._trackBackgroundColor,
|
|
27112
|
+
fillOpacity: this._trackBackgroundOpacity,
|
|
27014
27113
|
strokeWidth: this._trackBorderThickness,
|
|
27015
|
-
stroke: this._trackBorderColor
|
|
27114
|
+
stroke: this._trackBorderColor,
|
|
27115
|
+
strokeOpacity: this._trackBorderOpacity
|
|
27016
27116
|
});
|
|
27017
27117
|
this.verticalThumbRect = new Rect("__verticalThumbRect__", {
|
|
27018
27118
|
radius: 6,
|
|
@@ -27021,8 +27121,10 @@ var ScrollBar = class ScrollBar extends _univerjs_core.Disposable {
|
|
|
27021
27121
|
}
|
|
27022
27122
|
if (this._enableHorizontal && this._enableVertical) this.placeholderBarRect = new Rect("__placeholderBarRect__", {
|
|
27023
27123
|
fill: this._trackBackgroundColor,
|
|
27124
|
+
fillOpacity: this._trackBackgroundOpacity,
|
|
27024
27125
|
strokeWidth: this._trackBorderThickness,
|
|
27025
|
-
stroke: this._trackBorderColor
|
|
27126
|
+
stroke: this._trackBorderColor,
|
|
27127
|
+
strokeOpacity: this._trackBorderOpacity
|
|
27026
27128
|
});
|
|
27027
27129
|
}
|
|
27028
27130
|
_initialVerticalEvent() {
|
|
@@ -27968,68 +28070,28 @@ var DumbCanvasColorService = class {
|
|
|
27968
28070
|
return color;
|
|
27969
28071
|
}
|
|
27970
28072
|
};
|
|
27971
|
-
const DARK_RENDER_COLOR_OVERRIDES = {
|
|
27972
|
-
"#17212b": "#e2e8f0",
|
|
27973
|
-
"#64748b": "#94a3b8",
|
|
27974
|
-
"#d9e0e7": "#253044",
|
|
27975
|
-
"#edf1f5": "#1b2535",
|
|
27976
|
-
"#eef2f6": "#1b2535",
|
|
27977
|
-
"#f2f5f8": "#101827",
|
|
27978
|
-
"#f3f6fa": "#18243a",
|
|
27979
|
-
"#f4f8ff": "#172a46",
|
|
27980
|
-
"#f5f9ff": "#12233a",
|
|
27981
|
-
"#f7f9fb": "#0d1422",
|
|
27982
|
-
"#f7f9fc": "#0d1422",
|
|
27983
|
-
"#f8fafc": "#0f172a",
|
|
27984
|
-
"#fbfcfd": "#07111f",
|
|
27985
|
-
"#fcfdff": "#050914",
|
|
27986
|
-
"#e8f1ff": "#173a69",
|
|
27987
|
-
"#eaf5ff": "#12315a",
|
|
27988
|
-
"#dbeafe": "#1e3a8a",
|
|
27989
|
-
"#bfdbfe": "#60a5fa",
|
|
27990
|
-
"#93c5fd": "#60a5fa",
|
|
27991
|
-
"#8eb6f5": "#60a5fa",
|
|
27992
|
-
"#60a5fa": "#60a5fa",
|
|
27993
|
-
"#2563eb": "#60a5fa",
|
|
27994
|
-
"#1d64d8": "#93c5fd",
|
|
27995
|
-
"#1d5cff": "#60a5fa",
|
|
27996
|
-
"#0f766e": "#2dd4bf",
|
|
27997
|
-
"#d7f4ef": "#134e4a",
|
|
27998
|
-
"rgba(37,99,235,0.05)": "rgba(96,165,250,0.16)",
|
|
27999
|
-
"rgba(37,99,235,0.06)": "rgba(96,165,250,0.18)",
|
|
28000
|
-
"rgba(37,99,235,0.08)": "rgba(96,165,250,0.22)",
|
|
28001
|
-
"rgba(37,99,235,0.12)": "rgba(96,165,250,0.26)",
|
|
28002
|
-
"rgba(37,99,235,0.18)": "rgba(96,165,250,0.30)",
|
|
28003
|
-
"rgba(37,99,235,0.28)": "rgba(96,165,250,0.38)",
|
|
28004
|
-
"rgba(239,246,255,0.88)": "rgba(30,64,175,0.72)",
|
|
28005
|
-
"rgba(148,163,184,0.45)": "rgba(148,163,184,0.52)"
|
|
28006
|
-
};
|
|
28007
|
-
const COLOR_MIX_REGEXP = /^mix\(\s*([^,()]+)\s*,\s*([^,()]+)\s*,\s*(0(?:\.\d+)?|1(?:\.0+)?)\s*\)$/;
|
|
28008
|
-
const COLOR_ALPHA_REGEXP = /^alpha\(\s*([^,()]+)\s*,\s*(0(?:\.\d+)?|1(?:\.0+)?)\s*\)$/;
|
|
28009
28073
|
let CanvasColorService = class CanvasColorService extends _univerjs_core.Disposable {
|
|
28010
28074
|
constructor(_themeService) {
|
|
28011
28075
|
super();
|
|
28012
28076
|
this._themeService = _themeService;
|
|
28013
28077
|
_defineProperty(this, "_darkModeCache", /* @__PURE__ */ new Map());
|
|
28014
|
-
_defineProperty(this, "
|
|
28078
|
+
_defineProperty(this, "_resolvedThemeColors", /* @__PURE__ */ new Map());
|
|
28015
28079
|
_defineProperty(this, "_invertAlgo", _univerjs_core.invertColorByMatrix);
|
|
28016
|
-
this.disposeWithMe(this._themeService.currentTheme$.subscribe(() => {
|
|
28017
|
-
this.
|
|
28080
|
+
this.disposeWithMe(this._themeService.currentTheme$.subscribe((theme) => {
|
|
28081
|
+
this._cacheThemeColors(theme);
|
|
28018
28082
|
this._darkModeCache.clear();
|
|
28019
28083
|
}));
|
|
28020
28084
|
}
|
|
28021
28085
|
getRenderColor(inputColor) {
|
|
28022
|
-
const color = this.
|
|
28086
|
+
const color = this._resolvedThemeColors.get(inputColor) ?? inputColor;
|
|
28023
28087
|
if (!this._themeService.darkMode) return color;
|
|
28024
28088
|
if (this._darkModeCache.has(color)) return this._darkModeCache.get(color);
|
|
28025
|
-
if (
|
|
28089
|
+
if (color.trim().toLowerCase() === "transparent") {
|
|
28026
28090
|
this._darkModeCache.set(color, "transparent");
|
|
28027
28091
|
return "transparent";
|
|
28028
28092
|
}
|
|
28029
28093
|
let cachedColor = "";
|
|
28030
|
-
|
|
28031
|
-
if (mappedColor) cachedColor = mappedColor;
|
|
28032
|
-
else if (color.startsWith("#")) {
|
|
28094
|
+
if (color.startsWith("#")) {
|
|
28033
28095
|
cachedColor = rgbToHex(this._invertAlgo(hexToRgb(color)));
|
|
28034
28096
|
if (color.length === 5) {
|
|
28035
28097
|
const alpha = color.charAt(4);
|
|
@@ -28058,50 +28120,12 @@ let CanvasColorService = class CanvasColorService extends _univerjs_core.Disposa
|
|
|
28058
28120
|
this._darkModeCache.set(color, cachedColor);
|
|
28059
28121
|
return cachedColor;
|
|
28060
28122
|
}
|
|
28061
|
-
|
|
28062
|
-
|
|
28063
|
-
if (
|
|
28064
|
-
const mixMatch = inputColor.match(COLOR_MIX_REGEXP);
|
|
28065
|
-
if (mixMatch) {
|
|
28066
|
-
const color1 = this._resolveThemeColor(mixMatch[1].trim());
|
|
28067
|
-
const color2 = this._resolveThemeColor(mixMatch[2].trim());
|
|
28068
|
-
const amount = Number(mixMatch[3]);
|
|
28069
|
-
const color = _univerjs_core.ColorKit.mix(color1, color2, amount).toHexString();
|
|
28070
|
-
this._resolvedColorCache.set(inputColor, color);
|
|
28071
|
-
return color;
|
|
28072
|
-
}
|
|
28073
|
-
const alphaMatch = inputColor.match(COLOR_ALPHA_REGEXP);
|
|
28074
|
-
if (alphaMatch) {
|
|
28075
|
-
const colorKit = new _univerjs_core.ColorKit(this._resolveThemeColor(alphaMatch[1].trim()));
|
|
28076
|
-
if (!colorKit.isValid) throw new Error(`[CanvasColorService]: illegal color "${inputColor}"`);
|
|
28077
|
-
const color = colorKit.setAlpha(Number(alphaMatch[2])).toRgbString();
|
|
28078
|
-
this._resolvedColorCache.set(inputColor, color);
|
|
28079
|
-
return color;
|
|
28080
|
-
}
|
|
28081
|
-
if (inputColor.trim().startsWith("alpha(")) throw new Error(`[CanvasColorService]: illegal color "${inputColor}"`);
|
|
28082
|
-
const color = this._resolveThemeColor(inputColor);
|
|
28083
|
-
if (color !== inputColor) this._resolvedColorCache.set(inputColor, color);
|
|
28084
|
-
return color;
|
|
28085
|
-
}
|
|
28086
|
-
_resolveThemeColor(inputColor) {
|
|
28087
|
-
let color = inputColor;
|
|
28088
|
-
if (color.includes(".")) {
|
|
28089
|
-
const themeColor = this._themeService.getColorFromTheme(color);
|
|
28090
|
-
if (typeof themeColor === "string" && this._themeService.isValidThemeColor(color)) color = themeColor;
|
|
28091
|
-
}
|
|
28092
|
-
return color;
|
|
28123
|
+
_cacheThemeColors(theme) {
|
|
28124
|
+
this._resolvedThemeColors.clear();
|
|
28125
|
+
for (const [paletteName, palette] of Object.entries(theme)) for (const [tokenName, color] of Object.entries(palette)) if (typeof color === "string") this._resolvedThemeColors.set(`${paletteName}.${tokenName}`, color);
|
|
28093
28126
|
}
|
|
28094
28127
|
};
|
|
28095
28128
|
CanvasColorService = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.ThemeService))], CanvasColorService);
|
|
28096
|
-
function getDarkRenderColorOverride(color) {
|
|
28097
|
-
const normalized = normalizeRenderColor(color);
|
|
28098
|
-
return DARK_RENDER_COLOR_OVERRIDES[normalized] ?? null;
|
|
28099
|
-
}
|
|
28100
|
-
function normalizeRenderColor(color) {
|
|
28101
|
-
const trimmed = color.trim().toLowerCase();
|
|
28102
|
-
if (trimmed.startsWith("rgb")) return trimmed.replace(/\s+/g, "");
|
|
28103
|
-
return trimmed;
|
|
28104
|
-
}
|
|
28105
28129
|
function hexToRgb(_hex) {
|
|
28106
28130
|
const hex = _hex.replace(/^#/, "");
|
|
28107
28131
|
let r;
|
|
@@ -28769,7 +28793,7 @@ Engine = __decorate([__decorateParam(2, ICanvasColorService)], Engine);
|
|
|
28769
28793
|
//#endregion
|
|
28770
28794
|
//#region package.json
|
|
28771
28795
|
var name = "@univerjs/engine-render";
|
|
28772
|
-
var version = "1.0.0-beta.
|
|
28796
|
+
var version = "1.0.0-beta.2";
|
|
28773
28797
|
|
|
28774
28798
|
//#endregion
|
|
28775
28799
|
//#region src/config/config.ts
|
|
@@ -29224,7 +29248,6 @@ const DEFAULT_TRANSFORMER_LAYER_INDEX = 2;
|
|
|
29224
29248
|
const MINI_WIDTH_LIMIT = 20;
|
|
29225
29249
|
const MINI_HEIGHT_LIMIT = 20;
|
|
29226
29250
|
const DEFAULT_CONTROL_PLUS_INDEX = 5e3;
|
|
29227
|
-
const SINGLE_ACTIVE_OBJECT_TYPE_MAP = /* @__PURE__ */ new Set([6]);
|
|
29228
29251
|
const ROTATE_ICON_SIZE = 14;
|
|
29229
29252
|
var TransformerRotateIcon = class extends Rect {
|
|
29230
29253
|
_draw(ctx) {
|
|
@@ -29278,32 +29301,32 @@ var Transformer = class extends _univerjs_core.Disposable {
|
|
|
29278
29301
|
_defineProperty(this, "hoverEnabled", false);
|
|
29279
29302
|
_defineProperty(this, "hoverEnterFunc", void 0);
|
|
29280
29303
|
_defineProperty(this, "hoverLeaveFunc", void 0);
|
|
29281
|
-
_defineProperty(this, "resizeEnabled",
|
|
29282
|
-
_defineProperty(this, "rotateEnabled",
|
|
29304
|
+
_defineProperty(this, "resizeEnabled", DEFAULT_TRANSFORMER_CONFIG.resizeEnabled);
|
|
29305
|
+
_defineProperty(this, "rotateEnabled", DEFAULT_TRANSFORMER_CONFIG.rotateEnabled);
|
|
29283
29306
|
_defineProperty(this, "rotationSnaps", []);
|
|
29284
29307
|
_defineProperty(this, "rotationSnapTolerance", 5);
|
|
29285
|
-
_defineProperty(this, "rotateAnchorOffset",
|
|
29286
|
-
_defineProperty(this, "rotateAnchorPosition",
|
|
29287
|
-
_defineProperty(this, "rotateLineEnabled",
|
|
29288
|
-
_defineProperty(this, "rotateSize",
|
|
29289
|
-
_defineProperty(this, "rotateCornerRadius",
|
|
29290
|
-
_defineProperty(this, "rotateFill",
|
|
29291
|
-
_defineProperty(this, "rotateStroke",
|
|
29292
|
-
_defineProperty(this, "rotateStrokeWidth",
|
|
29293
|
-
_defineProperty(this, "rotateIconEnabled",
|
|
29294
|
-
_defineProperty(this, "rotateIconStroke",
|
|
29295
|
-
_defineProperty(this, "rotateIconStrokeWidth",
|
|
29296
|
-
_defineProperty(this, "borderEnabled",
|
|
29297
|
-
_defineProperty(this, "borderStroke",
|
|
29298
|
-
_defineProperty(this, "borderStrokeWidth",
|
|
29308
|
+
_defineProperty(this, "rotateAnchorOffset", DEFAULT_TRANSFORMER_CONFIG.rotateAnchorOffset);
|
|
29309
|
+
_defineProperty(this, "rotateAnchorPosition", DEFAULT_TRANSFORMER_CONFIG.rotateAnchorPosition);
|
|
29310
|
+
_defineProperty(this, "rotateLineEnabled", DEFAULT_TRANSFORMER_CONFIG.rotateLineEnabled);
|
|
29311
|
+
_defineProperty(this, "rotateSize", DEFAULT_TRANSFORMER_CONFIG.rotateSize);
|
|
29312
|
+
_defineProperty(this, "rotateCornerRadius", DEFAULT_TRANSFORMER_CONFIG.rotateCornerRadius);
|
|
29313
|
+
_defineProperty(this, "rotateFill", DEFAULT_TRANSFORMER_CONFIG.rotateFill);
|
|
29314
|
+
_defineProperty(this, "rotateStroke", DEFAULT_TRANSFORMER_CONFIG.rotateStroke);
|
|
29315
|
+
_defineProperty(this, "rotateStrokeWidth", DEFAULT_TRANSFORMER_CONFIG.rotateStrokeWidth);
|
|
29316
|
+
_defineProperty(this, "rotateIconEnabled", DEFAULT_TRANSFORMER_CONFIG.rotateIconEnabled);
|
|
29317
|
+
_defineProperty(this, "rotateIconStroke", DEFAULT_TRANSFORMER_CONFIG.rotateIconStroke);
|
|
29318
|
+
_defineProperty(this, "rotateIconStrokeWidth", DEFAULT_TRANSFORMER_CONFIG.rotateIconStrokeWidth);
|
|
29319
|
+
_defineProperty(this, "borderEnabled", DEFAULT_TRANSFORMER_CONFIG.borderEnabled);
|
|
29320
|
+
_defineProperty(this, "borderStroke", DEFAULT_TRANSFORMER_CONFIG.borderStroke);
|
|
29321
|
+
_defineProperty(this, "borderStrokeWidth", DEFAULT_TRANSFORMER_CONFIG.borderStrokeWidth);
|
|
29299
29322
|
_defineProperty(this, "borderDash", []);
|
|
29300
|
-
_defineProperty(this, "borderSpacing",
|
|
29301
|
-
_defineProperty(this, "anchorFill",
|
|
29302
|
-
_defineProperty(this, "anchorStroke",
|
|
29303
|
-
_defineProperty(this, "anchorStrokeWidth",
|
|
29304
|
-
_defineProperty(this, "anchorSize",
|
|
29305
|
-
_defineProperty(this, "anchorCornerRadius",
|
|
29306
|
-
_defineProperty(this, "anchorStyle",
|
|
29323
|
+
_defineProperty(this, "borderSpacing", DEFAULT_TRANSFORMER_CONFIG.borderSpacing);
|
|
29324
|
+
_defineProperty(this, "anchorFill", DEFAULT_TRANSFORMER_CONFIG.anchorFill);
|
|
29325
|
+
_defineProperty(this, "anchorStroke", DEFAULT_TRANSFORMER_CONFIG.anchorStroke);
|
|
29326
|
+
_defineProperty(this, "anchorStrokeWidth", DEFAULT_TRANSFORMER_CONFIG.anchorStrokeWidth);
|
|
29327
|
+
_defineProperty(this, "anchorSize", DEFAULT_TRANSFORMER_CONFIG.anchorSize);
|
|
29328
|
+
_defineProperty(this, "anchorCornerRadius", DEFAULT_TRANSFORMER_CONFIG.anchorCornerRadius);
|
|
29329
|
+
_defineProperty(this, "anchorStyle", DEFAULT_TRANSFORMER_CONFIG.anchorStyle);
|
|
29307
29330
|
_defineProperty(this, "anchorSideLongSize", 16);
|
|
29308
29331
|
_defineProperty(this, "anchorSideShortSize", 5);
|
|
29309
29332
|
_defineProperty(this, "anchorSideCornerRadius", 2.5);
|
|
@@ -29311,11 +29334,11 @@ var Transformer = class extends _univerjs_core.Disposable {
|
|
|
29311
29334
|
_defineProperty(this, "anchorShadowBlur", 0);
|
|
29312
29335
|
_defineProperty(this, "anchorShadowOffsetX", 0);
|
|
29313
29336
|
_defineProperty(this, "anchorShadowOffsetY", 0);
|
|
29314
|
-
_defineProperty(this, "keepRatio",
|
|
29337
|
+
_defineProperty(this, "keepRatio", DEFAULT_TRANSFORMER_CONFIG.keepRatio);
|
|
29315
29338
|
_defineProperty(this, "centeredScaling", false);
|
|
29316
29339
|
_defineProperty(this, "zeroLeft", 0);
|
|
29317
29340
|
_defineProperty(this, "zeroTop", 0);
|
|
29318
|
-
_defineProperty(this, "moveBoundaryEnabled",
|
|
29341
|
+
_defineProperty(this, "moveBoundaryEnabled", DEFAULT_TRANSFORMER_CONFIG.moveBoundaryEnabled);
|
|
29319
29342
|
_defineProperty(
|
|
29320
29343
|
this,
|
|
29321
29344
|
/**
|
|
@@ -30648,7 +30671,7 @@ var Transformer = class extends _univerjs_core.Disposable {
|
|
|
30648
30671
|
const { isCropper } = this._getConfig(applyObject);
|
|
30649
30672
|
const targetObject = this._findGroupObject(applyObject);
|
|
30650
30673
|
if (this._selectedObjectMap.has(targetObject.oKey)) return;
|
|
30651
|
-
if (!evt.ctrlKey
|
|
30674
|
+
if (!evt.ctrlKey) {
|
|
30652
30675
|
this._selectedObjectMap.clear();
|
|
30653
30676
|
this._clearControlMap();
|
|
30654
30677
|
}
|
|
@@ -30773,6 +30796,7 @@ var Scene = class extends _univerjs_core.Disposable {
|
|
|
30773
30796
|
_defineProperty(this, "_layers", []);
|
|
30774
30797
|
_defineProperty(this, "_viewports", []);
|
|
30775
30798
|
_defineProperty(this, "_preserveEngineOnRender", false);
|
|
30799
|
+
_defineProperty(this, "_hasPostRenderCanvasMutation", false);
|
|
30776
30800
|
_defineProperty(this, "_scrollbarDragViewport", null);
|
|
30777
30801
|
_defineProperty(this, "_isScrollbarSeeking", false);
|
|
30778
30802
|
_defineProperty(this, "_isScrollbarPreviewDirty", false);
|
|
@@ -31308,12 +31332,19 @@ var Scene = class extends _univerjs_core.Disposable {
|
|
|
31308
31332
|
}
|
|
31309
31333
|
this._estimatedFullRenderDuration += (duration - this._estimatedFullRenderDuration) * SCROLLBAR_SEEK_RENDER_COST_SAMPLE_WEIGHT;
|
|
31310
31334
|
}
|
|
31335
|
+
_notifyAfterRender(canvasInstance) {
|
|
31336
|
+
if (!canvasInstance) {
|
|
31337
|
+
this._afterRender$.next(canvasInstance);
|
|
31338
|
+
return false;
|
|
31339
|
+
}
|
|
31340
|
+
return canvasInstance.getContext().detectBitmapMutation(() => this._afterRender$.next(canvasInstance));
|
|
31341
|
+
}
|
|
31311
31342
|
render(parentCtx) {
|
|
31312
31343
|
var _this$getEngine2;
|
|
31313
31344
|
if (!this.isDirty()) return;
|
|
31314
31345
|
const layers = this._layers.sort(_univerjs_core.sortRules);
|
|
31315
31346
|
const canvasInstance = (_this$getEngine2 = this.getEngine()) === null || _this$getEngine2 === void 0 ? void 0 : _this$getEngine2.getCanvas();
|
|
31316
|
-
const shouldTryPreservingEngine = this._preserveEngineOnRender && parentCtx == null && canvasInstance != null;
|
|
31347
|
+
const shouldTryPreservingEngine = this._preserveEngineOnRender && !this._hasPostRenderCanvasMutation && parentCtx == null && canvasInstance != null;
|
|
31317
31348
|
const isScrollbarSeekRender = this._isScrollbarSeeking && parentCtx == null && canvasInstance != null;
|
|
31318
31349
|
const shouldMeasureFullRender = parentCtx == null && canvasInstance != null;
|
|
31319
31350
|
const fullRenderStartedAt = _univerjs_core.Tools.now();
|
|
@@ -31345,7 +31376,7 @@ var Scene = class extends _univerjs_core.Disposable {
|
|
|
31345
31376
|
}
|
|
31346
31377
|
this._beforeRender$.next(canvasInstance);
|
|
31347
31378
|
for (let i = 0, len = layers.length; i < len; i++) layers[i].render(parentCtx, i === len - 1, layerRenderOptions);
|
|
31348
|
-
this.
|
|
31379
|
+
this._hasPostRenderCanvasMutation = this._notifyAfterRender(canvasInstance);
|
|
31349
31380
|
this._recordRenderedViewportScrollPositions();
|
|
31350
31381
|
if (shouldMeasureFullRender) this._recordFullRenderDuration(_univerjs_core.Tools.now() - fullRenderStartedAt, isScrollbarSeekRender);
|
|
31351
31382
|
}
|
|
@@ -31946,7 +31977,7 @@ let RenderManagerService = class RenderManagerService extends _univerjs_core.Dis
|
|
|
31946
31977
|
_defineProperty(this, "_renderDisposed$", new rxjs.Subject());
|
|
31947
31978
|
_defineProperty(this, "disposed$", this._renderDisposed$.asObservable());
|
|
31948
31979
|
_defineProperty(this, "_renderDependencies", /* @__PURE__ */ new Map());
|
|
31949
|
-
this.
|
|
31980
|
+
this._initThemeListener();
|
|
31950
31981
|
}
|
|
31951
31982
|
dispose() {
|
|
31952
31983
|
super.dispose();
|
|
@@ -31987,8 +32018,8 @@ let RenderManagerService = class RenderManagerService extends _univerjs_core.Dis
|
|
|
31987
32018
|
_getRenderDepsByType(type) {
|
|
31988
32019
|
return Array.from(this._renderDependencies.get(type) ?? []);
|
|
31989
32020
|
}
|
|
31990
|
-
|
|
31991
|
-
this.disposeWithMe(this._themeService.darkMode
|
|
32021
|
+
_initThemeListener() {
|
|
32022
|
+
this.disposeWithMe((0, rxjs.merge)(this._themeService.currentTheme$, this._themeService.darkMode$).subscribe(() => {
|
|
31992
32023
|
this.getRenderAll().forEach((renderer) => {
|
|
31993
32024
|
renderer.components.forEach((component) => {
|
|
31994
32025
|
component.makeForceDirty(true);
|
|
@@ -33296,6 +33327,7 @@ exports.DEFAULT_OFFSET_SPACING = DEFAULT_OFFSET_SPACING;
|
|
|
33296
33327
|
exports.DEFAULT_PADDING_DATA = DEFAULT_PADDING_DATA;
|
|
33297
33328
|
exports.DEFAULT_SKELETON_FOOTER = DEFAULT_SKELETON_FOOTER;
|
|
33298
33329
|
exports.DEFAULT_SKELETON_HEADER = DEFAULT_SKELETON_HEADER;
|
|
33330
|
+
exports.DEFAULT_TRANSFORMER_CONFIG = DEFAULT_TRANSFORMER_CONFIG;
|
|
33299
33331
|
exports.DOCS_EXTENSION_TYPE = DOCS_EXTENSION_TYPE;
|
|
33300
33332
|
exports.DOCUMENT_CONTEXT_CLIP_TYPE = DOCUMENT_CONTEXT_CLIP_TYPE;
|
|
33301
33333
|
exports.DRAWING_OBJECT_LAYER_INDEX = DRAWING_OBJECT_LAYER_INDEX;
|