@univerjs/engine-render 0.2.9 → 0.2.11
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 +2 -2
- package/lib/es/index.js +149 -95
- package/lib/types/components/docs/text-selection/text-selection-render-manager.d.ts +3 -5
- package/lib/types/components/sheets/column-header.d.ts +4 -0
- package/lib/types/components/sheets/extensions/column-header-layout.d.ts +3 -0
- package/lib/types/components/sheets/extensions/sheet-extension.d.ts +10 -0
- package/lib/types/components/sheets/sheet-skeleton.d.ts +10 -54
- package/lib/types/engine.d.ts +1 -1
- package/lib/types/layer.d.ts +15 -7
- package/lib/types/render-manager/render-manager.service.d.ts +4 -4
- package/lib/types/scene.d.ts +30 -11
- package/lib/types/shape/shape.d.ts +5 -1
- package/lib/umd/index.js +2 -2
- package/package.json +5 -5
package/lib/es/index.js
CHANGED
|
@@ -4319,13 +4319,11 @@ const _SpreadsheetColumnHeader = class _SpreadsheetColumnHeader extends Spreadsh
|
|
|
4319
4319
|
}
|
|
4320
4320
|
draw(ctx, bounds) {
|
|
4321
4321
|
const spreadsheetSkeleton = this.getSkeleton();
|
|
4322
|
-
if (!spreadsheetSkeleton)
|
|
4323
|
-
return;
|
|
4322
|
+
if (!spreadsheetSkeleton) return;
|
|
4324
4323
|
const parentScale = this.getParentScale();
|
|
4325
4324
|
spreadsheetSkeleton.calculateSegment(bounds);
|
|
4326
4325
|
const segment = spreadsheetSkeleton.rowColumnSegment;
|
|
4327
|
-
if (!segment || segment.startColumn === -1 && segment.endColumn === -1)
|
|
4328
|
-
return;
|
|
4326
|
+
if (!segment || segment.startColumn === -1 && segment.endColumn === -1) return;
|
|
4329
4327
|
const { rowHeaderWidth } = spreadsheetSkeleton;
|
|
4330
4328
|
ctx.translateWithPrecision(rowHeaderWidth, 0);
|
|
4331
4329
|
const extensions = this.getExtensionsByOrder();
|
|
@@ -4346,6 +4344,10 @@ const _SpreadsheetColumnHeader = class _SpreadsheetColumnHeader extends Spreadsh
|
|
|
4346
4344
|
"DefaultColumnHeaderLayoutExtension"
|
|
4347
4345
|
);
|
|
4348
4346
|
}
|
|
4347
|
+
/**
|
|
4348
|
+
* Custimize column header, such as custom header text and background.
|
|
4349
|
+
* @param cfg
|
|
4350
|
+
*/
|
|
4349
4351
|
setCustomHeader(cfg) {
|
|
4350
4352
|
this.makeDirty(!0), this._columnHeaderLayoutExtension.configHeaderColumn(cfg);
|
|
4351
4353
|
}
|
|
@@ -4358,6 +4360,16 @@ const _SheetExtension = class _SheetExtension extends ComponentExtension {
|
|
|
4358
4360
|
super(...arguments);
|
|
4359
4361
|
__publicField(this, "type", 0);
|
|
4360
4362
|
}
|
|
4363
|
+
/**
|
|
4364
|
+
* Get ISelectionCellWithMergeInfo by cell rowIndex and cell columnIndex.
|
|
4365
|
+
* The startXY in return value does not include rowHeader and columnHeader.
|
|
4366
|
+
* @param rowIndex
|
|
4367
|
+
* @param columnIndex
|
|
4368
|
+
* @param rowHeightAccumulation
|
|
4369
|
+
* @param columnWidthAccumulation
|
|
4370
|
+
* @param dataMergeCache
|
|
4371
|
+
* @returns ISelectionCellWithMergeInfo
|
|
4372
|
+
*/
|
|
4361
4373
|
getCellIndex(rowIndex, columnIndex, rowHeightAccumulation, columnWidthAccumulation, dataMergeCache) {
|
|
4362
4374
|
return getCellByIndex(rowIndex, columnIndex, rowHeightAccumulation, columnWidthAccumulation, dataMergeCache);
|
|
4363
4375
|
}
|
|
@@ -23084,12 +23096,12 @@ const _NodePositionConvertToCursor = class _NodePositionConvertToCursor {
|
|
|
23084
23096
|
borderBoxPosition = {
|
|
23085
23097
|
startX: startX + firstGlyphLeft + (isCurrentList ? firstGlyphWidth : 0),
|
|
23086
23098
|
startY,
|
|
23087
|
-
endX: startX + lastGlyphLeft + lastGlyphWidth,
|
|
23099
|
+
endX: startX + lastGlyphLeft + (isEndBack ? 0 : lastGlyphWidth),
|
|
23088
23100
|
endY: startY + lineHeight - marginTop - marginBottom
|
|
23089
23101
|
}, contentBoxPosition = {
|
|
23090
23102
|
startX: startX + firstGlyphLeft + (isCurrentList ? firstGlyphWidth : 0),
|
|
23091
23103
|
startY: startY + paddingTop + asc - anchorGlyph.bBox.ba,
|
|
23092
|
-
endX: startX + lastGlyphLeft + lastGlyphWidth,
|
|
23104
|
+
endX: startX + lastGlyphLeft + (isEndBack ? 0 : lastGlyphWidth),
|
|
23093
23105
|
endY: startY + paddingTop + asc + anchorGlyph.bBox.bd
|
|
23094
23106
|
};
|
|
23095
23107
|
else {
|
|
@@ -23960,7 +23972,7 @@ const _DocumentSkeleton = class _DocumentSkeleton extends Skeleton {
|
|
|
23960
23972
|
break;
|
|
23961
23973
|
index2 += g.count;
|
|
23962
23974
|
}
|
|
23963
|
-
return index2;
|
|
23975
|
+
return position.isBack ? index2 : index2 + glyph.count;
|
|
23964
23976
|
}
|
|
23965
23977
|
findNodePositionByCharIndex(charIndex, isBack = !0, segmentId = "", segmentPIndex = -1) {
|
|
23966
23978
|
const nodes = this._findNodeByIndex(charIndex, segmentId, segmentPIndex);
|
|
@@ -24012,10 +24024,8 @@ const _DocumentSkeleton = class _DocumentSkeleton extends Skeleton {
|
|
|
24012
24024
|
const skeletonData = this.getSkeletonData();
|
|
24013
24025
|
if (skeletonData == null)
|
|
24014
24026
|
return;
|
|
24015
|
-
const { pages, skeFooters, skeHeaders } = skeletonData, { divide, line: line2, column, section,
|
|
24016
|
-
let { glyph } = position;
|
|
24017
|
-
isBack === !1 && (glyph += 1);
|
|
24018
|
-
let skePage = null;
|
|
24027
|
+
const { pages, skeFooters, skeHeaders } = skeletonData, { divide, line: line2, column, section, segmentPage, pageType, path } = position;
|
|
24028
|
+
let { glyph } = position, skePage = null;
|
|
24019
24029
|
if (pageType === DocumentSkeletonPageType.HEADER || pageType === DocumentSkeletonPageType.FOOTER) {
|
|
24020
24030
|
skePage = pages[segmentPage];
|
|
24021
24031
|
const { headerId, footerId, pageWidth } = skePage;
|
|
@@ -24078,8 +24088,7 @@ const _DocumentSkeleton = class _DocumentSkeleton extends Skeleton {
|
|
|
24078
24088
|
return;
|
|
24079
24089
|
const cache = {
|
|
24080
24090
|
nearestNodeList: [],
|
|
24081
|
-
nearestNodeDistanceList: []
|
|
24082
|
-
nearestNodeDistanceY: Number.POSITIVE_INFINITY
|
|
24091
|
+
nearestNodeDistanceList: []
|
|
24083
24092
|
}, { pages, skeHeaders, skeFooters } = skeletonData, editArea = this.findEditAreaByCoord(coord, pageLayoutType, pageMarginLeft, pageMarginTop).editArea;
|
|
24084
24093
|
if (this._findLiquid.reset(), restrictions == null)
|
|
24085
24094
|
for (let pi = 0, len = pages.length; pi < len; pi++) {
|
|
@@ -24228,7 +24237,8 @@ const _DocumentSkeleton = class _DocumentSkeleton extends Skeleton {
|
|
|
24228
24237
|
break;
|
|
24229
24238
|
}
|
|
24230
24239
|
}
|
|
24231
|
-
if (pointInPage)
|
|
24240
|
+
if (pointInPage) {
|
|
24241
|
+
let nearestNodeDistanceY = Number.POSITIVE_INFINITY;
|
|
24232
24242
|
for (const section of sections) {
|
|
24233
24243
|
const { columns } = section;
|
|
24234
24244
|
this._findLiquid.translateSave(), this._findLiquid.translateSection(section);
|
|
@@ -24257,7 +24267,7 @@ const _DocumentSkeleton = class _DocumentSkeleton extends Skeleton {
|
|
|
24257
24267
|
ratioX: x / (startX_fin + endX_fin),
|
|
24258
24268
|
ratioY: y / (startY_fin + endY_fin)
|
|
24259
24269
|
};
|
|
24260
|
-
|
|
24270
|
+
nearestNodeDistanceY !== Number.NEGATIVE_INFINITY && (cache.nearestNodeList = [], cache.nearestNodeDistanceList = []), cache.nearestNodeList.push({
|
|
24261
24271
|
node: glyph,
|
|
24262
24272
|
segmentPage: pageType === DocumentSkeletonPageType.BODY ? -1 : pi,
|
|
24263
24273
|
segmentId,
|
|
@@ -24267,10 +24277,10 @@ const _DocumentSkeleton = class _DocumentSkeleton extends Skeleton {
|
|
|
24267
24277
|
coordInPage: pointInPage,
|
|
24268
24278
|
distance: distanceX,
|
|
24269
24279
|
nestLevel
|
|
24270
|
-
}),
|
|
24280
|
+
}), nearestNodeDistanceY = Number.NEGATIVE_INFINITY;
|
|
24271
24281
|
continue;
|
|
24272
24282
|
}
|
|
24273
|
-
distanceY <
|
|
24283
|
+
distanceY < nearestNodeDistanceY && (nearestNodeDistanceY = distanceY, cache.nearestNodeList = [], cache.nearestNodeDistanceList = []), distanceY === nearestNodeDistanceY && (cache.nearestNodeList.push({
|
|
24274
24284
|
node: glyph,
|
|
24275
24285
|
segmentPage: pageType === DocumentSkeletonPageType.BODY ? -1 : pi,
|
|
24276
24286
|
segmentId,
|
|
@@ -24291,6 +24301,7 @@ const _DocumentSkeleton = class _DocumentSkeleton extends Skeleton {
|
|
|
24291
24301
|
}
|
|
24292
24302
|
this._findLiquid.translateRestore();
|
|
24293
24303
|
}
|
|
24304
|
+
}
|
|
24294
24305
|
let exactMatch = null;
|
|
24295
24306
|
if (skeTables.size > 0)
|
|
24296
24307
|
for (const table2 of skeTables.values()) {
|
|
@@ -24580,7 +24591,7 @@ var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPrope
|
|
|
24580
24591
|
function getDocsSkeletonPageSize(documentSkeleton, angleInDegree = 0) {
|
|
24581
24592
|
const skeletonData = documentSkeleton == null ? void 0 : documentSkeleton.getSkeletonData(), angle = degToRad(angleInDegree);
|
|
24582
24593
|
if (!skeletonData)
|
|
24583
|
-
return;
|
|
24594
|
+
return null;
|
|
24584
24595
|
const { pages } = skeletonData, lastPage = pages[pages.length - 1], { width, height } = lastPage;
|
|
24585
24596
|
if (angle === 0)
|
|
24586
24597
|
return { width, height };
|
|
@@ -24729,8 +24740,7 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
24729
24740
|
this._marginTop = top;
|
|
24730
24741
|
}
|
|
24731
24742
|
calculateSegment(bounds) {
|
|
24732
|
-
|
|
24733
|
-
return bounds != null && (this._rowColumnSegment = this.getRowColumnSegment(bounds)), !0;
|
|
24743
|
+
return !this._worksheetData || (this._updateLayout(), !this._rowHeightAccumulation || !this._columnWidthAccumulation) ? !1 : (bounds != null && (this._rowColumnSegment = this.getRowColumnSegment(bounds)), !0);
|
|
24734
24744
|
}
|
|
24735
24745
|
calculateWithoutClearingCache(bounds) {
|
|
24736
24746
|
if (!this.calculateSegment(bounds))
|
|
@@ -24776,8 +24786,11 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
24776
24786
|
continue;
|
|
24777
24787
|
const cell = worksheet.getCell(rowNum, i);
|
|
24778
24788
|
if (cell != null && cell.interceptorAutoHeight) {
|
|
24779
|
-
|
|
24780
|
-
|
|
24789
|
+
const cellHeight = cell.interceptorAutoHeight();
|
|
24790
|
+
if (cellHeight) {
|
|
24791
|
+
height = Math.max(height, cellHeight);
|
|
24792
|
+
continue;
|
|
24793
|
+
}
|
|
24781
24794
|
}
|
|
24782
24795
|
const modelObject = cell && this._getCellDocumentModel(cell);
|
|
24783
24796
|
if (modelObject == null)
|
|
@@ -24805,7 +24818,6 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
24805
24818
|
}
|
|
24806
24819
|
/**
|
|
24807
24820
|
* Calculate data for row col & cell position, then update position value to this._rowHeaderWidth & this._rowHeightAccumulation & this._columnHeaderHeight & this._columnWidthAccumulation.
|
|
24808
|
-
* @returns this
|
|
24809
24821
|
*/
|
|
24810
24822
|
_updateLayout() {
|
|
24811
24823
|
if (!this.dirty)
|
|
@@ -24829,7 +24841,7 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
24829
24841
|
columnData,
|
|
24830
24842
|
defaultColumnWidth
|
|
24831
24843
|
);
|
|
24832
|
-
|
|
24844
|
+
this._rowHeaderWidth = rowHeader.hidden !== BooleanNumber.TRUE ? this._dynamicallyUpdateRowHeaderWidth(rowHeader) : 0, this._columnHeaderHeight = columnHeader.hidden !== BooleanNumber.TRUE ? columnHeader.height : 0, this._rowTotalHeight = rowTotalHeight, this._rowHeightAccumulation = rowHeightAccumulation, this._columnTotalWidth = columnTotalWidth, this._columnWidthAccumulation = columnWidthAccumulation, this._showGridlines = showGridlines, this.makeDirty(!1);
|
|
24833
24845
|
}
|
|
24834
24846
|
_dynamicallyUpdateRowHeaderWidth(rowHeader) {
|
|
24835
24847
|
const widthByComputation = `${this.worksheet.getRowCount()}`.length * 8;
|
|
@@ -24905,7 +24917,8 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
24905
24917
|
return this._rowHeightAccumulation.length;
|
|
24906
24918
|
}
|
|
24907
24919
|
getOverflowPosition(contentSize, horizontalAlign, row, column, columnCount) {
|
|
24908
|
-
|
|
24920
|
+
var _a11;
|
|
24921
|
+
const contentWidth = (_a11 = contentSize == null ? void 0 : contentSize.width) != null ? _a11 : 0;
|
|
24909
24922
|
let startColumn = column, endColumn = column;
|
|
24910
24923
|
return horizontalAlign === HorizontalAlign.CENTER ? (startColumn = this._getOverflowBound(row, column, 0, contentWidth / 2, horizontalAlign), endColumn = this._getOverflowBound(row, column, columnCount - 1, contentWidth / 2, horizontalAlign)) : horizontalAlign === HorizontalAlign.RIGHT ? startColumn = this._getOverflowBound(row, column, 0, contentWidth) : endColumn = this._getOverflowBound(row, column, columnCount - 1, contentWidth), {
|
|
24911
24924
|
startColumn,
|
|
@@ -24947,7 +24960,7 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
24947
24960
|
};
|
|
24948
24961
|
}
|
|
24949
24962
|
/**
|
|
24950
|
-
*
|
|
24963
|
+
* Get cell by pos(offsetX, offsetY).
|
|
24951
24964
|
* @param offsetX HTML coordinate system, mouse position x.
|
|
24952
24965
|
* @param offsetY HTML coordinate system, mouse position y.
|
|
24953
24966
|
* @param scaleX render scene scale x-axis, scene.getAncestorScale
|
|
@@ -25092,14 +25105,14 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
25092
25105
|
getBlankCellDocumentModel(cell) {
|
|
25093
25106
|
const documentModelObject = this._getCellDocumentModel(cell, {
|
|
25094
25107
|
ignoreTextRotation: !0
|
|
25095
|
-
});
|
|
25108
|
+
}), style = this._styles.getStyleByCell(cell), textStyle = this._getFontFormat(style);
|
|
25096
25109
|
if (documentModelObject != null)
|
|
25097
|
-
return documentModelObject.documentModel == null && (documentModelObject.documentModel = this._getDocumentDataByStyle("",
|
|
25110
|
+
return documentModelObject.documentModel == null && (documentModelObject.documentModel = this._getDocumentDataByStyle("", textStyle, {})), documentModelObject;
|
|
25098
25111
|
const content = "";
|
|
25099
25112
|
let fontString = "document";
|
|
25100
25113
|
const textRotation = DEFAULT_STYLES.tr, horizontalAlign = DEFAULT_STYLES.ht, verticalAlign = DEFAULT_STYLES.vt, wrapStrategy = DEFAULT_STYLES.tb, paddingData = DEFAULT_PADDING_DATA;
|
|
25101
25114
|
return fontString = getFontStyleString({}, this._localService).fontCache, {
|
|
25102
|
-
documentModel: this._getDocumentDataByStyle(content,
|
|
25115
|
+
documentModel: this._getDocumentDataByStyle(content, textStyle, {}),
|
|
25103
25116
|
fontString,
|
|
25104
25117
|
textRotation,
|
|
25105
25118
|
wrapStrategy,
|
|
@@ -25232,6 +25245,7 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
25232
25245
|
return !0;
|
|
25233
25246
|
this.appendToOverflowCache(row, column, startColumn, endColumn);
|
|
25234
25247
|
}
|
|
25248
|
+
return !1;
|
|
25235
25249
|
}
|
|
25236
25250
|
/**
|
|
25237
25251
|
*
|
|
@@ -25299,6 +25313,7 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
25299
25313
|
columnWidthAccumulation
|
|
25300
25314
|
};
|
|
25301
25315
|
}
|
|
25316
|
+
//eslint-disable-next-line complexity
|
|
25302
25317
|
_getOverflowBound(row, startColumn, endColumn, contentWidth, horizontalAlign = HorizontalAlign.LEFT) {
|
|
25303
25318
|
let cumWidth = 0;
|
|
25304
25319
|
if (startColumn > endColumn) {
|
|
@@ -25483,7 +25498,8 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
25483
25498
|
paddingData = {
|
|
25484
25499
|
t: 0,
|
|
25485
25500
|
r: 2,
|
|
25486
|
-
b:
|
|
25501
|
+
b: 2,
|
|
25502
|
+
// must over 1, see https://github.com/dream-num/univer/issues/2727
|
|
25487
25503
|
l: 2
|
|
25488
25504
|
},
|
|
25489
25505
|
horizontalAlign = HorizontalAlign.UNSPECIFIED,
|
|
@@ -25508,7 +25524,10 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
25508
25524
|
horizontalAlign
|
|
25509
25525
|
}
|
|
25510
25526
|
}
|
|
25511
|
-
]
|
|
25527
|
+
],
|
|
25528
|
+
sectionBreaks: [{
|
|
25529
|
+
startIndex: contentLength + 1
|
|
25530
|
+
}]
|
|
25512
25531
|
},
|
|
25513
25532
|
documentStyle: {
|
|
25514
25533
|
pageSize: {
|
|
@@ -25581,13 +25600,13 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
25581
25600
|
var _a11, _b, _c;
|
|
25582
25601
|
const props = (_a11 = style.bd) == null ? void 0 : _a11[type];
|
|
25583
25602
|
if (!props || !cache.border)
|
|
25584
|
-
return
|
|
25603
|
+
return;
|
|
25585
25604
|
const rgb = getColorStyle(props.cl) || COLOR_BLACK_RGB, borderCache = cache.border;
|
|
25586
25605
|
if (borderCache.getValue(r, c) || borderCache.setValue(r, c, { [type]: {} }), type === BORDER_TYPE.TOP) {
|
|
25587
25606
|
if (((_b = borderCache.getValue(r - 1, c)) == null ? void 0 : _b[BORDER_TYPE.BOTTOM]) && isWhiteColor(rgb))
|
|
25588
|
-
return
|
|
25607
|
+
return;
|
|
25589
25608
|
} else if (type === BORDER_TYPE.LEFT && ((_c = borderCache.getValue(r, c - 1)) == null ? void 0 : _c[BORDER_TYPE.RIGHT]) && isWhiteColor(rgb))
|
|
25590
|
-
return
|
|
25609
|
+
return;
|
|
25591
25610
|
borderCache.getValue(r, c)[type] = {
|
|
25592
25611
|
type,
|
|
25593
25612
|
style: props.s,
|
|
@@ -25764,7 +25783,7 @@ const UNIQUE_KEY$7 = "DefaultFontExtension", EXTENSION_Z_INDEX = 45, _Font = cla
|
|
|
25764
25783
|
const documents = this.getDocuments();
|
|
25765
25784
|
if (documents == null)
|
|
25766
25785
|
throw new Error("documents is null");
|
|
25767
|
-
const { documentSkeleton, vertexAngle = 0, wrapStrategy } = docsConfig,
|
|
25786
|
+
const { documentSkeleton, vertexAngle = 0, wrapStrategy } = docsConfig, cellHeight = endY - startY, cellWidth = endX - startX;
|
|
25768
25787
|
wrapStrategy === WrapStrategy.WRAP && vertexAngle === 0 ? (documentSkeleton.getViewModel().getDataModel().updateDocumentDataPageSize(cellWidth), documentSkeleton.calculate()) : documentSkeleton.getViewModel().getDataModel().updateDocumentDataPageSize(Number.POSITIVE_INFINITY);
|
|
25769
25788
|
const overflowRectangle = overflowCache.getValue(row, column);
|
|
25770
25789
|
if (!(wrapStrategy === WrapStrategy.WRAP && !overflowRectangle && vertexAngle === 0)) {
|
|
@@ -26302,16 +26321,19 @@ const SHAPE_OBJECT_ARRAY = [
|
|
|
26302
26321
|
const m = this.transform.getMatrix();
|
|
26303
26322
|
return mainCtx.save(), mainCtx.transform(m[0], m[1], m[2], m[3], m[4], m[5]), this._draw(mainCtx, bounds), mainCtx.restore(), this.makeDirty(!1), this;
|
|
26304
26323
|
}
|
|
26324
|
+
/**
|
|
26325
|
+
* this[_key] = props[key]
|
|
26326
|
+
* @param props
|
|
26327
|
+
*/
|
|
26305
26328
|
setProps(props) {
|
|
26306
26329
|
if (!props)
|
|
26307
|
-
return;
|
|
26330
|
+
return this;
|
|
26308
26331
|
const themeKeys = Object.keys(props);
|
|
26309
|
-
|
|
26310
|
-
|
|
26311
|
-
|
|
26312
|
-
|
|
26313
|
-
|
|
26314
|
-
}), this.makeDirty(!0), this;
|
|
26332
|
+
return themeKeys.length === 0 ? this : (themeKeys.forEach((key) => {
|
|
26333
|
+
if (props[key] === void 0)
|
|
26334
|
+
return !0;
|
|
26335
|
+
BASE_OBJECT_ARRAY.indexOf(key) === -1 && (this[`_${key}`] = props[key]);
|
|
26336
|
+
}), this.makeDirty(!0), this);
|
|
26315
26337
|
}
|
|
26316
26338
|
toJson() {
|
|
26317
26339
|
const props = {};
|
|
@@ -29284,7 +29306,7 @@ const _Engine = class _Engine extends ThinEngine {
|
|
|
29284
29306
|
__publicField(this, "_dropEvent");
|
|
29285
29307
|
__publicField(this, "_remainCapture", -1);
|
|
29286
29308
|
/** previous pointer position */
|
|
29287
|
-
__publicField(this, "
|
|
29309
|
+
__publicField(this, "_pointer", {});
|
|
29288
29310
|
__publicField(this, "_mouseId", -1);
|
|
29289
29311
|
__publicField(this, "_isUsingFirefox", navigator.userAgent.indexOf("Firefox") !== -1);
|
|
29290
29312
|
__publicField(this, "_previousWidth", -1e3);
|
|
@@ -29485,21 +29507,21 @@ const _Engine = class _Engine extends ThinEngine {
|
|
|
29485
29507
|
const eventPrefix = getPointerPrefix();
|
|
29486
29508
|
this._pointerMoveEvent = (e) => {
|
|
29487
29509
|
const evt = e, deviceType = this._getPointerType(evt);
|
|
29488
|
-
this.
|
|
29510
|
+
this._pointer[PointerInput.Horizontal] = evt.clientX, this._pointer[PointerInput.Vertical] = evt.clientY, this._pointer[PointerInput.DeltaHorizontal] = evt.movementX, this._pointer[PointerInput.DeltaVertical] = evt.movementY;
|
|
29489
29511
|
const deviceEvent = evt;
|
|
29490
|
-
deviceEvent.deviceType = deviceType, deviceEvent.inputIndex = PointerInput.Horizontal, this.onInputChanged$.emitEvent(deviceEvent), !this._usingSafari && evt.button !== -1 && (deviceEvent.inputIndex = evt.button + 2, deviceEvent.previousState = this.
|
|
29512
|
+
deviceEvent.deviceType = deviceType, deviceEvent.inputIndex = PointerInput.Horizontal, this.onInputChanged$.emitEvent(deviceEvent), !this._usingSafari && evt.button !== -1 && (deviceEvent.inputIndex = evt.button + 2, deviceEvent.previousState = this._pointer[evt.button + 2], this._pointer[evt.button + 2] = this._pointer[evt.button + 2] ? 0 : 1, deviceEvent.currentState = this._pointer[evt.button + 2], this.onInputChanged$.emitEvent(deviceEvent));
|
|
29491
29513
|
}, this._pointerDownEvent = (nativeEvent) => {
|
|
29492
|
-
const evt = nativeEvent, deviceType = this._getPointerType(evt), previousHorizontal = this.
|
|
29493
|
-
deviceType === DeviceType.Mouse ? (this._mouseId === -1 && (evt.pointerId === void 0 ? this._mouseId = this._isUsingFirefox ? 0 : 1 : this._mouseId = evt.pointerId), document.pointerLockElement || (this._remainCapture = this._mouseId, this.getCanvasElement().setPointerCapture(this._mouseId))) : evt.pointerId && !document.pointerLockElement && (this._remainCapture = evt.pointerId, this.getCanvasElement().setPointerCapture(evt.pointerId)), this.
|
|
29514
|
+
const evt = nativeEvent, deviceType = this._getPointerType(evt), previousHorizontal = this._pointer[PointerInput.Horizontal], previousVertical = this._pointer[PointerInput.Vertical], previousButton = this._pointer[evt.button + 2];
|
|
29515
|
+
deviceType === DeviceType.Mouse ? (this._mouseId === -1 && (evt.pointerId === void 0 ? this._mouseId = this._isUsingFirefox ? 0 : 1 : this._mouseId = evt.pointerId), document.pointerLockElement || (this._remainCapture = this._mouseId, this.getCanvasElement().setPointerCapture(this._mouseId))) : evt.pointerId && !document.pointerLockElement && (this._remainCapture = evt.pointerId, this.getCanvasElement().setPointerCapture(evt.pointerId)), this._pointer[PointerInput.Horizontal] = evt.clientX, this._pointer[PointerInput.Vertical] = evt.clientY, this._pointer[evt.button + 2] = 1;
|
|
29494
29516
|
const deviceEvent = evt;
|
|
29495
|
-
deviceEvent.deviceType = deviceType, previousHorizontal !== evt.clientX && (deviceEvent.inputIndex = PointerInput.Horizontal, deviceEvent.previousState = previousHorizontal, deviceEvent.currentState = this.
|
|
29517
|
+
deviceEvent.deviceType = deviceType, previousHorizontal !== evt.clientX && (deviceEvent.inputIndex = PointerInput.Horizontal, deviceEvent.previousState = previousHorizontal, deviceEvent.currentState = this._pointer[PointerInput.Horizontal], this.onInputChanged$.emitEvent(deviceEvent)), previousVertical !== evt.clientY && (deviceEvent.inputIndex = PointerInput.Vertical, deviceEvent.previousState = previousVertical, deviceEvent.currentState = this._pointer[PointerInput.Vertical], this.onInputChanged$.emitEvent(deviceEvent)), deviceEvent.inputIndex = evt.button + 2, deviceEvent.previousState = previousButton, deviceEvent.currentState = this._pointer[evt.button + 2], this.onInputChanged$.emitEvent(deviceEvent);
|
|
29496
29518
|
}, this._pointerUpEvent = (_evt) => {
|
|
29497
|
-
const evt = _evt, deviceType = this._getPointerType(evt), previousHorizontal = this.
|
|
29498
|
-
this.
|
|
29519
|
+
const evt = _evt, deviceType = this._getPointerType(evt), previousHorizontal = this._pointer[PointerInput.Horizontal], previousVertical = this._pointer[PointerInput.Vertical], previousButton = this._pointer[evt.button + 2];
|
|
29520
|
+
this._pointer[PointerInput.Horizontal] = evt.clientX, this._pointer[PointerInput.Vertical] = evt.clientY, this._pointer[evt.button + 2] = 0;
|
|
29499
29521
|
const deviceEvent = evt;
|
|
29500
|
-
deviceEvent.deviceType = deviceType, previousHorizontal !== evt.clientX && (deviceEvent.inputIndex = PointerInput.Horizontal, deviceEvent.previousState = previousHorizontal, deviceEvent.currentState = this.
|
|
29522
|
+
deviceEvent.deviceType = deviceType, previousHorizontal !== evt.clientX && (deviceEvent.inputIndex = PointerInput.Horizontal, deviceEvent.previousState = previousHorizontal, deviceEvent.currentState = this._pointer[PointerInput.Horizontal], this.onInputChanged$.emitEvent(deviceEvent)), previousVertical !== evt.clientY && (deviceEvent.inputIndex = PointerInput.Vertical, deviceEvent.previousState = previousVertical, deviceEvent.currentState = this._pointer[PointerInput.Vertical], this.onInputChanged$.emitEvent(deviceEvent)), deviceEvent.inputIndex = evt.button + 2, deviceEvent.previousState = previousButton, deviceEvent.currentState = this._pointer[evt.button + 2];
|
|
29501
29523
|
const canvasEle2 = this.getCanvasElement();
|
|
29502
|
-
deviceType === DeviceType.Mouse && this._mouseId >= 0 && canvasEle2.hasPointerCapture(this._mouseId) ? (this._remainCapture = this._mouseId, canvasEle2.releasePointerCapture(this._mouseId)) : deviceEvent.pointerId && canvasEle2.hasPointerCapture(deviceEvent.pointerId) && (this._remainCapture = deviceEvent.pointerId, canvasEle2.releasePointerCapture(deviceEvent.pointerId)), this.onInputChanged$.emitEvent(deviceEvent), deviceType !== DeviceType.Mouse && (this.
|
|
29524
|
+
deviceType === DeviceType.Mouse && this._mouseId >= 0 && canvasEle2.hasPointerCapture(this._mouseId) ? (this._remainCapture = this._mouseId, canvasEle2.releasePointerCapture(this._mouseId)) : deviceEvent.pointerId && canvasEle2.hasPointerCapture(deviceEvent.pointerId) && (this._remainCapture = deviceEvent.pointerId, canvasEle2.releasePointerCapture(deviceEvent.pointerId)), this.onInputChanged$.emitEvent(deviceEvent), deviceType !== DeviceType.Mouse && (this._pointer = {});
|
|
29503
29525
|
}, this._pointerEnterEvent = (evt) => {
|
|
29504
29526
|
const deviceType = this._getPointerType(evt), deviceEvent = evt;
|
|
29505
29527
|
deviceEvent.deviceType = deviceType, deviceEvent.currentState = 2, this.onInputChanged$.emitEvent(deviceEvent);
|
|
@@ -29513,12 +29535,12 @@ const _Engine = class _Engine extends ThinEngine {
|
|
|
29513
29535
|
const deviceType = this._getPointerType(evt), deviceEvent = evt;
|
|
29514
29536
|
deviceEvent.deviceType = deviceType, deviceEvent.currentState = 3, this.onInputChanged$.emitEvent(deviceEvent);
|
|
29515
29537
|
}, this._pointerBlurEvent = () => {
|
|
29516
|
-
this._mouseId >= 0 && this.getCanvasElement().hasPointerCapture(this._mouseId), this.
|
|
29538
|
+
this._mouseId >= 0 && this.getCanvasElement().hasPointerCapture(this._mouseId), this._pointer = {};
|
|
29517
29539
|
}, this._pointerWheelEvent = (evt) => {
|
|
29518
|
-
const deviceType = DeviceType.Mouse, previousWheelScrollX = this.
|
|
29519
|
-
this.
|
|
29540
|
+
const deviceType = DeviceType.Mouse, previousWheelScrollX = this._pointer[PointerInput.MouseWheelX], previousWheelScrollY = this._pointer[PointerInput.MouseWheelY], previousWheelScrollZ = this._pointer[PointerInput.MouseWheelZ];
|
|
29541
|
+
this._pointer[PointerInput.MouseWheelX] = evt.deltaX || 0, this._pointer[PointerInput.MouseWheelY] = evt.deltaY || evt.wheelDelta || 0, this._pointer[PointerInput.MouseWheelZ] = evt.deltaZ || 0;
|
|
29520
29542
|
const deviceEvent = evt;
|
|
29521
|
-
deviceEvent.deviceType = deviceType, this.
|
|
29543
|
+
deviceEvent.deviceType = deviceType, this._pointer[PointerInput.MouseWheelX] !== 0 && (deviceEvent.inputIndex = PointerInput.MouseWheelX, deviceEvent.previousState = previousWheelScrollX, deviceEvent.currentState = this._pointer[PointerInput.MouseWheelX], this.onInputChanged$.emitEvent(deviceEvent)), this._pointer[PointerInput.MouseWheelY] !== 0 && (deviceEvent.inputIndex = PointerInput.MouseWheelY, deviceEvent.previousState = previousWheelScrollY, deviceEvent.currentState = this._pointer[PointerInput.MouseWheelY], this.onInputChanged$.emitEvent(deviceEvent)), this._pointer[PointerInput.MouseWheelZ] !== 0 && (deviceEvent.inputIndex = PointerInput.MouseWheelZ, deviceEvent.previousState = previousWheelScrollZ, deviceEvent.currentState = this._pointer[PointerInput.MouseWheelZ], this.onInputChanged$.emitEvent(deviceEvent));
|
|
29522
29544
|
};
|
|
29523
29545
|
const canvasEle = this.getCanvasElement();
|
|
29524
29546
|
canvasEle.addEventListener(`${eventPrefix}enter`, this._pointerEnterEvent), canvasEle.addEventListener(`${eventPrefix}leave`, this._pointerLeaveEvent), canvasEle.addEventListener(`${eventPrefix}move`, this._pointerMoveEvent), canvasEle.addEventListener(`${eventPrefix}down`, this._pointerDownEvent), canvasEle.addEventListener(`${eventPrefix}up`, this._pointerUpEvent), canvasEle.addEventListener(`${eventPrefix}out`, this._pointerOutEvent), canvasEle.addEventListener(`${eventPrefix}cancel`, this._pointerCancelEvent), canvasEle.addEventListener("blur", this._pointerBlurEvent), canvasEle.addEventListener(
|
|
@@ -29537,10 +29559,10 @@ const _Engine = class _Engine extends ThinEngine {
|
|
|
29537
29559
|
deviceEvent.deviceType = deviceType, deviceEvent.currentState = 5, this.onInputChanged$.emitEvent(deviceEvent);
|
|
29538
29560
|
}, this._dragOverEvent = (evt) => {
|
|
29539
29561
|
evt.preventDefault();
|
|
29540
|
-
const deviceType = this._getPointerType(evt), previousHorizontal = this.
|
|
29541
|
-
this.
|
|
29562
|
+
const deviceType = this._getPointerType(evt), previousHorizontal = this._pointer[PointerInput.Horizontal], previousVertical = this._pointer[PointerInput.Vertical], previousDeltaHorizontal = this._pointer[PointerInput.DeltaHorizontal], previousDeltaVertical = this._pointer[PointerInput.DeltaVertical];
|
|
29563
|
+
this._pointer[PointerInput.Horizontal] = evt.clientX, this._pointer[PointerInput.Vertical] = evt.clientY, this._pointer[PointerInput.DeltaHorizontal] = evt.movementX, this._pointer[PointerInput.DeltaVertical] = evt.movementY;
|
|
29542
29564
|
const deviceEvent = evt;
|
|
29543
|
-
deviceEvent.deviceType = deviceType, previousHorizontal !== evt.clientX && (deviceEvent.inputIndex = PointerInput.Horizontal, deviceEvent.previousState = previousHorizontal, deviceEvent.currentState = this.
|
|
29565
|
+
deviceEvent.deviceType = deviceType, previousHorizontal !== evt.clientX && (deviceEvent.inputIndex = PointerInput.Horizontal, deviceEvent.previousState = previousHorizontal, deviceEvent.currentState = this._pointer[PointerInput.Horizontal], this.onInputChanged$.emitEvent(deviceEvent)), previousVertical !== evt.clientY && (deviceEvent.inputIndex = PointerInput.Vertical, deviceEvent.previousState = previousVertical, deviceEvent.currentState = this._pointer[PointerInput.Vertical], this.onInputChanged$.emitEvent(deviceEvent)), this._pointer[PointerInput.DeltaHorizontal] !== 0 && (deviceEvent.inputIndex = PointerInput.DeltaHorizontal, deviceEvent.previousState = previousDeltaHorizontal, deviceEvent.currentState = this._pointer[PointerInput.DeltaHorizontal], this.onInputChanged$.emitEvent(deviceEvent)), this._pointer[PointerInput.DeltaVertical] !== 0 && (deviceEvent.inputIndex = PointerInput.DeltaVertical, deviceEvent.previousState = previousDeltaVertical, deviceEvent.currentState = this._pointer[PointerInput.DeltaVertical], this.onInputChanged$.emitEvent(deviceEvent)), !this._usingSafari && evt.button !== -1 && (deviceEvent.inputIndex = evt.button + 2, deviceEvent.previousState = this._pointer[evt.button + 2], this._pointer[evt.button + 2] = this._pointer[evt.button + 2] ? 0 : 1, deviceEvent.currentState = this._pointer[evt.button + 2], this.onInputChanged$.emitEvent(deviceEvent));
|
|
29544
29566
|
}, this._dropEvent = (evt) => {
|
|
29545
29567
|
const deviceType = this._getPointerType(evt), deviceEvent = evt;
|
|
29546
29568
|
deviceEvent.deviceType = deviceType, deviceEvent.currentState = 6, this.onInputChanged$.emitEvent(deviceEvent);
|
|
@@ -29781,8 +29803,8 @@ const _Layer = class _Layer extends Disposable {
|
|
|
29781
29803
|
return this._allowCache;
|
|
29782
29804
|
}
|
|
29783
29805
|
/**
|
|
29784
|
-
*
|
|
29785
|
-
* @returns BaseObject[]
|
|
29806
|
+
* Get direct visible children in order. (direct means object is not in group), default order is ascending by z-index.
|
|
29807
|
+
* @returns {BaseObject[]} objects
|
|
29786
29808
|
*/
|
|
29787
29809
|
getObjectsByOrder() {
|
|
29788
29810
|
const objects = [];
|
|
@@ -29791,6 +29813,10 @@ const _Layer = class _Layer extends Disposable {
|
|
|
29791
29813
|
!o.isInGroup && o.visible && objects.push(o);
|
|
29792
29814
|
return objects;
|
|
29793
29815
|
}
|
|
29816
|
+
/**
|
|
29817
|
+
* Get visible and evented objects.
|
|
29818
|
+
* @returns {BaseObject[]} objects
|
|
29819
|
+
*/
|
|
29794
29820
|
getObjectsByOrderForPick() {
|
|
29795
29821
|
const objects = [];
|
|
29796
29822
|
this._objects.sort(sortRules);
|
|
@@ -29802,10 +29828,9 @@ const _Layer = class _Layer extends Disposable {
|
|
|
29802
29828
|
return this._objects;
|
|
29803
29829
|
}
|
|
29804
29830
|
/**
|
|
29805
|
-
* insert
|
|
29806
|
-
* if o is a group, insert all its children and group itself to _objects[]
|
|
29831
|
+
* Insert object to this._objects, if object is a group, insert all its children and group itself to _objects[]
|
|
29807
29832
|
* @param o
|
|
29808
|
-
* @returns this
|
|
29833
|
+
* @returns {Layer} this
|
|
29809
29834
|
*/
|
|
29810
29835
|
addObject(o) {
|
|
29811
29836
|
if (o.classType === RENDER_CLASS_TYPE.GROUP) {
|
|
@@ -29830,6 +29855,11 @@ const _Layer = class _Layer extends Disposable {
|
|
|
29830
29855
|
return;
|
|
29831
29856
|
}
|
|
29832
29857
|
}
|
|
29858
|
+
/**
|
|
29859
|
+
* Insert objects to this._objects, if object is a group, insert all its children and group itself to _objects[]
|
|
29860
|
+
* @param objects
|
|
29861
|
+
* @returns {Layer} this
|
|
29862
|
+
*/
|
|
29833
29863
|
addObjects(objects) {
|
|
29834
29864
|
return objects.forEach((o) => {
|
|
29835
29865
|
this.addObject(o);
|
|
@@ -31499,27 +31529,37 @@ const _Scene = class _Scene extends ThinScene {
|
|
|
31499
31529
|
addLayer(...argument2) {
|
|
31500
31530
|
this._layers.push(...argument2);
|
|
31501
31531
|
}
|
|
31532
|
+
/**
|
|
31533
|
+
* Add objects to Layer( Layer is specfied by zIndex)
|
|
31534
|
+
* If object is a group, insert all its children and group itself to _objects[].
|
|
31535
|
+
* @param objects
|
|
31536
|
+
* @param zIndex
|
|
31537
|
+
* @returns {Scene} this
|
|
31538
|
+
*/
|
|
31502
31539
|
addObjects(objects, zIndex = 1) {
|
|
31503
31540
|
var _a11;
|
|
31504
31541
|
return (_a11 = this.getLayer(zIndex)) == null || _a11.addObjects(objects), this._addObject$.next(this), this;
|
|
31505
31542
|
}
|
|
31506
31543
|
/**
|
|
31507
31544
|
* Add object to Layer (Layer is specified by zIndex).
|
|
31545
|
+
* If object is a group, insert all its children and group itself to _objects[].
|
|
31508
31546
|
* @param o
|
|
31509
31547
|
* @param zIndex layer index
|
|
31510
|
-
* @returns scene
|
|
31548
|
+
* @returns {Scene} scene
|
|
31511
31549
|
*/
|
|
31512
31550
|
addObject(o, zIndex = 1) {
|
|
31513
31551
|
var _a11;
|
|
31514
31552
|
return (_a11 = this.getLayer(zIndex)) == null || _a11.addObject(o), this._addObject$.next(this), this;
|
|
31515
31553
|
}
|
|
31516
31554
|
/**
|
|
31517
|
-
*
|
|
31555
|
+
* Set Scene as object parent, if object has no parent.
|
|
31518
31556
|
* @param o
|
|
31557
|
+
* @returns {void}
|
|
31519
31558
|
*/
|
|
31520
31559
|
setObjectBehavior(o) {
|
|
31521
31560
|
o.parent || (o.parent = this), o.onIsAddedToParent$.emitEvent(this);
|
|
31522
31561
|
}
|
|
31562
|
+
// Why? return values is so strange! removeObject should return true/false, or didn't return anything.
|
|
31523
31563
|
removeObject(object) {
|
|
31524
31564
|
if (object == null)
|
|
31525
31565
|
return;
|
|
@@ -31556,10 +31596,21 @@ const _Scene = class _Scene extends ThinScene {
|
|
|
31556
31596
|
return objects;
|
|
31557
31597
|
}
|
|
31558
31598
|
/**
|
|
31559
|
-
*
|
|
31560
|
-
* @returns BaseObject[]
|
|
31599
|
+
* Get all objects of each Layer.
|
|
31600
|
+
* @returns {BaseObject[]} objects
|
|
31561
31601
|
*/
|
|
31562
31602
|
getAllObjects() {
|
|
31603
|
+
const objects = [];
|
|
31604
|
+
this._layers.sort(sortRules);
|
|
31605
|
+
for (const layer of this._layers)
|
|
31606
|
+
objects.push(...layer.getObjects());
|
|
31607
|
+
return objects;
|
|
31608
|
+
}
|
|
31609
|
+
/**
|
|
31610
|
+
* Get objects which is visible and not in a group in each layer.
|
|
31611
|
+
* @returns BaseObject[]
|
|
31612
|
+
*/
|
|
31613
|
+
getAllObjectsByOrder() {
|
|
31563
31614
|
const objects = [];
|
|
31564
31615
|
this._layers.sort(sortRules);
|
|
31565
31616
|
for (const layer of this._layers)
|
|
@@ -31571,13 +31622,18 @@ const _Scene = class _Scene extends ThinScene {
|
|
|
31571
31622
|
* @param isDesc
|
|
31572
31623
|
* @returns BaseObject[]
|
|
31573
31624
|
*/
|
|
31574
|
-
|
|
31625
|
+
getAllObjectsByDescOrder(isDesc = !1) {
|
|
31575
31626
|
const objects = [], useSortRules = isDesc ? sortRulesByDesc : sortRules;
|
|
31576
31627
|
this._layers.sort(useSortRules);
|
|
31577
31628
|
for (const layer of this._layers)
|
|
31578
31629
|
objects.push(...layer.getObjectsByOrder().sort(useSortRules));
|
|
31579
31630
|
return objects;
|
|
31580
31631
|
}
|
|
31632
|
+
/**
|
|
31633
|
+
* Get visible and evented objects.
|
|
31634
|
+
* @param isDesc
|
|
31635
|
+
* @returns {BaseObject[]} objects
|
|
31636
|
+
*/
|
|
31581
31637
|
getAllObjectsByOrderForPick(isDesc = !1) {
|
|
31582
31638
|
const objects = [], useSortRules = isDesc ? sortRulesByDesc : sortRules;
|
|
31583
31639
|
this._layers.sort(useSortRules);
|
|
@@ -32092,7 +32148,7 @@ let RenderManagerService = (_a8 = class extends Disposable {
|
|
|
32092
32148
|
engine,
|
|
32093
32149
|
scene,
|
|
32094
32150
|
isMainScene
|
|
32095
|
-
}), this._tryAddRenderDependencies(renderUnit, ctorOfDeps);
|
|
32151
|
+
}), this._addRenderUnit(unitId, renderUnit), this._tryAddRenderDependencies(renderUnit, ctorOfDeps);
|
|
32096
32152
|
} else
|
|
32097
32153
|
renderUnit = {
|
|
32098
32154
|
isThumbNail: !0,
|
|
@@ -32107,14 +32163,14 @@ let RenderManagerService = (_a8 = class extends Disposable {
|
|
|
32107
32163
|
with(_dependency) {
|
|
32108
32164
|
return null;
|
|
32109
32165
|
}
|
|
32110
|
-
};
|
|
32111
|
-
return
|
|
32166
|
+
}, this._addRenderUnit(unitId, renderUnit);
|
|
32167
|
+
return renderUnit;
|
|
32112
32168
|
}
|
|
32113
|
-
addRender(unitId,
|
|
32114
|
-
this._addRenderUnit(unitId,
|
|
32169
|
+
addRender(unitId, renderUnit) {
|
|
32170
|
+
this._addRenderUnit(unitId, renderUnit);
|
|
32115
32171
|
}
|
|
32116
|
-
_addRenderUnit(unitId,
|
|
32117
|
-
this._renderMap.set(unitId,
|
|
32172
|
+
_addRenderUnit(unitId, renderUnit) {
|
|
32173
|
+
this._renderMap.set(unitId, renderUnit);
|
|
32118
32174
|
}
|
|
32119
32175
|
removeRender(unitId) {
|
|
32120
32176
|
const item = this._renderMap.get(unitId);
|
|
@@ -33287,7 +33343,14 @@ function isInSameTableCell(anchorNodePosition, focusNodePosition) {
|
|
|
33287
33343
|
}
|
|
33288
33344
|
__name(isInSameTableCell, "isInSameTableCell");
|
|
33289
33345
|
function compareNodePositionInTable(a, b) {
|
|
33290
|
-
|
|
33346
|
+
if (isInSameTableCell(a, b))
|
|
33347
|
+
return compareNodePositionLogic(a, b);
|
|
33348
|
+
const { path: aPath } = a, { path: bPath } = b, aTableId = aPath[aPath.length - 5], bTableId = bPath[bPath.length - 5];
|
|
33349
|
+
if (aTableId !== bTableId && typeof aTableId == "string" && typeof bTableId == "string") {
|
|
33350
|
+
const aSlideId = aTableId.split("#-#")[1], bSlideId = bTableId.split("#-#")[1];
|
|
33351
|
+
return +aSlideId < +bSlideId;
|
|
33352
|
+
}
|
|
33353
|
+
const aRowCount = aPath[aPath.length - 3], bRowCount = bPath[bPath.length - 3], aCellCount = aPath[aPath.length - 1], bCellCount = bPath[bPath.length - 1];
|
|
33291
33354
|
return aRowCount < bRowCount ? !0 : aRowCount > bRowCount ? !1 : aCellCount <= bCellCount;
|
|
33292
33355
|
}
|
|
33293
33356
|
__name(compareNodePositionInTable, "compareNodePositionInTable");
|
|
@@ -33653,13 +33716,13 @@ function getRangeListFromSelection(anchorPosition, focusPosition, scene, documen
|
|
|
33653
33716
|
tableStartPosition = skeleton.findNodePositionByCharIndex(tableStart + 3, !0, segmentId, segmentPage), tableEndPosition = skeleton.findNodePositionByCharIndex(endRow.endIndex - 3, !0, segmentId, segmentPage), end = tableStart - 1, endInTable = !0;
|
|
33654
33717
|
else if (tableStart > startOffset && tableEnd < endOffset) {
|
|
33655
33718
|
if (tableStartPosition = skeleton.findNodePositionByCharIndex(tableStart + 3, !0, segmentId, segmentPage), tableEndPosition = skeleton.findNodePositionByCharIndex(tableEnd - 4, !0, segmentId, segmentPage), start <= tableStart - 1) {
|
|
33656
|
-
const sp = skeleton.findNodePositionByCharIndex(start, !0, segmentId, segmentPage), ep = skeleton.findNodePositionByCharIndex(tableStart - 1, !1, segmentId, segmentPage), ap = direction ? sp : ep, fp = direction ? ep : sp;
|
|
33719
|
+
const sp = skeleton.findNodePositionByCharIndex(start, !0, segmentId, segmentPage), ep = skeleton.findNodePositionByCharIndex(tableStart - 1, !1, segmentId, segmentPage), ap = direction === RANGE_DIRECTION.FORWARD ? sp : ep, fp = direction === RANGE_DIRECTION.FORWARD ? ep : sp;
|
|
33657
33720
|
textRanges.push(new TextRange(scene, document2, skeleton, ap, fp, style, segmentId));
|
|
33658
33721
|
}
|
|
33659
33722
|
start = tableEnd + 1;
|
|
33660
33723
|
}
|
|
33661
33724
|
if (tableStartPosition && tableEndPosition) {
|
|
33662
|
-
const ap = direction ? tableStartPosition : tableEndPosition, fp = direction ? tableEndPosition : tableStartPosition;
|
|
33725
|
+
const ap = direction === RANGE_DIRECTION.FORWARD ? tableStartPosition : tableEndPosition, fp = direction === RANGE_DIRECTION.FORWARD ? tableEndPosition : tableStartPosition;
|
|
33663
33726
|
rectRanges.push(...convertPositionsToRectRanges(
|
|
33664
33727
|
scene,
|
|
33665
33728
|
document2,
|
|
@@ -33672,7 +33735,7 @@ function getRangeListFromSelection(anchorPosition, focusPosition, scene, documen
|
|
|
33672
33735
|
}
|
|
33673
33736
|
}
|
|
33674
33737
|
if (end >= startIndex && end <= endIndex || endInTable) {
|
|
33675
|
-
const sp = skeleton.findNodePositionByCharIndex(start, !0, segmentId, segmentPage), ep = skeleton.findNodePositionByCharIndex(end, !endInTable, segmentId, segmentPage), ap = direction ? sp : ep, fp = direction ? ep : sp;
|
|
33738
|
+
const sp = skeleton.findNodePositionByCharIndex(start, !0, segmentId, segmentPage), ep = skeleton.findNodePositionByCharIndex(end, !endInTable, segmentId, segmentPage), ap = direction === RANGE_DIRECTION.FORWARD ? sp : ep, fp = direction === RANGE_DIRECTION.FORWARD ? ep : sp;
|
|
33676
33739
|
if (rectRanges.length && Tools.diffValue(ap, fp))
|
|
33677
33740
|
continue;
|
|
33678
33741
|
textRanges.push(new TextRange(scene, document2, skeleton, ap, fp, style, segmentId));
|
|
@@ -33872,7 +33935,7 @@ let TextSelectionRenderManager = (_a10 = class extends RxDisposable {
|
|
|
33872
33935
|
}), this._updateInputPosition();
|
|
33873
33936
|
}
|
|
33874
33937
|
setCursorManually(evtOffsetX, evtOffsetY) {
|
|
33875
|
-
const startNode = this.
|
|
33938
|
+
const startNode = this._findNodeByCoord(evtOffsetX, evtOffsetY, {
|
|
33876
33939
|
strict: !0,
|
|
33877
33940
|
segmentId: this._currentSegmentId,
|
|
33878
33941
|
segmentPage: this._currentSegmentPage
|
|
@@ -33923,7 +33986,7 @@ let TextSelectionRenderManager = (_a10 = class extends RxDisposable {
|
|
|
33923
33986
|
handleDblClick(evt) {
|
|
33924
33987
|
if (!this._scene || !this._isSelectionEnabled)
|
|
33925
33988
|
return;
|
|
33926
|
-
const { offsetX: evtOffsetX, offsetY: evtOffsetY } = evt, startNode = this.
|
|
33989
|
+
const { offsetX: evtOffsetX, offsetY: evtOffsetY } = evt, startNode = this._findNodeByCoord(evtOffsetX, evtOffsetY, {
|
|
33927
33990
|
strict: !1,
|
|
33928
33991
|
segmentId: this._currentSegmentId,
|
|
33929
33992
|
segmentPage: this._currentSegmentPage
|
|
@@ -33957,7 +34020,7 @@ let TextSelectionRenderManager = (_a10 = class extends RxDisposable {
|
|
|
33957
34020
|
handleTripleClick(evt) {
|
|
33958
34021
|
if (!this._scene || !this._isSelectionEnabled)
|
|
33959
34022
|
return;
|
|
33960
|
-
const { offsetX: evtOffsetX, offsetY: evtOffsetY } = evt, startNode = this.
|
|
34023
|
+
const { offsetX: evtOffsetX, offsetY: evtOffsetY } = evt, startNode = this._findNodeByCoord(evtOffsetX, evtOffsetY, {
|
|
33961
34024
|
strict: !1,
|
|
33962
34025
|
segmentId: this._currentSegmentId,
|
|
33963
34026
|
segmentPage: this._currentSegmentPage
|
|
@@ -33983,7 +34046,7 @@ let TextSelectionRenderManager = (_a10 = class extends RxDisposable {
|
|
|
33983
34046
|
if (!this._scene || !this._isSelectionEnabled)
|
|
33984
34047
|
return;
|
|
33985
34048
|
this._editorFocusing = !0;
|
|
33986
|
-
const scene = this._scene, { offsetX: evtOffsetX, offsetY: evtOffsetY } = evt, startNode = this.
|
|
34049
|
+
const scene = this._scene, { offsetX: evtOffsetX, offsetY: evtOffsetY } = evt, startNode = this._findNodeByCoord(evtOffsetX, evtOffsetY, {
|
|
33987
34050
|
strict: !1,
|
|
33988
34051
|
segmentId: this._currentSegmentId,
|
|
33989
34052
|
segmentPage: this._currentSegmentPage
|
|
@@ -34235,7 +34298,7 @@ let TextSelectionRenderManager = (_a10 = class extends RxDisposable {
|
|
|
34235
34298
|
var _a11, _b;
|
|
34236
34299
|
if (this._docSkeleton == null)
|
|
34237
34300
|
return;
|
|
34238
|
-
const focusNode = this.
|
|
34301
|
+
const focusNode = this._findNodeByCoord(moveOffsetX, moveOffsetY, {
|
|
34239
34302
|
strict: !0,
|
|
34240
34303
|
segmentId: this._currentSegmentId,
|
|
34241
34304
|
segmentPage: this._currentSegmentPage
|
|
@@ -34375,7 +34438,7 @@ let TextSelectionRenderManager = (_a10 = class extends RxDisposable {
|
|
|
34375
34438
|
if (originCoord)
|
|
34376
34439
|
return documentTransform.clone().invert().applyPoint(originCoord);
|
|
34377
34440
|
}
|
|
34378
|
-
|
|
34441
|
+
_findNodeByCoord(evtOffsetX, evtOffsetY, restrictions) {
|
|
34379
34442
|
var _a11;
|
|
34380
34443
|
const coord = this._getTransformCoordForDocumentOffset(evtOffsetX, evtOffsetY);
|
|
34381
34444
|
if (coord == null)
|
|
@@ -34393,18 +34456,9 @@ let TextSelectionRenderManager = (_a10 = class extends RxDisposable {
|
|
|
34393
34456
|
restrictions
|
|
34394
34457
|
);
|
|
34395
34458
|
}
|
|
34396
|
-
_getNodeIndex(node) {
|
|
34397
|
-
return node.node.parent.st + node.node.parent.glyphGroup.indexOf(node.node);
|
|
34398
|
-
}
|
|
34399
34459
|
_detachEvent() {
|
|
34400
34460
|
this._onInputBefore$.complete(), this._onKeydown$.complete(), this._onInput$.complete(), this._onCompositionstart$.complete(), this._onCompositionupdate$.complete(), this._onCompositionend$.complete(), this._onSelectionStart$.complete();
|
|
34401
34461
|
}
|
|
34402
|
-
_activeSelectionRefresh() {
|
|
34403
|
-
if (this._docSkeleton == null)
|
|
34404
|
-
return;
|
|
34405
|
-
const activeRangeInstance = this._getActiveRangeInstance();
|
|
34406
|
-
activeRangeInstance == null || activeRangeInstance.refresh();
|
|
34407
|
-
}
|
|
34408
34462
|
}, __name(_a10, "TextSelectionRenderManager"), _a10);
|
|
34409
34463
|
TextSelectionRenderManager = __decorateClass([
|
|
34410
34464
|
__decorateParam(0, ILogService)
|