@univerjs/engine-render 0.23.0 → 0.24.0-insiders.20260527-b1d726f
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 +33 -27
- package/lib/es/index.js +32 -26
- package/lib/types/components/sheets/interfaces.d.ts +2 -2
- package/lib/umd/index.js +2 -2
- package/package.json +3 -3
- package/LICENSE +0 -176
package/lib/cjs/index.js
CHANGED
|
@@ -4715,8 +4715,9 @@ var SpreadsheetColumnHeader = class extends SpreadsheetHeader {
|
|
|
4715
4715
|
const segment = spreadsheetSkeleton.rowColumnSegment;
|
|
4716
4716
|
if (!segment) return;
|
|
4717
4717
|
if (segment.startColumn === -1 && segment.endColumn === -1) return;
|
|
4718
|
-
const {
|
|
4719
|
-
|
|
4718
|
+
const { columnHeaderHeight, columnHeaderHeightAndMarginTop, rowHeaderWidthAndMarginLeft } = spreadsheetSkeleton;
|
|
4719
|
+
const marginTop = columnHeaderHeightAndMarginTop - columnHeaderHeight;
|
|
4720
|
+
ctx.translateWithPrecision(rowHeaderWidthAndMarginLeft, marginTop);
|
|
4720
4721
|
const extensions = this.getExtensionsByOrder();
|
|
4721
4722
|
for (const extension of extensions) extension.draw(ctx, parentScale, spreadsheetSkeleton);
|
|
4722
4723
|
}
|
|
@@ -4724,8 +4725,9 @@ var SpreadsheetColumnHeader = class extends SpreadsheetHeader {
|
|
|
4724
4725
|
const oCoord = this.getInverseCoord(coord);
|
|
4725
4726
|
const skeleton = this.getSkeleton();
|
|
4726
4727
|
if (!skeleton) return false;
|
|
4727
|
-
const {
|
|
4728
|
-
|
|
4728
|
+
const { rowHeaderWidthAndMarginLeft, columnHeaderHeight, columnHeaderHeightAndMarginTop } = skeleton;
|
|
4729
|
+
const marginTop = columnHeaderHeightAndMarginTop - columnHeaderHeight;
|
|
4730
|
+
if (oCoord.x > rowHeaderWidthAndMarginLeft && oCoord.y >= marginTop && oCoord.y <= columnHeaderHeightAndMarginTop) return true;
|
|
4729
4731
|
return false;
|
|
4730
4732
|
}
|
|
4731
4733
|
_initialDefaultExtension() {
|
|
@@ -18974,8 +18976,9 @@ var SpreadsheetRowHeader = class extends SpreadsheetHeader {
|
|
|
18974
18976
|
const segment = spreadsheetSkeleton.rowColumnSegment;
|
|
18975
18977
|
if (!segment) return;
|
|
18976
18978
|
if (segment.startRow === -1 && segment.endRow === -1) return;
|
|
18977
|
-
const {
|
|
18978
|
-
|
|
18979
|
+
const { columnHeaderHeightAndMarginTop, rowHeaderWidth, rowHeaderWidthAndMarginLeft } = spreadsheetSkeleton;
|
|
18980
|
+
const marginLeft = rowHeaderWidthAndMarginLeft - rowHeaderWidth;
|
|
18981
|
+
ctx.translateWithPrecision(marginLeft, columnHeaderHeightAndMarginTop);
|
|
18979
18982
|
const extensions = this.getExtensionsByOrder();
|
|
18980
18983
|
for (const extension of extensions) extension.draw(ctx, parentScale, spreadsheetSkeleton);
|
|
18981
18984
|
}
|
|
@@ -18983,8 +18986,9 @@ var SpreadsheetRowHeader = class extends SpreadsheetHeader {
|
|
|
18983
18986
|
const oCoord = this.getInverseCoord(coord);
|
|
18984
18987
|
const skeleton = this.getSkeleton();
|
|
18985
18988
|
if (!skeleton) return false;
|
|
18986
|
-
const { rowHeaderWidth,
|
|
18987
|
-
|
|
18989
|
+
const { rowHeaderWidth, rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = skeleton;
|
|
18990
|
+
const marginLeft = rowHeaderWidthAndMarginLeft - rowHeaderWidth;
|
|
18991
|
+
if (oCoord.x >= marginLeft && oCoord.x <= rowHeaderWidthAndMarginLeft && oCoord.y > columnHeaderHeightAndMarginTop) return true;
|
|
18988
18992
|
return false;
|
|
18989
18993
|
}
|
|
18990
18994
|
_initialDefaultExtension() {
|
|
@@ -22144,8 +22148,8 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
22144
22148
|
const oCoord = this.getInverseCoord(coord);
|
|
22145
22149
|
const skeleton = this.getSkeleton();
|
|
22146
22150
|
if (!skeleton) return false;
|
|
22147
|
-
const {
|
|
22148
|
-
if (oCoord.x >
|
|
22151
|
+
const { rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = skeleton;
|
|
22152
|
+
if (oCoord.x > rowHeaderWidthAndMarginLeft && oCoord.y > columnHeaderHeightAndMarginTop) return true;
|
|
22149
22153
|
return false;
|
|
22150
22154
|
}
|
|
22151
22155
|
getNoMergeCellPositionByIndex(rowIndex, columnIndex) {
|
|
@@ -22213,7 +22217,7 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
22213
22217
|
}
|
|
22214
22218
|
renderByViewports(mainCtx, viewportInfo, spreadsheetSkeleton) {
|
|
22215
22219
|
const { diffBounds, diffX, diffY, viewPortPosition, cacheCanvas, leftOrigin, topOrigin, bufferEdgeX, bufferEdgeY, isDirty: isViewportDirty, isForceDirty: isViewportForceDirty } = viewportInfo;
|
|
22216
|
-
const {
|
|
22220
|
+
const { rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = spreadsheetSkeleton;
|
|
22217
22221
|
const { a: scaleX = 1, d: scaleY = 1 } = mainCtx.getTransform();
|
|
22218
22222
|
const bufferEdgeSizeX = bufferEdgeX * scaleX / window.devicePixelRatio;
|
|
22219
22223
|
const bufferEdgeSizeY = bufferEdgeY * scaleY / window.devicePixelRatio;
|
|
@@ -22221,8 +22225,10 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
22221
22225
|
cacheCtx.save();
|
|
22222
22226
|
const isForceDirty = isViewportForceDirty || this.isForceDirty();
|
|
22223
22227
|
const isDirty = isViewportDirty || this.isDirty();
|
|
22224
|
-
|
|
22225
|
-
|
|
22228
|
+
const isScrollJumpOutsideCache = Math.abs(diffX) * scaleX >= cacheCanvas.getWidth() || Math.abs(diffY) * scaleY >= cacheCanvas.getHeight();
|
|
22229
|
+
const shouldRefreshCache = isDirty || isForceDirty || isScrollJumpOutsideCache;
|
|
22230
|
+
if (diffBounds.length === 0 || diffX === 0 && diffY === 0 || shouldRefreshCache) {
|
|
22231
|
+
if (shouldRefreshCache) {
|
|
22226
22232
|
this.addRenderTagToScene("scrolling", false);
|
|
22227
22233
|
this.refreshCacheCanvas(viewportInfo, {
|
|
22228
22234
|
cacheCanvas,
|
|
@@ -22246,20 +22252,20 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
22246
22252
|
bufferEdgeY,
|
|
22247
22253
|
scaleX,
|
|
22248
22254
|
scaleY,
|
|
22249
|
-
|
|
22250
|
-
|
|
22255
|
+
columnHeaderHeightAndMarginTop,
|
|
22256
|
+
rowHeaderWidthAndMarginLeft
|
|
22251
22257
|
});
|
|
22252
22258
|
}
|
|
22253
22259
|
const sourceLeft = bufferEdgeSizeX * Math.min(1, window.devicePixelRatio);
|
|
22254
22260
|
const sourceTop = bufferEdgeSizeY * Math.min(1, window.devicePixelRatio);
|
|
22255
22261
|
const { left, top, right, bottom } = viewPortPosition;
|
|
22256
|
-
const dw = right - left +
|
|
22257
|
-
const dh = bottom - top +
|
|
22262
|
+
const dw = right - left + rowHeaderWidthAndMarginLeft;
|
|
22263
|
+
const dh = bottom - top + columnHeaderHeightAndMarginTop;
|
|
22258
22264
|
this._applyCache(cacheCanvas, mainCtx, sourceLeft, sourceTop, dw, dh, left, top, dw, dh);
|
|
22259
22265
|
cacheCtx.restore();
|
|
22260
22266
|
}
|
|
22261
22267
|
paintNewAreaForScrolling(viewportInfo, param) {
|
|
22262
|
-
const { cacheCanvas, cacheCtx, mainCtx, topOrigin, leftOrigin, bufferEdgeX, bufferEdgeY, scaleX, scaleY,
|
|
22268
|
+
const { cacheCanvas, cacheCtx, mainCtx, topOrigin, leftOrigin, bufferEdgeX, bufferEdgeY, scaleX, scaleY, columnHeaderHeightAndMarginTop, rowHeaderWidthAndMarginLeft } = param;
|
|
22263
22269
|
const { shouldCacheUpdate, diffCacheBounds, diffX, diffY } = viewportInfo;
|
|
22264
22270
|
cacheCtx.save();
|
|
22265
22271
|
cacheCtx.setTransform(1, 0, 0, 1, 0, 0);
|
|
@@ -22272,8 +22278,8 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
22272
22278
|
cacheCtx.translateWithPrecision(m.e / m.a - leftOrigin + bufferEdgeX, m.f / m.d - topOrigin + bufferEdgeY);
|
|
22273
22279
|
if (shouldCacheUpdate) for (const diffBound of diffCacheBounds) {
|
|
22274
22280
|
const { left: diffLeft, right: diffRight, bottom: diffBottom, top: diffTop } = diffBound;
|
|
22275
|
-
const x = diffLeft -
|
|
22276
|
-
const y = diffTop -
|
|
22281
|
+
const x = diffLeft - rowHeaderWidthAndMarginLeft;
|
|
22282
|
+
const y = diffTop - columnHeaderHeightAndMarginTop;
|
|
22277
22283
|
const w = diffRight - diffLeft;
|
|
22278
22284
|
const h = diffBottom - diffTop;
|
|
22279
22285
|
cacheCtx.clearRectByPrecision(x, y, w, h);
|
|
@@ -22319,9 +22325,9 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
22319
22325
|
if (!segment) return;
|
|
22320
22326
|
if (segment.startRow === -1 && segment.endRow === -1 || segment.startColumn === -1 && segment.endColumn === -1) return;
|
|
22321
22327
|
mainCtx.save();
|
|
22322
|
-
const {
|
|
22323
|
-
mainCtx.translateWithPrecision(
|
|
22324
|
-
(_this$getScene = this.getScene()) === null || _this$getScene === void 0 || _this$getScene.updateTransformerZero(
|
|
22328
|
+
const { rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = spreadsheetSkeleton;
|
|
22329
|
+
mainCtx.translateWithPrecision(rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop);
|
|
22330
|
+
(_this$getScene = this.getScene()) === null || _this$getScene === void 0 || _this$getScene.updateTransformerZero(rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop);
|
|
22325
22331
|
const { viewportKey } = viewportInfo;
|
|
22326
22332
|
if (sheetContentViewportKeys.includes(viewportKey)) if (viewportInfo && viewportInfo.cacheCanvas) this.renderByViewports(mainCtx, viewportInfo, spreadsheetSkeleton);
|
|
22327
22333
|
else this._draw(mainCtx, viewportInfo);
|
|
@@ -24458,14 +24464,13 @@ let Engine = class Engine extends _univerjs_core.Disposable {
|
|
|
24458
24464
|
}
|
|
24459
24465
|
_getPassive() {
|
|
24460
24466
|
let passiveSupported = false;
|
|
24461
|
-
const noop = () => {};
|
|
24462
24467
|
try {
|
|
24463
24468
|
const options = { passive: { get() {
|
|
24464
24469
|
passiveSupported = true;
|
|
24465
24470
|
} } };
|
|
24466
24471
|
const canvasEle = this.getCanvasElement();
|
|
24467
|
-
canvasEle.addEventListener("test", noop, options);
|
|
24468
|
-
canvasEle.removeEventListener("test", noop, options);
|
|
24472
|
+
canvasEle.addEventListener("test", _univerjs_core.noop, options);
|
|
24473
|
+
canvasEle.removeEventListener("test", _univerjs_core.noop, options);
|
|
24469
24474
|
} catch (e) {}
|
|
24470
24475
|
return passiveSupported;
|
|
24471
24476
|
}
|
|
@@ -24492,7 +24497,7 @@ Engine = __decorate([__decorateParam(2, ICanvasColorService)], Engine);
|
|
|
24492
24497
|
//#endregion
|
|
24493
24498
|
//#region package.json
|
|
24494
24499
|
var name = "@univerjs/engine-render";
|
|
24495
|
-
var version = "0.
|
|
24500
|
+
var version = "0.24.0-insiders.20260527-b1d726f";
|
|
24496
24501
|
|
|
24497
24502
|
//#endregion
|
|
24498
24503
|
//#region src/config/config.ts
|
|
@@ -28550,6 +28555,7 @@ var Viewport = class {
|
|
|
28550
28555
|
}
|
|
28551
28556
|
_calcDiffCacheBound(prevBound, currBound) {
|
|
28552
28557
|
if (!prevBound) return [currBound];
|
|
28558
|
+
if (prevBound.right <= currBound.left || currBound.right <= prevBound.left || prevBound.bottom <= currBound.top || currBound.bottom <= prevBound.top) return [currBound];
|
|
28553
28559
|
const additionalAreas = [];
|
|
28554
28560
|
if (currBound.left < prevBound.left) additionalAreas.push({
|
|
28555
28561
|
top: currBound.top,
|
package/lib/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as EnUs } from "./en-us-ClVoWMyT.js";
|
|
2
|
-
import { AlignTypeH, AlignTypeV, BaselineOffset, BooleanNumber, BorderStyleTypes, BulletAlignment, COLORS, CellValueType, ColorKit, ColumnSeparatorType, CustomDecorationType, CustomRangeType, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_STYLES, DataStreamTreeNodeType, DataStreamTreeTokenType, Disposable, DisposableCollection, DocumentDataModel, DocumentFlavor, EventSubject, FontStyleType, GridType, HorizontalAlign, IConfigService, IContextService, IUniverInstanceService, Inject, Injector, ListGlyphType, LocaleService, MOVE_BUFFER_VALUE, NAMED_STYLE_MAP, NAMED_STYLE_SPACE_MAP, NumberUnitType, ObjectMatrix, ObjectRelativeFromH, ObjectRelativeFromV, PRESET_LIST_TYPE, PageOrientType, Plugin, PositionedObjectLayoutType, Range, Rectangle, Registry, SectionType, SheetSkeleton, Skeleton, SpacingRule, TableAlignmentType, TableRowHeightRule, TableTextWrapType, TextDecoration, ThemeService, Tools, UniverInstanceType, VerticalAlign, VerticalAlignmentType, WrapStrategy, WrapTextType, addLinkToDocumentModel, checkParagraphHasIndentByStyle, createIdentifier, deleteContent, extractPureTextFromCell, getCellInfoInMergeData, getColorStyle, getDisplayValueFromCell, horizontalLineSegmentsSubtraction, insertTextToContent, invertColorByMatrix, isClassDependencyItem, isNullCell, isWhiteColor, merge, mergeWith, numberToABC, numberToListABC, registerDependencies, remove, requestImmediateMacroTask, searchArray, sortRules, sortRulesByDesc, toDisposable } from "@univerjs/core";
|
|
2
|
+
import { AlignTypeH, AlignTypeV, BaselineOffset, BooleanNumber, BorderStyleTypes, BulletAlignment, COLORS, CellValueType, ColorKit, ColumnSeparatorType, CustomDecorationType, CustomRangeType, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_STYLES, DataStreamTreeNodeType, DataStreamTreeTokenType, Disposable, DisposableCollection, DocumentDataModel, DocumentFlavor, EventSubject, FontStyleType, GridType, HorizontalAlign, IConfigService, IContextService, IUniverInstanceService, Inject, Injector, ListGlyphType, LocaleService, MOVE_BUFFER_VALUE, NAMED_STYLE_MAP, NAMED_STYLE_SPACE_MAP, NumberUnitType, ObjectMatrix, ObjectRelativeFromH, ObjectRelativeFromV, PRESET_LIST_TYPE, PageOrientType, Plugin, PositionedObjectLayoutType, Range, Rectangle, Registry, SectionType, SheetSkeleton, Skeleton, SpacingRule, TableAlignmentType, TableRowHeightRule, TableTextWrapType, TextDecoration, ThemeService, Tools, UniverInstanceType, VerticalAlign, VerticalAlignmentType, WrapStrategy, WrapTextType, addLinkToDocumentModel, checkParagraphHasIndentByStyle, createIdentifier, deleteContent, extractPureTextFromCell, getCellInfoInMergeData, getColorStyle, getDisplayValueFromCell, horizontalLineSegmentsSubtraction, insertTextToContent, invertColorByMatrix, isClassDependencyItem, isNullCell, isWhiteColor, merge, mergeWith, noop, numberToABC, numberToListABC, registerDependencies, remove, requestImmediateMacroTask, searchArray, sortRules, sortRulesByDesc, toDisposable } from "@univerjs/core";
|
|
3
3
|
import * as cjk from "cjk-regex";
|
|
4
4
|
import { BehaviorSubject, Observable, Subject, Subscription, debounceTime, distinctUntilChanged, shareReplay, startWith } from "rxjs";
|
|
5
5
|
import { parse } from "opentype.js";
|
|
@@ -4686,8 +4686,9 @@ var SpreadsheetColumnHeader = class extends SpreadsheetHeader {
|
|
|
4686
4686
|
const segment = spreadsheetSkeleton.rowColumnSegment;
|
|
4687
4687
|
if (!segment) return;
|
|
4688
4688
|
if (segment.startColumn === -1 && segment.endColumn === -1) return;
|
|
4689
|
-
const {
|
|
4690
|
-
|
|
4689
|
+
const { columnHeaderHeight, columnHeaderHeightAndMarginTop, rowHeaderWidthAndMarginLeft } = spreadsheetSkeleton;
|
|
4690
|
+
const marginTop = columnHeaderHeightAndMarginTop - columnHeaderHeight;
|
|
4691
|
+
ctx.translateWithPrecision(rowHeaderWidthAndMarginLeft, marginTop);
|
|
4691
4692
|
const extensions = this.getExtensionsByOrder();
|
|
4692
4693
|
for (const extension of extensions) extension.draw(ctx, parentScale, spreadsheetSkeleton);
|
|
4693
4694
|
}
|
|
@@ -4695,8 +4696,9 @@ var SpreadsheetColumnHeader = class extends SpreadsheetHeader {
|
|
|
4695
4696
|
const oCoord = this.getInverseCoord(coord);
|
|
4696
4697
|
const skeleton = this.getSkeleton();
|
|
4697
4698
|
if (!skeleton) return false;
|
|
4698
|
-
const {
|
|
4699
|
-
|
|
4699
|
+
const { rowHeaderWidthAndMarginLeft, columnHeaderHeight, columnHeaderHeightAndMarginTop } = skeleton;
|
|
4700
|
+
const marginTop = columnHeaderHeightAndMarginTop - columnHeaderHeight;
|
|
4701
|
+
if (oCoord.x > rowHeaderWidthAndMarginLeft && oCoord.y >= marginTop && oCoord.y <= columnHeaderHeightAndMarginTop) return true;
|
|
4700
4702
|
return false;
|
|
4701
4703
|
}
|
|
4702
4704
|
_initialDefaultExtension() {
|
|
@@ -18945,8 +18947,9 @@ var SpreadsheetRowHeader = class extends SpreadsheetHeader {
|
|
|
18945
18947
|
const segment = spreadsheetSkeleton.rowColumnSegment;
|
|
18946
18948
|
if (!segment) return;
|
|
18947
18949
|
if (segment.startRow === -1 && segment.endRow === -1) return;
|
|
18948
|
-
const {
|
|
18949
|
-
|
|
18950
|
+
const { columnHeaderHeightAndMarginTop, rowHeaderWidth, rowHeaderWidthAndMarginLeft } = spreadsheetSkeleton;
|
|
18951
|
+
const marginLeft = rowHeaderWidthAndMarginLeft - rowHeaderWidth;
|
|
18952
|
+
ctx.translateWithPrecision(marginLeft, columnHeaderHeightAndMarginTop);
|
|
18950
18953
|
const extensions = this.getExtensionsByOrder();
|
|
18951
18954
|
for (const extension of extensions) extension.draw(ctx, parentScale, spreadsheetSkeleton);
|
|
18952
18955
|
}
|
|
@@ -18954,8 +18957,9 @@ var SpreadsheetRowHeader = class extends SpreadsheetHeader {
|
|
|
18954
18957
|
const oCoord = this.getInverseCoord(coord);
|
|
18955
18958
|
const skeleton = this.getSkeleton();
|
|
18956
18959
|
if (!skeleton) return false;
|
|
18957
|
-
const { rowHeaderWidth,
|
|
18958
|
-
|
|
18960
|
+
const { rowHeaderWidth, rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = skeleton;
|
|
18961
|
+
const marginLeft = rowHeaderWidthAndMarginLeft - rowHeaderWidth;
|
|
18962
|
+
if (oCoord.x >= marginLeft && oCoord.x <= rowHeaderWidthAndMarginLeft && oCoord.y > columnHeaderHeightAndMarginTop) return true;
|
|
18959
18963
|
return false;
|
|
18960
18964
|
}
|
|
18961
18965
|
_initialDefaultExtension() {
|
|
@@ -22115,8 +22119,8 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
22115
22119
|
const oCoord = this.getInverseCoord(coord);
|
|
22116
22120
|
const skeleton = this.getSkeleton();
|
|
22117
22121
|
if (!skeleton) return false;
|
|
22118
|
-
const {
|
|
22119
|
-
if (oCoord.x >
|
|
22122
|
+
const { rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = skeleton;
|
|
22123
|
+
if (oCoord.x > rowHeaderWidthAndMarginLeft && oCoord.y > columnHeaderHeightAndMarginTop) return true;
|
|
22120
22124
|
return false;
|
|
22121
22125
|
}
|
|
22122
22126
|
getNoMergeCellPositionByIndex(rowIndex, columnIndex) {
|
|
@@ -22184,7 +22188,7 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
22184
22188
|
}
|
|
22185
22189
|
renderByViewports(mainCtx, viewportInfo, spreadsheetSkeleton) {
|
|
22186
22190
|
const { diffBounds, diffX, diffY, viewPortPosition, cacheCanvas, leftOrigin, topOrigin, bufferEdgeX, bufferEdgeY, isDirty: isViewportDirty, isForceDirty: isViewportForceDirty } = viewportInfo;
|
|
22187
|
-
const {
|
|
22191
|
+
const { rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = spreadsheetSkeleton;
|
|
22188
22192
|
const { a: scaleX = 1, d: scaleY = 1 } = mainCtx.getTransform();
|
|
22189
22193
|
const bufferEdgeSizeX = bufferEdgeX * scaleX / window.devicePixelRatio;
|
|
22190
22194
|
const bufferEdgeSizeY = bufferEdgeY * scaleY / window.devicePixelRatio;
|
|
@@ -22192,8 +22196,10 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
22192
22196
|
cacheCtx.save();
|
|
22193
22197
|
const isForceDirty = isViewportForceDirty || this.isForceDirty();
|
|
22194
22198
|
const isDirty = isViewportDirty || this.isDirty();
|
|
22195
|
-
|
|
22196
|
-
|
|
22199
|
+
const isScrollJumpOutsideCache = Math.abs(diffX) * scaleX >= cacheCanvas.getWidth() || Math.abs(diffY) * scaleY >= cacheCanvas.getHeight();
|
|
22200
|
+
const shouldRefreshCache = isDirty || isForceDirty || isScrollJumpOutsideCache;
|
|
22201
|
+
if (diffBounds.length === 0 || diffX === 0 && diffY === 0 || shouldRefreshCache) {
|
|
22202
|
+
if (shouldRefreshCache) {
|
|
22197
22203
|
this.addRenderTagToScene("scrolling", false);
|
|
22198
22204
|
this.refreshCacheCanvas(viewportInfo, {
|
|
22199
22205
|
cacheCanvas,
|
|
@@ -22217,20 +22223,20 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
22217
22223
|
bufferEdgeY,
|
|
22218
22224
|
scaleX,
|
|
22219
22225
|
scaleY,
|
|
22220
|
-
|
|
22221
|
-
|
|
22226
|
+
columnHeaderHeightAndMarginTop,
|
|
22227
|
+
rowHeaderWidthAndMarginLeft
|
|
22222
22228
|
});
|
|
22223
22229
|
}
|
|
22224
22230
|
const sourceLeft = bufferEdgeSizeX * Math.min(1, window.devicePixelRatio);
|
|
22225
22231
|
const sourceTop = bufferEdgeSizeY * Math.min(1, window.devicePixelRatio);
|
|
22226
22232
|
const { left, top, right, bottom } = viewPortPosition;
|
|
22227
|
-
const dw = right - left +
|
|
22228
|
-
const dh = bottom - top +
|
|
22233
|
+
const dw = right - left + rowHeaderWidthAndMarginLeft;
|
|
22234
|
+
const dh = bottom - top + columnHeaderHeightAndMarginTop;
|
|
22229
22235
|
this._applyCache(cacheCanvas, mainCtx, sourceLeft, sourceTop, dw, dh, left, top, dw, dh);
|
|
22230
22236
|
cacheCtx.restore();
|
|
22231
22237
|
}
|
|
22232
22238
|
paintNewAreaForScrolling(viewportInfo, param) {
|
|
22233
|
-
const { cacheCanvas, cacheCtx, mainCtx, topOrigin, leftOrigin, bufferEdgeX, bufferEdgeY, scaleX, scaleY,
|
|
22239
|
+
const { cacheCanvas, cacheCtx, mainCtx, topOrigin, leftOrigin, bufferEdgeX, bufferEdgeY, scaleX, scaleY, columnHeaderHeightAndMarginTop, rowHeaderWidthAndMarginLeft } = param;
|
|
22234
22240
|
const { shouldCacheUpdate, diffCacheBounds, diffX, diffY } = viewportInfo;
|
|
22235
22241
|
cacheCtx.save();
|
|
22236
22242
|
cacheCtx.setTransform(1, 0, 0, 1, 0, 0);
|
|
@@ -22243,8 +22249,8 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
22243
22249
|
cacheCtx.translateWithPrecision(m.e / m.a - leftOrigin + bufferEdgeX, m.f / m.d - topOrigin + bufferEdgeY);
|
|
22244
22250
|
if (shouldCacheUpdate) for (const diffBound of diffCacheBounds) {
|
|
22245
22251
|
const { left: diffLeft, right: diffRight, bottom: diffBottom, top: diffTop } = diffBound;
|
|
22246
|
-
const x = diffLeft -
|
|
22247
|
-
const y = diffTop -
|
|
22252
|
+
const x = diffLeft - rowHeaderWidthAndMarginLeft;
|
|
22253
|
+
const y = diffTop - columnHeaderHeightAndMarginTop;
|
|
22248
22254
|
const w = diffRight - diffLeft;
|
|
22249
22255
|
const h = diffBottom - diffTop;
|
|
22250
22256
|
cacheCtx.clearRectByPrecision(x, y, w, h);
|
|
@@ -22290,9 +22296,9 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
22290
22296
|
if (!segment) return;
|
|
22291
22297
|
if (segment.startRow === -1 && segment.endRow === -1 || segment.startColumn === -1 && segment.endColumn === -1) return;
|
|
22292
22298
|
mainCtx.save();
|
|
22293
|
-
const {
|
|
22294
|
-
mainCtx.translateWithPrecision(
|
|
22295
|
-
(_this$getScene = this.getScene()) === null || _this$getScene === void 0 || _this$getScene.updateTransformerZero(
|
|
22299
|
+
const { rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = spreadsheetSkeleton;
|
|
22300
|
+
mainCtx.translateWithPrecision(rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop);
|
|
22301
|
+
(_this$getScene = this.getScene()) === null || _this$getScene === void 0 || _this$getScene.updateTransformerZero(rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop);
|
|
22296
22302
|
const { viewportKey } = viewportInfo;
|
|
22297
22303
|
if (sheetContentViewportKeys.includes(viewportKey)) if (viewportInfo && viewportInfo.cacheCanvas) this.renderByViewports(mainCtx, viewportInfo, spreadsheetSkeleton);
|
|
22298
22304
|
else this._draw(mainCtx, viewportInfo);
|
|
@@ -24429,7 +24435,6 @@ let Engine = class Engine extends Disposable {
|
|
|
24429
24435
|
}
|
|
24430
24436
|
_getPassive() {
|
|
24431
24437
|
let passiveSupported = false;
|
|
24432
|
-
const noop = () => {};
|
|
24433
24438
|
try {
|
|
24434
24439
|
const options = { passive: { get() {
|
|
24435
24440
|
passiveSupported = true;
|
|
@@ -24463,7 +24468,7 @@ Engine = __decorate([__decorateParam(2, ICanvasColorService)], Engine);
|
|
|
24463
24468
|
//#endregion
|
|
24464
24469
|
//#region package.json
|
|
24465
24470
|
var name = "@univerjs/engine-render";
|
|
24466
|
-
var version = "0.
|
|
24471
|
+
var version = "0.24.0-insiders.20260527-b1d726f";
|
|
24467
24472
|
|
|
24468
24473
|
//#endregion
|
|
24469
24474
|
//#region src/config/config.ts
|
|
@@ -28521,6 +28526,7 @@ var Viewport = class {
|
|
|
28521
28526
|
}
|
|
28522
28527
|
_calcDiffCacheBound(prevBound, currBound) {
|
|
28523
28528
|
if (!prevBound) return [currBound];
|
|
28529
|
+
if (prevBound.right <= currBound.left || currBound.right <= prevBound.left || prevBound.bottom <= currBound.top || currBound.bottom <= prevBound.top) return [currBound];
|
|
28524
28530
|
const additionalAreas = [];
|
|
28525
28531
|
if (currBound.left < prevBound.left) additionalAreas.push({
|
|
28526
28532
|
top: currBound.top,
|
|
@@ -80,8 +80,8 @@ export interface IPaintForScrolling {
|
|
|
80
80
|
leftOrigin: number;
|
|
81
81
|
bufferEdgeX: number;
|
|
82
82
|
bufferEdgeY: number;
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
rowHeaderWidthAndMarginLeft: number;
|
|
84
|
+
columnHeaderHeightAndMarginTop: number;
|
|
85
85
|
scaleX: number;
|
|
86
86
|
scaleY: number;
|
|
87
87
|
}
|