@visactor/vrender-core 0.17.0-alpha.4 → 0.17.0-alpha.6
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/cjs/common/shape/rect.js +2 -1
- package/cjs/common/shape/rect.js.map +1 -1
- package/cjs/core/global.d.ts +0 -1
- package/cjs/core/global.js +1 -1
- package/cjs/core/global.js.map +1 -1
- package/cjs/core/stage.d.ts +3 -2
- package/cjs/core/stage.js +12 -12
- package/cjs/core/stage.js.map +1 -1
- package/cjs/graphic/config.js +4 -0
- package/cjs/graphic/config.js.map +1 -1
- package/cjs/graphic/graphic-service/graphic-service.js +4 -2
- package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
- package/cjs/graphic/graphic.js +3 -2
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/graphic/rect.d.ts +2 -3
- package/cjs/graphic/rect.js +3 -5
- package/cjs/graphic/rect.js.map +1 -1
- package/cjs/interface/global.d.ts +0 -1
- package/cjs/interface/global.js.map +1 -1
- package/cjs/interface/graphic/rect.d.ts +2 -0
- package/cjs/interface/graphic/rect.js.map +1 -1
- package/cjs/interface/stage.d.ts +1 -0
- package/cjs/interface/stage.js.map +1 -1
- package/cjs/render/contributions/render/base-render.js +9 -7
- package/cjs/render/contributions/render/base-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/rect-contribution-render.js +4 -1
- package/cjs/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/draw-contribution.d.ts +2 -2
- package/cjs/render/contributions/render/draw-contribution.js +2 -2
- package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
- package/cjs/render/contributions/render/draw-interceptor.d.ts +9 -1
- package/cjs/render/contributions/render/draw-interceptor.js +30 -18
- package/cjs/render/contributions/render/draw-interceptor.js.map +1 -1
- package/cjs/render/contributions/render/module.js +0 -6
- package/cjs/render/contributions/render/module.js.map +1 -1
- package/cjs/render/contributions/render/path-render.d.ts +2 -1
- package/cjs/render/contributions/render/path-render.js +6 -4
- package/cjs/render/contributions/render/path-render.js.map +1 -1
- package/cjs/render/contributions/render/rect-render.d.ts +2 -1
- package/cjs/render/contributions/render/rect-render.js +8 -3
- package/cjs/render/contributions/render/rect-render.js.map +1 -1
- package/cjs/render/contributions/render/utils.js +2 -2
- package/cjs/render/contributions/render/utils.js.map +1 -1
- package/cjs/render/render-service.js +1 -1
- package/cjs/render/render-service.js.map +1 -1
- package/dist/index.js +135 -93
- package/dist/index.min.js +1 -1
- package/es/common/shape/rect.js +2 -1
- package/es/common/shape/rect.js.map +1 -1
- package/es/core/global.d.ts +0 -1
- package/es/core/global.js +1 -1
- package/es/core/global.js.map +1 -1
- package/es/core/stage.d.ts +3 -2
- package/es/core/stage.js +12 -12
- package/es/core/stage.js.map +1 -1
- package/es/graphic/config.js +4 -0
- package/es/graphic/config.js.map +1 -1
- package/es/graphic/graphic-service/graphic-service.js +4 -2
- package/es/graphic/graphic-service/graphic-service.js.map +1 -1
- package/es/graphic/graphic.js +3 -2
- package/es/graphic/graphic.js.map +1 -1
- package/es/graphic/rect.d.ts +2 -3
- package/es/graphic/rect.js +3 -7
- package/es/graphic/rect.js.map +1 -1
- package/es/interface/global.d.ts +0 -1
- package/es/interface/global.js.map +1 -1
- package/es/interface/graphic/rect.d.ts +2 -0
- package/es/interface/graphic/rect.js.map +1 -1
- package/es/interface/stage.d.ts +1 -0
- package/es/interface/stage.js.map +1 -1
- package/es/render/contributions/render/base-render.js +10 -6
- package/es/render/contributions/render/base-render.js.map +1 -1
- package/es/render/contributions/render/contributions/rect-contribution-render.js +4 -1
- package/es/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
- package/es/render/contributions/render/draw-contribution.d.ts +2 -2
- package/es/render/contributions/render/draw-contribution.js +2 -2
- package/es/render/contributions/render/draw-contribution.js.map +1 -1
- package/es/render/contributions/render/draw-interceptor.d.ts +9 -1
- package/es/render/contributions/render/draw-interceptor.js +27 -26
- package/es/render/contributions/render/draw-interceptor.js.map +1 -1
- package/es/render/contributions/render/module.js +1 -4
- package/es/render/contributions/render/module.js.map +1 -1
- package/es/render/contributions/render/path-render.d.ts +2 -1
- package/es/render/contributions/render/path-render.js +5 -4
- package/es/render/contributions/render/path-render.js.map +1 -1
- package/es/render/contributions/render/rect-render.d.ts +2 -1
- package/es/render/contributions/render/rect-render.js +7 -2
- package/es/render/contributions/render/rect-render.js.map +1 -1
- package/es/render/contributions/render/utils.js +2 -2
- package/es/render/contributions/render/utils.js.map +1 -1
- package/es/render/render-service.js +1 -1
- package/es/render/render-service.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/render/render-service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAA8D;AAG9D,mDAA0D;AAE7C,QAAA,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAC5C,QAAA,yBAAyB,GAAG,MAAM,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;AAO1E,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAO/B,YAEmB,gBAAmC;QAAnC,qBAAgB,GAAhB,gBAAgB,CAAmB;IACnD,CAAC;IAGJ,OAAO,CAAC,YAAqB;
|
|
1
|
+
{"version":3,"sources":["../src/render/render-service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAA8D;AAG9D,mDAA0D;AAE7C,QAAA,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAC5C,QAAA,yBAAyB,GAAG,MAAM,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;AAO1E,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAO/B,YAEmB,gBAAmC;QAAnC,qBAAgB,GAAhB,gBAAgB,CAAmB;IACnD,CAAC;IAGJ,OAAO,CAAC,YAAqB;QAG3B,IAAI,CAAC,YAAY,EAAE;YACjB,OAAO;SACR;QACD,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YAC/B,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;QACH,OAAO;IACT,CAAC;IACS,QAAQ,CAAC,CAAW,EAAE,YAAqB;QACnD,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE;YACpB,IAAI,CAAC,QAAQ,CAAC,CAAa,EAAE,YAAY,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;QACH,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,iBAAiB;QACf,OAAO;IACT,CAAC;IAED,UAAU,CAAC,MAAgC;QACzC,OAAO;IACT,CAAC;IAED,IAAI,CAAC,MAAgC;QACnC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,oBAAO,IAAI,CAAC,UAAU,EAAG,CAAC;IAC3D,CAAC;IAED,SAAS,CAAC,MAAgC;QACxC,IAAI,CAAC,gBAAgB,CAAC,SAAS,IAAI,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,IAAI,oBAAO,IAAI,CAAC,UAAU,EAAG,CAAC;QACjG,OAAO;IACT,CAAC;IAED,MAAM,CAAC,MAAgB,EAAE,MAAgC;QACvD,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;QACzB,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;QACzC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC3B,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC;CACF,CAAA;AA1DY,oBAAoB;IADhC,IAAA,2BAAU,GAAE;IASR,WAAA,IAAA,uBAAM,EAAC,yBAAgB,CAAC,CAAA;;GARhB,oBAAoB,CA0DhC;AA1DY,oDAAoB","file":"render-service.js","sourcesContent":["import { injectable, inject } from '../common/inversify-lite';\nimport type { IAABBBounds, IBounds } from '@visactor/vutils';\nimport type { IGroup, IGraphic, IRenderService, IRenderServiceDrawParams, IDrawContribution } from '../interface';\nimport { DrawContribution } from './contributions/render';\n\nexport const RenderService = Symbol.for('RenderService');\nexport const BeforeRenderConstribution = Symbol.for('BeforeRenderConstribution');\n\n/**\n * 渲染用的service,通常和stage一一绑定,\n * 并不是单例模式,所以会绑定此次渲染的一些数据\n */\n@injectable()\nexport class DefaultRenderService implements IRenderService {\n // 每次render都会变的数据\n dirtyBounds: IBounds;\n renderTreeRoots: IGraphic[]; // 此次render的数组\n renderLists: IGraphic[];\n drawParams: IRenderServiceDrawParams;\n\n constructor(\n @inject(DrawContribution)\n private readonly drawContribution: IDrawContribution\n ) {}\n\n // 渲染前准备工作,计算bounds等逻辑\n prepare(updateBounds: boolean): void {\n // 如果不需要计算Bounds,那么transMatrix也不需要计算\n // TODO 后期可能存在依赖transMatrix的插件,但目前不存在\n if (!updateBounds) {\n return;\n }\n this.renderTreeRoots.forEach(g => {\n this._prepare(g, updateBounds);\n });\n return;\n }\n protected _prepare(g: IGraphic, updateBounds: boolean) {\n g.forEachChildren(g => {\n this._prepare(g as IGraphic, updateBounds);\n });\n g.update({ bounds: updateBounds, trans: true });\n }\n // 获取要渲染的list,可能存在一些不用渲染的内容,以及外描边\n prepareRenderList(): void {\n return;\n }\n // 渲染前流程\n beforeDraw(params: IRenderServiceDrawParams): void {\n return;\n }\n // 具体渲染\n draw(params: IRenderServiceDrawParams): void {\n this.drawContribution.draw(this, { ...this.drawParams });\n }\n // 渲染后流程\n afterDraw(params: IRenderServiceDrawParams): void {\n this.drawContribution.afterDraw && this.drawContribution.afterDraw(this, { ...this.drawParams });\n return;\n }\n // 对外暴露的绘制方法\n render(groups: IGroup[], params: IRenderServiceDrawParams): void {\n this.renderTreeRoots = groups;\n this.drawParams = params;\n const updateBounds = params.updateBounds;\n this.prepare(updateBounds);\n this.prepareRenderList();\n this.beforeDraw(params);\n this.draw(params);\n this.afterDraw(params);\n }\n}\n"]}
|
package/dist/index.js
CHANGED
|
@@ -1214,7 +1214,6 @@
|
|
|
1214
1214
|
};
|
|
1215
1215
|
this.measureTextMethod = 'native';
|
|
1216
1216
|
this.optimizeVisible = false;
|
|
1217
|
-
this.optmizeSkipCheckBoundariesThreshold = 0;
|
|
1218
1217
|
}
|
|
1219
1218
|
bindContribution(params) {
|
|
1220
1219
|
const promiseArr = [];
|
|
@@ -3183,8 +3182,8 @@
|
|
|
3183
3182
|
console.warn('空函数');
|
|
3184
3183
|
} });
|
|
3185
3184
|
const DefaultPolygonAttribute = Object.assign(Object.assign({}, DefaultAttribute), { points: [], cornerRadius: 0, closePath: true });
|
|
3186
|
-
const DefaultRectAttribute = Object.assign(Object.assign({}, DefaultAttribute), { width: 0, height: 0, strokeBoundsBuffer: 0, cornerRadius: 0 });
|
|
3187
|
-
const DefaultRect3dAttribute = Object.assign(Object.assign({}, DefaultAttribute), { width: 0, height: 0, cornerRadius: 0, length: 0 });
|
|
3185
|
+
const DefaultRectAttribute = Object.assign(Object.assign({}, DefaultAttribute), { width: 0, height: 0, x1: 0, y1: 0, strokeBoundsBuffer: 0, cornerRadius: 0 });
|
|
3186
|
+
const DefaultRect3dAttribute = Object.assign(Object.assign({}, DefaultAttribute), { width: 0, height: 0, x1: 0, y1: 0, cornerRadius: 0, length: 0 });
|
|
3188
3187
|
const DefaultSymbolAttribute = Object.assign(Object.assign({}, DefaultAttribute), { symbolType: 'circle', size: 10, keepDirIn3d: true });
|
|
3189
3188
|
const DefaultTextAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultTextStyle), { strokeBoundsBuffer: 0, keepDirIn3d: true });
|
|
3190
3189
|
const DefaultRichTextAttribute = Object.assign(Object.assign({}, DefaultAttribute), { width: 300, height: 300, ellipsis: true, wordBreak: 'break-word', verticalDirection: 'top', textAlign: 'left', textBaseline: 'top', layoutDirection: 'horizontal', textConfig: [], maxHeight: undefined, maxWidth: undefined, singleLine: false });
|
|
@@ -10336,12 +10335,12 @@
|
|
|
10336
10335
|
this.in3dMode = false;
|
|
10337
10336
|
}
|
|
10338
10337
|
getOffsetXY(attr, includeScroll = false) {
|
|
10338
|
+
var _a, _b;
|
|
10339
10339
|
const { dx = attr.dx, dy = attr.dy } = this.attribute;
|
|
10340
10340
|
if (includeScroll && this.parent) {
|
|
10341
|
-
const
|
|
10342
|
-
|
|
10343
|
-
point.
|
|
10344
|
-
point.y = dy + scrollY;
|
|
10341
|
+
const attribute = this.parent.attribute;
|
|
10342
|
+
point.x = dx + ((_a = attribute.scrollX) !== null && _a !== void 0 ? _a : 0);
|
|
10343
|
+
point.y = dy + ((_b = attribute.scrollY) !== null && _b !== void 0 ? _b : 0);
|
|
10345
10344
|
}
|
|
10346
10345
|
else {
|
|
10347
10346
|
point.x = dx;
|
|
@@ -12469,13 +12468,13 @@
|
|
|
12469
12468
|
return fill && opacity * fillOpacity > 0;
|
|
12470
12469
|
}
|
|
12471
12470
|
function rectFillVisible(opacity, fillOpacity, width, height, fill) {
|
|
12472
|
-
return fill && opacity * fillOpacity > 0 && width
|
|
12471
|
+
return fill && opacity * fillOpacity > 0 && width !== 0 && height !== 0;
|
|
12473
12472
|
}
|
|
12474
12473
|
function strokeVisible(opacity, strokeOpacity) {
|
|
12475
12474
|
return opacity * strokeOpacity > 0;
|
|
12476
12475
|
}
|
|
12477
12476
|
function rectStrokeVisible(opacity, strokeOpacity, width, height) {
|
|
12478
|
-
return opacity * strokeOpacity > 0 && width
|
|
12477
|
+
return opacity * strokeOpacity > 0 && width !== 0 && height !== 0;
|
|
12479
12478
|
}
|
|
12480
12479
|
function drawPathProxy(graphic, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
12481
12480
|
if (!graphic.pathProxy) {
|
|
@@ -14811,7 +14810,7 @@
|
|
|
14811
14810
|
};
|
|
14812
14811
|
Line$1.NOWORK_ANIMATE_ATTR = Object.assign({ segments: 1, curveType: 1 }, NOWORK_ANIMATE_ATTR);
|
|
14813
14812
|
|
|
14814
|
-
const RECT_UPDATE_TAG_KEY = ['width', 'height', 'cornerRadius', ...GRAPHIC_UPDATE_TAG_KEY];
|
|
14813
|
+
const RECT_UPDATE_TAG_KEY = ['width', 'x1', 'y1', 'height', 'cornerRadius', ...GRAPHIC_UPDATE_TAG_KEY];
|
|
14815
14814
|
class Rect extends Graphic {
|
|
14816
14815
|
constructor(params) {
|
|
14817
14816
|
super(params);
|
|
@@ -14822,8 +14821,7 @@
|
|
|
14822
14821
|
return super.isValid() && this._isValid();
|
|
14823
14822
|
}
|
|
14824
14823
|
_isValid() {
|
|
14825
|
-
|
|
14826
|
-
return this._validNumber(width) && this._validNumber(height);
|
|
14824
|
+
return true;
|
|
14827
14825
|
}
|
|
14828
14826
|
doUpdateAABBBounds() {
|
|
14829
14827
|
const rectTheme = getTheme(this).rect;
|
|
@@ -14852,15 +14850,7 @@
|
|
|
14852
14850
|
return super.needUpdateTag(key, RECT_UPDATE_TAG_KEY);
|
|
14853
14851
|
}
|
|
14854
14852
|
toCustomPath() {
|
|
14855
|
-
|
|
14856
|
-
const width = attribute.width;
|
|
14857
|
-
const height = attribute.height;
|
|
14858
|
-
const x = 0;
|
|
14859
|
-
const y = 0;
|
|
14860
|
-
const path = new CustomPath2D();
|
|
14861
|
-
path.moveTo(x, y);
|
|
14862
|
-
path.rect(x, y, width, height);
|
|
14863
|
-
return path;
|
|
14853
|
+
throw new Error('暂不支持');
|
|
14864
14854
|
}
|
|
14865
14855
|
clone() {
|
|
14866
14856
|
return new Rect(Object.assign({}, this.attribute));
|
|
@@ -17460,8 +17450,11 @@
|
|
|
17460
17450
|
}
|
|
17461
17451
|
updateRectAABBBounds(attribute, rectTheme, aabbBounds, graphic) {
|
|
17462
17452
|
if (!this.updatePathProxyAABBBounds(aabbBounds, graphic)) {
|
|
17463
|
-
|
|
17464
|
-
|
|
17453
|
+
let { width, height } = attribute;
|
|
17454
|
+
const { x1, y1, x, y } = attribute;
|
|
17455
|
+
width = width !== null && width !== void 0 ? width : x1 - x;
|
|
17456
|
+
height = height !== null && height !== void 0 ? height : y1 - y;
|
|
17457
|
+
aabbBounds.set(0, 0, width || 0, height || 0);
|
|
17465
17458
|
}
|
|
17466
17459
|
const tb1 = this.tempAABBBounds1;
|
|
17467
17460
|
const tb2 = this.tempAABBBounds2;
|
|
@@ -18039,6 +18032,7 @@
|
|
|
18039
18032
|
return richText.AABBBounds;
|
|
18040
18033
|
}
|
|
18041
18034
|
|
|
18035
|
+
const result = { x: 0, y: 0, z: 0, lastModelMatrix: null };
|
|
18042
18036
|
class BaseRender {
|
|
18043
18037
|
init(contributions) {
|
|
18044
18038
|
if (contributions) {
|
|
@@ -18089,13 +18083,17 @@
|
|
|
18089
18083
|
};
|
|
18090
18084
|
}
|
|
18091
18085
|
transform(graphic, graphicAttribute, context, use3dMatrixIn3dMode = false) {
|
|
18092
|
-
const transMatrix = graphic.transMatrix;
|
|
18093
18086
|
const { x = graphicAttribute.x, y = graphicAttribute.y, z = graphicAttribute.z, scaleX = graphicAttribute.scaleX, scaleY = graphicAttribute.scaleY, angle = graphicAttribute.angle, postMatrix } = graphic.attribute;
|
|
18094
|
-
const onlyTranslate = transMatrix.onlyTranslate() && !postMatrix;
|
|
18095
18087
|
const lastModelMatrix = context.modelMatrix;
|
|
18096
18088
|
const camera = context.camera;
|
|
18097
|
-
|
|
18089
|
+
result.x = x;
|
|
18090
|
+
result.y = y;
|
|
18091
|
+
result.z = z;
|
|
18092
|
+
result.lastModelMatrix = lastModelMatrix;
|
|
18098
18093
|
const shouldTransform3d = camera && (use3dMatrixIn3dMode || shouldUseMat4(graphic));
|
|
18094
|
+
const onlyTranslate = shouldTransform3d
|
|
18095
|
+
? graphic.transMatrix.onlyTranslate() && !postMatrix
|
|
18096
|
+
: scaleX === 1 && scaleY === 1 && angle === 0 && !postMatrix;
|
|
18099
18097
|
if (shouldTransform3d) {
|
|
18100
18098
|
const nextModelMatrix = mat4Allocate.allocate();
|
|
18101
18099
|
const modelMatrix = mat4Allocate.allocate();
|
|
@@ -18717,6 +18715,14 @@
|
|
|
18717
18715
|
|
|
18718
18716
|
const halfPi = vutils.pi / 2;
|
|
18719
18717
|
function createRectPath(path, x, y, width, height, rectCornerRadius) {
|
|
18718
|
+
if (width < 0) {
|
|
18719
|
+
x += width;
|
|
18720
|
+
width = -width;
|
|
18721
|
+
}
|
|
18722
|
+
if (height < 0) {
|
|
18723
|
+
y += height;
|
|
18724
|
+
height = -height;
|
|
18725
|
+
}
|
|
18720
18726
|
let cornerRadius;
|
|
18721
18727
|
if (vutils.isNumber(rectCornerRadius, true)) {
|
|
18722
18728
|
cornerRadius = [
|
|
@@ -18908,7 +18914,10 @@
|
|
|
18908
18914
|
if (!(doOuterBorder || doInnerBorder)) {
|
|
18909
18915
|
return;
|
|
18910
18916
|
}
|
|
18911
|
-
const {
|
|
18917
|
+
const { cornerRadius = rectAttribute.cornerRadius, opacity = rectAttribute.opacity, x: originX = rectAttribute.x, y: originY = rectAttribute.y, scaleX = rectAttribute.scaleX, scaleY = rectAttribute.scaleY, x1, y1 } = rect.attribute;
|
|
18918
|
+
let { width, height } = rect.attribute;
|
|
18919
|
+
width = (width !== null && width !== void 0 ? width : x1 - x) || 0;
|
|
18920
|
+
height = (height !== null && height !== void 0 ? height : y1 - y) || 0;
|
|
18912
18921
|
const doStrokeOuter = !!(outerBorder && outerBorder.stroke);
|
|
18913
18922
|
const doStrokeInner = !!(innerBorder && innerBorder.stroke);
|
|
18914
18923
|
if (doOuterBorder) {
|
|
@@ -20543,10 +20552,10 @@
|
|
|
20543
20552
|
this.init(pathRenderContribitions);
|
|
20544
20553
|
}
|
|
20545
20554
|
drawShape(path, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
20546
|
-
var _a, _b;
|
|
20547
|
-
const pathAttribute = getTheme(path, params === null || params === void 0 ? void 0 : params.theme).path;
|
|
20555
|
+
var _a, _b, _c;
|
|
20556
|
+
const pathAttribute = (_a = this.tempTheme) !== null && _a !== void 0 ? _a : getTheme(path, params === null || params === void 0 ? void 0 : params.theme).path;
|
|
20548
20557
|
const { x: originX = pathAttribute.x, y: originY = pathAttribute.y } = path.attribute;
|
|
20549
|
-
const z = (
|
|
20558
|
+
const z = (_b = this.z) !== null && _b !== void 0 ? _b : 0;
|
|
20550
20559
|
const data = this.valid(path, pathAttribute, fillCb, strokeCb);
|
|
20551
20560
|
if (!data) {
|
|
20552
20561
|
return;
|
|
@@ -20557,7 +20566,7 @@
|
|
|
20557
20566
|
renderCommandList(path.pathShape.commandList, context, x, y, 1, 1, z);
|
|
20558
20567
|
}
|
|
20559
20568
|
else {
|
|
20560
|
-
const path2D = (
|
|
20569
|
+
const path2D = (_c = path.attribute.path) !== null && _c !== void 0 ? _c : pathAttribute.path;
|
|
20561
20570
|
renderCommandList(path2D.commandList, context, x, y, 1, 1, z);
|
|
20562
20571
|
}
|
|
20563
20572
|
context.setShadowBlendStyle && context.setShadowBlendStyle(path, path.attribute, pathAttribute);
|
|
@@ -20584,7 +20593,9 @@
|
|
|
20584
20593
|
}
|
|
20585
20594
|
draw(path, renderService, drawContext, params) {
|
|
20586
20595
|
const pathAttribute = getTheme(path, params === null || params === void 0 ? void 0 : params.theme).path;
|
|
20596
|
+
this.tempTheme = pathAttribute;
|
|
20587
20597
|
this._draw(path, pathAttribute, false, drawContext, params);
|
|
20598
|
+
this.tempTheme = null;
|
|
20588
20599
|
}
|
|
20589
20600
|
};
|
|
20590
20601
|
exports.DefaultCanvasPathRender = __decorate([
|
|
@@ -20610,8 +20621,12 @@
|
|
|
20610
20621
|
this.init(rectRenderContribitions);
|
|
20611
20622
|
}
|
|
20612
20623
|
drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
20613
|
-
|
|
20614
|
-
const
|
|
20624
|
+
var _a;
|
|
20625
|
+
const rectAttribute = (_a = this.tempTheme) !== null && _a !== void 0 ? _a : getTheme(rect, params === null || params === void 0 ? void 0 : params.theme).rect;
|
|
20626
|
+
const { fill = rectAttribute.fill, background, stroke = rectAttribute.stroke, cornerRadius = rectAttribute.cornerRadius, opacity = rectAttribute.opacity, fillOpacity = rectAttribute.fillOpacity, lineWidth = rectAttribute.lineWidth, strokeOpacity = rectAttribute.strokeOpacity, visible = rectAttribute.visible, x1, y1, x: originX = rectAttribute.x, y: originY = rectAttribute.y } = rect.attribute;
|
|
20627
|
+
let { width, height } = rect.attribute;
|
|
20628
|
+
width = (width !== null && width !== void 0 ? width : x1 - originX) || 0;
|
|
20629
|
+
height = (height !== null && height !== void 0 ? height : y1 - originY) || 0;
|
|
20615
20630
|
const fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill);
|
|
20616
20631
|
const sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height);
|
|
20617
20632
|
const doFill = runFill(fill, background);
|
|
@@ -20661,7 +20676,9 @@
|
|
|
20661
20676
|
}
|
|
20662
20677
|
draw(rect, renderService, drawContext, params) {
|
|
20663
20678
|
const rectAttribute = getTheme(rect, params === null || params === void 0 ? void 0 : params.theme).rect;
|
|
20679
|
+
this.tempTheme = rectAttribute;
|
|
20664
20680
|
this._draw(rect, rectAttribute, false, drawContext, params);
|
|
20681
|
+
this.tempTheme = null;
|
|
20665
20682
|
}
|
|
20666
20683
|
};
|
|
20667
20684
|
exports.DefaultCanvasRectRender = __decorate([
|
|
@@ -21311,6 +21328,9 @@
|
|
|
21311
21328
|
this.drawContribution = drawContribution;
|
|
21312
21329
|
}
|
|
21313
21330
|
prepare(updateBounds) {
|
|
21331
|
+
if (!updateBounds) {
|
|
21332
|
+
return;
|
|
21333
|
+
}
|
|
21314
21334
|
this.renderTreeRoots.forEach(g => {
|
|
21315
21335
|
this._prepare(g, updateBounds);
|
|
21316
21336
|
});
|
|
@@ -22008,7 +22028,7 @@
|
|
|
22008
22028
|
|
|
22009
22029
|
const DrawItemInterceptor = Symbol.for('DrawItemInterceptor');
|
|
22010
22030
|
const tempDirtyBounds = new vutils.AABBBounds();
|
|
22011
|
-
|
|
22031
|
+
class ShadowRootDrawItemInterceptorContribution {
|
|
22012
22032
|
constructor() {
|
|
22013
22033
|
this.order = 1;
|
|
22014
22034
|
}
|
|
@@ -22043,22 +22063,18 @@
|
|
|
22043
22063
|
}
|
|
22044
22064
|
return true;
|
|
22045
22065
|
}
|
|
22046
|
-
}
|
|
22047
|
-
|
|
22048
|
-
injectable()
|
|
22049
|
-
], ShadowRootDrawItemInterceptorContribution);
|
|
22050
|
-
let CommonDrawItemInterceptorContribution = class CommonDrawItemInterceptorContribution {
|
|
22066
|
+
}
|
|
22067
|
+
class DebugDrawItemInterceptorContribution {
|
|
22051
22068
|
constructor() {
|
|
22052
22069
|
this.order = 1;
|
|
22070
|
+
this.interceptors = [
|
|
22071
|
+
new ShadowRootDrawItemInterceptorContribution(),
|
|
22072
|
+
new Canvas3DDrawItemInterceptor(),
|
|
22073
|
+
new InteractiveDrawItemInterceptorContribution()
|
|
22074
|
+
];
|
|
22053
22075
|
}
|
|
22054
22076
|
afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
|
|
22055
|
-
if (graphic.attribute.
|
|
22056
|
-
this.drawItem(graphic, renderService, drawContext, drawContribution, params);
|
|
22057
|
-
}
|
|
22058
|
-
return false;
|
|
22059
|
-
}
|
|
22060
|
-
beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
|
|
22061
|
-
if (graphic.attribute.shadowRootIdx < 0) {
|
|
22077
|
+
if (graphic.attribute._debug_bounds) {
|
|
22062
22078
|
this.drawItem(graphic, renderService, drawContext, drawContribution, params);
|
|
22063
22079
|
}
|
|
22064
22080
|
return false;
|
|
@@ -22081,11 +22097,46 @@
|
|
|
22081
22097
|
context.highPerformanceRestore();
|
|
22082
22098
|
return true;
|
|
22083
22099
|
}
|
|
22100
|
+
}
|
|
22101
|
+
let CommonDrawItemInterceptorContribution = class CommonDrawItemInterceptorContribution {
|
|
22102
|
+
constructor() {
|
|
22103
|
+
this.order = 1;
|
|
22104
|
+
this.interceptors = [
|
|
22105
|
+
new ShadowRootDrawItemInterceptorContribution(),
|
|
22106
|
+
new Canvas3DDrawItemInterceptor(),
|
|
22107
|
+
new InteractiveDrawItemInterceptorContribution(),
|
|
22108
|
+
new DebugDrawItemInterceptorContribution()
|
|
22109
|
+
];
|
|
22110
|
+
}
|
|
22111
|
+
afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
|
|
22112
|
+
for (let i = 0; i < this.interceptors.length; i++) {
|
|
22113
|
+
if (this.interceptors[i].afterDrawItem &&
|
|
22114
|
+
this.interceptors[i].afterDrawItem(graphic, renderService, drawContext, drawContribution, params)) {
|
|
22115
|
+
return true;
|
|
22116
|
+
}
|
|
22117
|
+
}
|
|
22118
|
+
return false;
|
|
22119
|
+
}
|
|
22120
|
+
beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
|
|
22121
|
+
if ((!graphic.in3dMode || drawContext.in3dInterceptor) &&
|
|
22122
|
+
!graphic.shadowRoot &&
|
|
22123
|
+
!(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)) {
|
|
22124
|
+
return false;
|
|
22125
|
+
}
|
|
22126
|
+
for (let i = 0; i < this.interceptors.length; i++) {
|
|
22127
|
+
if (this.interceptors[i].beforeDrawItem &&
|
|
22128
|
+
this.interceptors[i].beforeDrawItem(graphic, renderService, drawContext, drawContribution, params)) {
|
|
22129
|
+
return true;
|
|
22130
|
+
}
|
|
22131
|
+
}
|
|
22132
|
+
return false;
|
|
22133
|
+
}
|
|
22084
22134
|
};
|
|
22085
22135
|
CommonDrawItemInterceptorContribution = __decorate([
|
|
22086
|
-
injectable()
|
|
22136
|
+
injectable(),
|
|
22137
|
+
__metadata("design:paramtypes", [])
|
|
22087
22138
|
], CommonDrawItemInterceptorContribution);
|
|
22088
|
-
|
|
22139
|
+
class InteractiveDrawItemInterceptorContribution {
|
|
22089
22140
|
constructor() {
|
|
22090
22141
|
this.order = 1;
|
|
22091
22142
|
}
|
|
@@ -22156,11 +22207,8 @@
|
|
|
22156
22207
|
}
|
|
22157
22208
|
return (_a = group.shadowRoot) !== null && _a !== void 0 ? _a : group.attachShadow();
|
|
22158
22209
|
}
|
|
22159
|
-
}
|
|
22160
|
-
|
|
22161
|
-
injectable()
|
|
22162
|
-
], InteractiveDrawItemInterceptorContribution);
|
|
22163
|
-
let Canvas3DDrawItemInterceptor = class Canvas3DDrawItemInterceptor {
|
|
22210
|
+
}
|
|
22211
|
+
class Canvas3DDrawItemInterceptor {
|
|
22164
22212
|
constructor() {
|
|
22165
22213
|
this.order = 1;
|
|
22166
22214
|
}
|
|
@@ -22300,10 +22348,7 @@
|
|
|
22300
22348
|
initCanvasCtx(context) {
|
|
22301
22349
|
context.setTransformForCurrent();
|
|
22302
22350
|
}
|
|
22303
|
-
}
|
|
22304
|
-
Canvas3DDrawItemInterceptor = __decorate([
|
|
22305
|
-
injectable()
|
|
22306
|
-
], Canvas3DDrawItemInterceptor);
|
|
22351
|
+
}
|
|
22307
22352
|
|
|
22308
22353
|
class DefaultBoundsAllocate {
|
|
22309
22354
|
constructor() {
|
|
@@ -22375,12 +22420,11 @@
|
|
|
22375
22420
|
.sort((a, b) => a.order - b.order);
|
|
22376
22421
|
}
|
|
22377
22422
|
prepareForDraw(renderService, drawContext) {
|
|
22378
|
-
|
|
22379
|
-
|
|
22380
|
-
this.useDirtyBounds = false;
|
|
22423
|
+
if (drawContext.updateBounds) {
|
|
22424
|
+
this.useDirtyBounds = true;
|
|
22381
22425
|
}
|
|
22382
22426
|
else {
|
|
22383
|
-
this.useDirtyBounds =
|
|
22427
|
+
this.useDirtyBounds = !drawContext.stage.params.optimize.disableCheckGraphicWidthOutRange;
|
|
22384
22428
|
}
|
|
22385
22429
|
}
|
|
22386
22430
|
draw(renderService, drawContext) {
|
|
@@ -22460,7 +22504,7 @@
|
|
|
22460
22504
|
if (this.useDirtyBounds && !vutils.isRectIntersect(group.AABBBounds, this.dirtyBounds, false)) {
|
|
22461
22505
|
return;
|
|
22462
22506
|
}
|
|
22463
|
-
let nextM;
|
|
22507
|
+
let nextM = parentMatrix;
|
|
22464
22508
|
let tempBounds;
|
|
22465
22509
|
if (this.useDirtyBounds) {
|
|
22466
22510
|
tempBounds = boundsAllocate.allocateByObj(this.dirtyBounds);
|
|
@@ -22553,10 +22597,9 @@
|
|
|
22553
22597
|
if (this.InterceptorContributions.length) {
|
|
22554
22598
|
for (let i = 0; i < this.InterceptorContributions.length; i++) {
|
|
22555
22599
|
const drawContribution = this.InterceptorContributions[i];
|
|
22556
|
-
if (drawContribution.beforeDrawItem
|
|
22557
|
-
|
|
22558
|
-
|
|
22559
|
-
}
|
|
22600
|
+
if (drawContribution.beforeDrawItem &&
|
|
22601
|
+
drawContribution.beforeDrawItem(graphic, this.currentRenderService, drawContext, this, params)) {
|
|
22602
|
+
return;
|
|
22560
22603
|
}
|
|
22561
22604
|
}
|
|
22562
22605
|
}
|
|
@@ -23739,14 +23782,8 @@
|
|
|
23739
23782
|
bind(PolygonRenderContribution).toService(exports.DefaultBaseInteractiveRenderContribution);
|
|
23740
23783
|
bindContributionProvider(bind, InteractiveSubRenderContribution);
|
|
23741
23784
|
bindContributionProvider(bind, GraphicRender);
|
|
23742
|
-
bind(ShadowRootDrawItemInterceptorContribution).toSelf().inSingletonScope();
|
|
23743
|
-
bind(DrawItemInterceptor).toService(ShadowRootDrawItemInterceptorContribution);
|
|
23744
23785
|
bind(CommonDrawItemInterceptorContribution).toSelf().inSingletonScope();
|
|
23745
23786
|
bind(DrawItemInterceptor).toService(CommonDrawItemInterceptorContribution);
|
|
23746
|
-
bind(Canvas3DDrawItemInterceptor).toSelf().inSingletonScope();
|
|
23747
|
-
bind(DrawItemInterceptor).toService(Canvas3DDrawItemInterceptor);
|
|
23748
|
-
bind(InteractiveDrawItemInterceptorContribution).toSelf().inSingletonScope();
|
|
23749
|
-
bind(DrawItemInterceptor).toService(InteractiveDrawItemInterceptorContribution);
|
|
23750
23787
|
bindContributionProvider(bind, DrawItemInterceptor);
|
|
23751
23788
|
});
|
|
23752
23789
|
|
|
@@ -24814,12 +24851,28 @@
|
|
|
24814
24851
|
return this.at(0);
|
|
24815
24852
|
}
|
|
24816
24853
|
get eventSystem() {
|
|
24817
|
-
this.tryInitEventSystem();
|
|
24818
24854
|
return this._eventSystem;
|
|
24819
24855
|
}
|
|
24820
|
-
constructor(params) {
|
|
24856
|
+
constructor(params = {}) {
|
|
24821
24857
|
var _a;
|
|
24822
24858
|
super({});
|
|
24859
|
+
this._onVisibleChange = (visible) => {
|
|
24860
|
+
if (this._skipRender < 0) {
|
|
24861
|
+
return;
|
|
24862
|
+
}
|
|
24863
|
+
if (visible) {
|
|
24864
|
+
if (this.dirtyBounds) {
|
|
24865
|
+
this.dirtyBounds.setValue(0, 0, this._viewBox.width(), this._viewBox.height());
|
|
24866
|
+
}
|
|
24867
|
+
if (this._skipRender > 1) {
|
|
24868
|
+
this.renderNextFrame();
|
|
24869
|
+
}
|
|
24870
|
+
this._skipRender = 0;
|
|
24871
|
+
}
|
|
24872
|
+
else {
|
|
24873
|
+
this._skipRender = 1;
|
|
24874
|
+
}
|
|
24875
|
+
};
|
|
24823
24876
|
this.beforeRender = (stage) => {
|
|
24824
24877
|
this._beforeRender && this._beforeRender(stage);
|
|
24825
24878
|
};
|
|
@@ -24862,6 +24915,7 @@
|
|
|
24862
24915
|
}
|
|
24863
24916
|
this.state = 'normal';
|
|
24864
24917
|
this.renderCount = 0;
|
|
24918
|
+
this.tryInitEventSystem();
|
|
24865
24919
|
this._subView = !(this._viewBox.width() === this.width && this._viewBox.height() === this.height);
|
|
24866
24920
|
this._background = (_a = params.background) !== null && _a !== void 0 ? _a : DefaultConfig$1.BACKGROUND;
|
|
24867
24921
|
this.appendChild(this.layerService.createLayer(this, { main: true }));
|
|
@@ -24888,6 +24942,9 @@
|
|
|
24888
24942
|
this.timeline = new DefaultTimeline();
|
|
24889
24943
|
this.ticker.addTimeline(this.timeline);
|
|
24890
24944
|
this.timeline.pause();
|
|
24945
|
+
if (!params.optimize) {
|
|
24946
|
+
params.optimize = {};
|
|
24947
|
+
}
|
|
24891
24948
|
this.optmize(params.optimize);
|
|
24892
24949
|
if (params.background && vutils.isString(this._background) && this._background.includes('/')) {
|
|
24893
24950
|
this.setAttributes({ background: this._background });
|
|
@@ -24923,7 +24980,7 @@
|
|
|
24923
24980
|
this._skipRender = -Infinity;
|
|
24924
24981
|
}
|
|
24925
24982
|
else {
|
|
24926
|
-
if (this.params
|
|
24983
|
+
if (this.params.optimize.skipRenderWithOutRange !== false) {
|
|
24927
24984
|
this._skipRender = this.window.isVisible() ? 0 : 1;
|
|
24928
24985
|
}
|
|
24929
24986
|
else {
|
|
@@ -24932,30 +24989,15 @@
|
|
|
24932
24989
|
}
|
|
24933
24990
|
}
|
|
24934
24991
|
optmize(params) {
|
|
24935
|
-
this.optmizeRender(params
|
|
24992
|
+
this.optmizeRender(params.skipRenderWithOutRange);
|
|
24993
|
+
this.params.optimize = params;
|
|
24936
24994
|
}
|
|
24937
24995
|
optmizeRender(skipRenderWithOutRange = false) {
|
|
24938
24996
|
if (!skipRenderWithOutRange) {
|
|
24939
24997
|
return;
|
|
24940
24998
|
}
|
|
24941
24999
|
this._skipRender = this._skipRender < 0 ? this._skipRender : this.window.isVisible() ? 0 : 1;
|
|
24942
|
-
this.window.onVisibleChange(
|
|
24943
|
-
if (this._skipRender < 0) {
|
|
24944
|
-
return;
|
|
24945
|
-
}
|
|
24946
|
-
if (visible) {
|
|
24947
|
-
if (this.dirtyBounds) {
|
|
24948
|
-
this.dirtyBounds.setValue(0, 0, this._viewBox.width(), this._viewBox.height());
|
|
24949
|
-
}
|
|
24950
|
-
if (this._skipRender > 1) {
|
|
24951
|
-
this.renderNextFrame();
|
|
24952
|
-
}
|
|
24953
|
-
this._skipRender = 0;
|
|
24954
|
-
}
|
|
24955
|
-
else {
|
|
24956
|
-
this._skipRender = 1;
|
|
24957
|
-
}
|
|
24958
|
-
});
|
|
25000
|
+
this.window.onVisibleChange(this._onVisibleChange);
|
|
24959
25001
|
}
|
|
24960
25002
|
getTimeline() {
|
|
24961
25003
|
return this.timeline;
|