@visactor/react-vchart 2.1.2-alpha.3 → 2.1.2-alpha.5

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/build/index.js CHANGED
@@ -23192,6 +23192,199 @@
23192
23192
  }
23193
23193
  }
23194
23194
 
23195
+ function drawArcPath(arc, context, cx, cy, z, outerRadius, innerRadius) {
23196
+ const {
23197
+ startAngle: startAngle,
23198
+ endAngle: endAngle
23199
+ } = arc.getParsedAngle(),
23200
+ deltaAngle = abs$1(endAngle - startAngle),
23201
+ clockwise = endAngle > startAngle;
23202
+ let collapsedToLine = !1;
23203
+ if (outerRadius < innerRadius) {
23204
+ const temp = outerRadius;
23205
+ outerRadius = innerRadius, innerRadius = temp;
23206
+ }
23207
+ if (outerRadius <= epsilon$1) context.moveTo(cx, cy, z);else if (deltaAngle >= pi2 - epsilon$1) context.moveTo(cx + outerRadius * cos$1(startAngle), cy + outerRadius * sin$1(startAngle), z), context.arc(cx, cy, outerRadius, startAngle, endAngle, !clockwise, z), innerRadius > epsilon$1 && (context.moveTo(cx + innerRadius * cos$1(endAngle), cy + innerRadius * sin$1(endAngle), z), context.arc(cx, cy, innerRadius, endAngle, startAngle, clockwise, z));else {
23208
+ const {
23209
+ outerDeltaAngle: outerDeltaAngle,
23210
+ innerDeltaAngle: innerDeltaAngle,
23211
+ outerStartAngle: outerStartAngle,
23212
+ outerEndAngle: outerEndAngle,
23213
+ innerEndAngle: innerEndAngle,
23214
+ innerStartAngle: innerStartAngle
23215
+ } = arc.getParsePadAngle(startAngle, endAngle),
23216
+ xors = outerRadius * cos$1(outerStartAngle),
23217
+ yors = outerRadius * sin$1(outerStartAngle),
23218
+ xire = innerRadius * cos$1(innerEndAngle),
23219
+ yire = innerRadius * sin$1(innerEndAngle);
23220
+ outerDeltaAngle < .001 ? collapsedToLine = !0 : (context.moveTo(cx + xors, cy + yors, z), context.arc(cx, cy, outerRadius, outerStartAngle, outerEndAngle, !clockwise, z)), !(innerRadius > epsilon$1) || innerDeltaAngle < .001 ? (context.lineTo(cx + xire, cy + yire, z), collapsedToLine = !0) : (context.lineTo(cx + xire, cy + yire, z), context.arc(cx, cy, innerRadius, innerEndAngle, innerStartAngle, clockwise, z));
23221
+ }
23222
+ return context.closePath(), collapsedToLine;
23223
+ }
23224
+ function drawInnerOuterArcPath(arc, context, cx, cy, z1, z2, radius, getParsePadAngle) {
23225
+ const {
23226
+ startAngle: startAngle,
23227
+ endAngle: endAngle
23228
+ } = arc.getParsedAngle(),
23229
+ deltaAngle = abs$1(endAngle - startAngle),
23230
+ clockwise = endAngle > startAngle;
23231
+ let collapsedToLine = !1;
23232
+ if (radius <= epsilon$1) context.moveTo(cx, cy, z1);else if (deltaAngle >= pi2 - epsilon$1) context.moveTo(cx + radius * cos$1(startAngle), cy + radius * sin$1(startAngle), z1), context.arc(cx, cy, radius, startAngle, endAngle, !clockwise, z1), context.lineTo(cx + radius * cos$1(endAngle), cy + radius * sin$1(endAngle), z2), context.arc(cx, cy, radius, endAngle, startAngle, clockwise, z2);else {
23233
+ const {
23234
+ innerouterDeltaAngle: innerouterDeltaAngle,
23235
+ innerouterStartAngle: innerouterStartAngle,
23236
+ innerouterEndAngle: innerouterEndAngle
23237
+ } = getParsePadAngle(startAngle, endAngle),
23238
+ xors = radius * cos$1(innerouterStartAngle),
23239
+ yors = radius * sin$1(innerouterStartAngle),
23240
+ xore = radius * cos$1(innerouterEndAngle),
23241
+ yore = radius * sin$1(innerouterEndAngle);
23242
+ innerouterDeltaAngle < .001 ? collapsedToLine = !0 : (context.moveTo(cx + xors, cy + yors, z1), context.arc(cx, cy, radius, innerouterStartAngle, innerouterEndAngle, !clockwise, z1), context.lineTo(cx + xore, cy + yore, z2), context.arc(cx, cy, radius, innerouterEndAngle, innerouterStartAngle, clockwise, z2));
23243
+ }
23244
+ return context.closePath(), collapsedToLine;
23245
+ }
23246
+ class DefaultCanvasArc3DRender extends BaseRender {
23247
+ constructor() {
23248
+ super(...arguments), this.numberType = ARC3D_NUMBER_TYPE;
23249
+ }
23250
+ drawShape(arc, context, x, y, drawContext, params, fillCb, strokeCb) {
23251
+ var _a;
23252
+ const arcAttribute = getTheme$1(arc, null == params ? void 0 : params.theme).arc,
23253
+ {
23254
+ fill = arcAttribute.fill
23255
+ } = arc.attribute,
23256
+ data = this.valid(arc, arcAttribute, fillCb, strokeCb);
23257
+ if (!data) return;
23258
+ const {
23259
+ fVisible: fVisible,
23260
+ sVisible: sVisible,
23261
+ doFill: doFill,
23262
+ doStroke: doStroke
23263
+ } = data,
23264
+ z = null !== (_a = this.z) && void 0 !== _a ? _a : 0,
23265
+ {
23266
+ outerPadding = arcAttribute.outerPadding,
23267
+ innerPadding = arcAttribute.innerPadding,
23268
+ height = 10
23269
+ } = arc.attribute;
23270
+ let {
23271
+ outerRadius = arcAttribute.outerRadius,
23272
+ innerRadius = arcAttribute.innerRadius
23273
+ } = arc.attribute;
23274
+ outerRadius += outerPadding, innerRadius -= innerPadding;
23275
+ const rgbArray = ColorStore.Get(fill, ColorType.Color255),
23276
+ {
23277
+ light: light
23278
+ } = drawContext.stage || {},
23279
+ face = drawContext.hack_pieFace,
23280
+ z_face = {
23281
+ top: z,
23282
+ bottom: z + height
23283
+ },
23284
+ n_face = {
23285
+ top: [0, 1, 0],
23286
+ bottom: [0, -1, 0],
23287
+ outside: [1, 0, -1],
23288
+ inside: [1, 0, -1]
23289
+ };
23290
+ "bottom" === face || "top" === face ? (context.beginPath(), drawArcPath(arc, context, x, y, z_face[face], outerRadius, innerRadius), context.setShadowBlendStyle && context.setShadowBlendStyle(arc, arc.attribute, arcAttribute), doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute), context.fillStyle = light ? light.computeColor(n_face[face], rgbArray) : fill, context.fill())), doStroke && (strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke()))) : "outside" !== face && "inside" !== face || ("inside" === face && (context.save(), context.beginPath(), context.arc(x, y, innerRadius, 0, pi2, !0, z_face.top), context.clip()), context.beginPath(), drawInnerOuterArcPath(arc, context, x, y, z_face.top, z_face.bottom, "outside" === face ? outerRadius : innerRadius, (startAngle, endAngle) => {
23291
+ const {
23292
+ outerDeltaAngle: outerDeltaAngle,
23293
+ innerDeltaAngle: innerDeltaAngle,
23294
+ outerStartAngle: outerStartAngle,
23295
+ outerEndAngle: outerEndAngle,
23296
+ innerEndAngle: innerEndAngle,
23297
+ innerStartAngle: innerStartAngle
23298
+ } = arc.getParsePadAngle(startAngle, endAngle);
23299
+ return "outside" === face ? {
23300
+ innerouterDeltaAngle: outerDeltaAngle,
23301
+ innerouterEndAngle: outerEndAngle,
23302
+ innerouterStartAngle: outerStartAngle
23303
+ } : {
23304
+ innerouterDeltaAngle: innerDeltaAngle,
23305
+ innerouterEndAngle: innerEndAngle,
23306
+ innerouterStartAngle: innerStartAngle
23307
+ };
23308
+ }), context.setShadowBlendStyle && context.setShadowBlendStyle(arc, arc.attribute, arcAttribute), doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute), context.fillStyle = light ? light.computeColor(n_face[face], rgbArray) : fill, context.fill())), doStroke && (strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke())), "inside" === face && context.restore());
23309
+ }
23310
+ draw(arc, renderService, drawContext, params) {
23311
+ const arcAttribute = getTheme$1(arc, null == params ? void 0 : params.theme).arc;
23312
+ this._draw(arc, arcAttribute, !1, drawContext, params);
23313
+ }
23314
+ }
23315
+
23316
+ class Base3dRender extends BaseRender {
23317
+ stroke(x, y, z, face3d, context) {
23318
+ const vertices = face3d.vertices;
23319
+ face3d.edges.forEach(edge => {
23320
+ const p1 = vertices[edge[0]],
23321
+ v1 = {
23322
+ x: x + p1[0],
23323
+ y: y + p1[1],
23324
+ z: z + p1[2]
23325
+ },
23326
+ p2 = vertices[edge[1]],
23327
+ v2 = {
23328
+ x: x + p2[0],
23329
+ y: y + p2[1],
23330
+ z: z + p2[2]
23331
+ };
23332
+ context.beginPath(), context.moveTo(v1.x, v1.y, v1.z), context.lineTo(v2.x, v2.y, v2.z), context.stroke();
23333
+ });
23334
+ }
23335
+ fill(x, y, z, face3d, faces, fillColor, context, light, graphic3d, graphic3dAttribute, fillCb) {
23336
+ const rgbArray = ColorStore.Get(fillColor, ColorType.Color255),
23337
+ vertices = face3d.vertices,
23338
+ viewdVerticesZ = vertices.map(v => context.view(v[0], v[1], v[2])[2]),
23339
+ sortFace = [];
23340
+ face3d.polygons.forEach((p, i) => {
23341
+ if (faces && !faces[i]) return;
23342
+ sortFace.push({
23343
+ faceIdx: i,
23344
+ polygon: p
23345
+ });
23346
+ const {
23347
+ polygon: polygon
23348
+ } = p,
23349
+ z1 = viewdVerticesZ[polygon[0]],
23350
+ z2 = viewdVerticesZ[polygon[1]],
23351
+ z3 = viewdVerticesZ[polygon[2]],
23352
+ z4 = viewdVerticesZ[polygon[3]];
23353
+ p.ave_z = z1 + z2 + z3 + z4;
23354
+ }), sortFace.sort((a, b) => b.polygon.ave_z - a.polygon.ave_z), sortFace.forEach(item => {
23355
+ const {
23356
+ polygon: polygon,
23357
+ normal: normal
23358
+ } = item.polygon,
23359
+ p1 = vertices[polygon[0]],
23360
+ p2 = vertices[polygon[1]],
23361
+ p3 = vertices[polygon[2]],
23362
+ p4 = vertices[polygon[3]],
23363
+ v1 = {
23364
+ x: x + p1[0],
23365
+ y: y + p1[1],
23366
+ z: z + p1[2]
23367
+ },
23368
+ v2 = {
23369
+ x: x + p2[0],
23370
+ y: y + p2[1],
23371
+ z: z + p2[2]
23372
+ },
23373
+ v3 = {
23374
+ x: x + p3[0],
23375
+ y: y + p3[1],
23376
+ z: z + p3[2]
23377
+ },
23378
+ v4 = {
23379
+ x: x + p4[0],
23380
+ y: y + p4[1],
23381
+ z: z + p4[2]
23382
+ };
23383
+ context.beginPath(), context.moveTo(v1.x, v1.y, v1.z), context.lineTo(v2.x, v2.y, v2.z), context.lineTo(v3.x, v3.y, v3.z), context.lineTo(v4.x, v4.y, v4.z), context.closePath(), fillCb ? fillCb(context, graphic3d && graphic3d.attribute, graphic3dAttribute) : (context.fillStyle = light ? light.computeColor(normal, rgbArray) : fillColor, context.fill());
23384
+ });
23385
+ }
23386
+ }
23387
+
23195
23388
  class DefaultCanvasCircleRender extends BaseRender {
23196
23389
  constructor(graphicRenderContributions) {
23197
23390
  super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = CIRCLE_NUMBER_TYPE, this.builtinContributions = [defaultCircleRenderContribution, defaultCircleBackgroundRenderContribution, defaultCircleTextureRenderContribution], this.init(graphicRenderContributions);
@@ -23878,6 +24071,57 @@
23878
24071
  }
23879
24072
  }
23880
24073
 
24074
+ class DefaultCanvasRect3dRender extends Base3dRender {
24075
+ constructor() {
24076
+ super(...arguments), this.type = "rect3d", this.numberType = RECT3D_NUMBER_TYPE;
24077
+ }
24078
+ drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
24079
+ var _a, _b;
24080
+ const rectAttribute = getTheme$1(rect, null == params ? void 0 : params.theme).rect,
24081
+ {
24082
+ fill = rectAttribute.fill,
24083
+ stroke = rectAttribute.stroke,
24084
+ x1: x1,
24085
+ y1: y1,
24086
+ x: originX,
24087
+ y: originY,
24088
+ opacity = rectAttribute.opacity,
24089
+ fillOpacity = rectAttribute.fillOpacity,
24090
+ lineWidth = rectAttribute.lineWidth,
24091
+ strokeOpacity = rectAttribute.strokeOpacity,
24092
+ visible = rectAttribute.visible,
24093
+ drawStrokeWhenZeroWH = null !== (_a = rectAttribute.drawStrokeWhenZeroWH) && void 0 !== _a && _a
24094
+ } = rect.attribute;
24095
+ let {
24096
+ width: width,
24097
+ height: height
24098
+ } = rect.attribute;
24099
+ width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0;
24100
+ const z = null !== (_b = this.z) && void 0 !== _b ? _b : 0,
24101
+ fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
24102
+ sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH),
24103
+ doFill = runFill(fill),
24104
+ doStroke = runStroke(stroke, lineWidth);
24105
+ if (!rect.valid || !visible) return;
24106
+ if (!doFill && !doStroke) return;
24107
+ if (!(fVisible || sVisible || fillCb || strokeCb)) return;
24108
+ const {
24109
+ light: light
24110
+ } = drawContext.stage || {},
24111
+ face3d = rect.findFace();
24112
+ if (!1 !== fill) {
24113
+ context.setCommonStyle(rect, rect.attribute, x, y, rectAttribute);
24114
+ let fc = fill;
24115
+ "string" != typeof fc && (fc = "black"), this.fill(x, y, z, face3d, null, fc, context, light, null, null, fillCb);
24116
+ }
24117
+ !1 !== stroke && (context.setStrokeStyle(rect, rect.attribute, x, y, rectAttribute), this.stroke(x, y, z, face3d, context));
24118
+ }
24119
+ draw(rect, renderService, drawContext) {
24120
+ const rectAttribute = getTheme$1(rect).rect;
24121
+ this._draw(rect, rectAttribute, !1, drawContext);
24122
+ }
24123
+ }
24124
+
23881
24125
  class DefaultCanvasSymbolRender extends BaseRender {
23882
24126
  constructor(graphicRenderContributions) {
23883
24127
  super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = SYMBOL_NUMBER_TYPE, this.builtinContributions = [defaultSymbolRenderContribution, defaultSymbolBackgroundRenderContribution, defaultSymbolTextureRenderContribution, defaultSymbolClipRangeStrokeRenderContribution], this.init(graphicRenderContributions);
@@ -24242,18 +24486,49 @@
24242
24486
  }
24243
24487
  }
24244
24488
 
24245
- const repeatStr = ["", "repeat-x", "repeat-y", "repeat"];
24246
- function resolveImageRepeatMode(repeatX, repeatY) {
24247
- let repeat = 0;
24248
- return "repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat ? repeatStr[repeat] : "no-repeat";
24249
- }
24250
- function resolveImageMode({
24251
- repeatX = "no-repeat",
24252
- repeatY = "no-repeat",
24253
- imageMode: imageMode
24254
- }) {
24255
- const repeatMode = resolveImageRepeatMode(repeatX, repeatY);
24256
- return {
24489
+ class DefaultCanvasPyramid3dRender extends Base3dRender {
24490
+ constructor() {
24491
+ super(...arguments), this.type = "pyramid3d", this.numberType = PYRAMID3D_NUMBER_TYPE;
24492
+ }
24493
+ drawShape(pyramid3d, context, x, y, drawContext, params, fillCb, strokeCb) {
24494
+ var _a;
24495
+ const pyramidAttribute = getTheme$1(pyramid3d, null == params ? void 0 : params.theme).polygon,
24496
+ {
24497
+ fill = pyramidAttribute.fill,
24498
+ stroke = pyramidAttribute.stroke,
24499
+ face = [!0, !0, !0, !0, !0, !0]
24500
+ } = pyramid3d.attribute,
24501
+ z = null !== (_a = this.z) && void 0 !== _a ? _a : 0;
24502
+ if (!this.valid(pyramid3d, pyramidAttribute, fillCb, strokeCb)) return;
24503
+ const {
24504
+ light: light
24505
+ } = drawContext.stage || {},
24506
+ face3d = pyramid3d.findFace();
24507
+ if (!1 !== fill) {
24508
+ context.setCommonStyle(pyramid3d, pyramid3d.attribute, x, y, pyramidAttribute);
24509
+ let fc = fill;
24510
+ "string" != typeof fc && (fc = "black"), this.fill(x, y, z, face3d, face, fc, context, light, pyramid3d, pyramidAttribute, fillCb);
24511
+ }
24512
+ !1 !== stroke && (context.setStrokeStyle(pyramid3d, pyramid3d.attribute, x, y, pyramidAttribute), this.stroke(x, y, z, face3d, context));
24513
+ }
24514
+ draw(pyramid3d, renderService, drawContext) {
24515
+ const pyramid3dAttribute = getTheme$1(pyramid3d).polygon;
24516
+ this._draw(pyramid3d, pyramid3dAttribute, !1, drawContext);
24517
+ }
24518
+ }
24519
+
24520
+ const repeatStr = ["", "repeat-x", "repeat-y", "repeat"];
24521
+ function resolveImageRepeatMode(repeatX, repeatY) {
24522
+ let repeat = 0;
24523
+ return "repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat ? repeatStr[repeat] : "no-repeat";
24524
+ }
24525
+ function resolveImageMode({
24526
+ repeatX = "no-repeat",
24527
+ repeatY = "no-repeat",
24528
+ imageMode: imageMode
24529
+ }) {
24530
+ const repeatMode = resolveImageRepeatMode(repeatX, repeatY);
24531
+ return {
24257
24532
  repeatMode: repeatMode,
24258
24533
  sizingMode: "no-repeat" === repeatMode && null != imageMode ? imageMode : "fill"
24259
24534
  };
@@ -26923,365 +27198,32 @@
26923
27198
  }) {
26924
27199
  isBindingContextLoaded(loadedPathModuleContexts, bind) || (bind(DefaultCanvasPathRender).toDynamicValue(({
26925
27200
  container: container
26926
- }) => new DefaultCanvasPathRender(createContributionProvider$1(PathRenderContribution, container))).inSingletonScope(), bind(PathRender).toService(DefaultCanvasPathRender), bind(GraphicRender).toService(PathRender), bind(PathRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, PathRenderContribution));
26927
- }
26928
- const pathModule = bindPathRenderModule;
26929
-
26930
- const loadedPolygonModuleContexts = new WeakSet();
26931
- function bindPolygonRenderModule({
26932
- bind: bind
26933
- }) {
26934
- isBindingContextLoaded(loadedPolygonModuleContexts, bind) || (bind(PolygonRender).toDynamicValue(({
26935
- container: container
26936
- }) => new DefaultCanvasPolygonRender(createContributionProvider$1(PolygonRenderContribution, container))).inSingletonScope(), bind(GraphicRender).toService(PolygonRender), bind(PolygonRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, PolygonRenderContribution));
26937
- }
26938
- const polygonModule = bindPolygonRenderModule;
26939
-
26940
- class DefaultCanvasStarRender extends BaseRender {
26941
- constructor(graphicRenderContributions) {
26942
- super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = STAR_NUMBER_TYPE, this.builtinContributions = [defaultStarBackgroundRenderContribution, defaultStarTextureRenderContribution], this.init(graphicRenderContributions);
26943
- }
26944
- drawShape(star, context, x, y, drawContext, params, fillCb, strokeCb) {
26945
- const starAttribute = getTheme$1(star, null == params ? void 0 : params.theme).star,
26946
- {
26947
- x: originX = starAttribute.x,
26948
- y: originY = starAttribute.y,
26949
- fillStrokeOrder = starAttribute.fillStrokeOrder
26950
- } = star.attribute,
26951
- data = this.valid(star, starAttribute, fillCb, strokeCb);
26952
- if (!data) return;
26953
- const {
26954
- fVisible: fVisible,
26955
- sVisible: sVisible,
26956
- doFill: doFill,
26957
- doStroke: doStroke
26958
- } = data,
26959
- points = star.getCachedPoints();
26960
- context.beginPath(), points && points.length && points.forEach((point, index) => {
26961
- 0 === index ? context.moveTo(x + point.x, y + point.y) : context.lineTo(x + point.x, y + point.y);
26962
- }), context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(star, star.attribute, starAttribute), this.beforeRenderStep(star, context, x, y, doFill, doStroke, fVisible, sVisible, starAttribute, drawContext, fillCb, strokeCb);
26963
- const _runFill = () => {
26964
- doFill && (fillCb ? fillCb(context, star.attribute, starAttribute) : fVisible && (context.setCommonStyle(star, star.attribute, originX - x, originY - y, starAttribute), context.fill()));
26965
- },
26966
- _runStroke = () => {
26967
- doStroke && (strokeCb ? strokeCb(context, star.attribute, starAttribute) : sVisible && (context.setStrokeStyle(star, star.attribute, originX - x, originY - y, starAttribute), context.stroke()));
26968
- };
26969
- fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(star, context, x, y, doFill, doStroke, fVisible, sVisible, starAttribute, drawContext, fillCb, strokeCb);
26970
- }
26971
- draw(star, renderService, drawContext, params) {
26972
- const starAttribute = getTheme$1(star, null == params ? void 0 : params.theme).star;
26973
- this._draw(star, starAttribute, !1, drawContext, params);
26974
- }
26975
- }
26976
-
26977
- const loadedStarModuleContexts = new WeakSet();
26978
- function bindStarRenderModule({
26979
- bind: bind
26980
- }) {
26981
- isBindingContextLoaded(loadedStarModuleContexts, bind) || (bind(DefaultCanvasStarRender).toDynamicValue(({
26982
- container: container
26983
- }) => new DefaultCanvasStarRender(createContributionProvider$1(StarRenderContribution, container))).inSingletonScope(), bind(StarRender).toService(DefaultCanvasStarRender), bind(GraphicRender).toService(StarRender), bindContributionProvider(bind, StarRenderContribution));
26984
- }
26985
- const starModule = bindStarRenderModule;
26986
-
26987
- class DefaultCanvasGlyphRender {
26988
- constructor() {
26989
- this.numberType = GLYPH_NUMBER_TYPE;
26990
- }
26991
- reInit() {}
26992
- drawShape(glyph, context, x, y, drawContext, params, fillCb, strokeCb) {
26993
- drawContext.drawContribution && glyph.getSubGraphic().forEach(item => {
26994
- const renderer = drawContext.drawContribution.getRenderContribution(item);
26995
- renderer && renderer.drawShape && renderer.drawShape(item, context, x, y, drawContext, params, fillCb, strokeCb);
26996
- });
26997
- }
26998
- draw(glyph, renderService, drawContext, params) {
26999
- const {
27000
- context: context
27001
- } = drawContext;
27002
- if (!context) return;
27003
- if (context.highPerformanceSave(), !drawContext.drawContribution) return;
27004
- const glyphTheme = getTheme$1(glyph),
27005
- subGraphic = glyph.getSubGraphic();
27006
- subGraphic.length && subGraphic.forEach(g => {
27007
- drawContext.drawContribution.renderItem(g, drawContext, {
27008
- theme: glyphTheme
27009
- });
27010
- }), context.highPerformanceRestore();
27011
- }
27012
- }
27013
-
27014
- const loadedGlyphModuleContexts = new WeakSet();
27015
- function bindGlyphRenderModule({
27016
- bind: bind
27017
- }) {
27018
- isBindingContextLoaded(loadedGlyphModuleContexts, bind) || (bind(DefaultCanvasGlyphRender).toDynamicValue(() => new DefaultCanvasGlyphRender()).inSingletonScope(), bind(GlyphRender).toService(DefaultCanvasGlyphRender), bind(GraphicRender).toService(GlyphRender));
27019
- }
27020
- const glyphModule = bindGlyphRenderModule;
27021
-
27022
- class DefaultCanvasRichTextRender extends BaseRender {
27023
- constructor() {
27024
- super(), this.numberType = RICHTEXT_NUMBER_TYPE, this.builtinContributions = [defaultTextBackgroundRenderContribution], this.init();
27025
- }
27026
- drawShape(richtext, context, x, y, drawContext) {
27027
- const richtextAttribute = getTheme$1(richtext).richtext,
27028
- {
27029
- strokeOpacity = richtextAttribute.strokeOpacity,
27030
- opacity = richtextAttribute.opacity,
27031
- fillOpacity = richtextAttribute.fillOpacity,
27032
- visible = richtextAttribute.visible
27033
- } = richtext.attribute;
27034
- if (!richtext.valid || !visible) return;
27035
- const fVisible = fillVisible(opacity, fillOpacity, !0),
27036
- sVisible = fillVisible(opacity, strokeOpacity, !0);
27037
- if (!fVisible) return;
27038
- context.setShadowBlendStyle && context.setShadowBlendStyle(richtext, richtext.attribute, richtextAttribute), context.translate(x, y), this.beforeRenderStep(richtext, context, x, y, fVisible, sVisible, fVisible, sVisible, richtextAttribute, drawContext);
27039
- richtext.getFrameCache().draw(context, this.drawIcon), this.afterRenderStep(richtext, context, x, y, fVisible, sVisible, fVisible, sVisible, richtextAttribute, drawContext);
27040
- }
27041
- drawIcon(icon, context, x, y, baseline) {
27042
- var _a;
27043
- const richtextIconAttribute = getTheme$1(icon).richtextIcon,
27044
- {
27045
- width = richtextIconAttribute.width,
27046
- height = richtextIconAttribute.height,
27047
- opacity = richtextIconAttribute.opacity,
27048
- image: url,
27049
- backgroundFill = richtextIconAttribute.backgroundFill,
27050
- backgroundFillOpacity = richtextIconAttribute.backgroundFillOpacity,
27051
- backgroundStroke = richtextIconAttribute.backgroundStroke,
27052
- backgroundStrokeOpacity = richtextIconAttribute.backgroundStrokeOpacity,
27053
- backgroundRadius = richtextIconAttribute.backgroundRadius,
27054
- margin: margin
27055
- } = icon.attribute,
27056
- {
27057
- backgroundWidth = width,
27058
- backgroundHeight = height
27059
- } = icon.attribute;
27060
- if (margin && (x += icon._marginArray[3], y += icon._marginArray[0]), icon._hovered) {
27061
- const expandX = (backgroundWidth - width) / 2,
27062
- expandY = (backgroundHeight - height) / 2;
27063
- 0 === backgroundRadius ? (context.beginPath(), context.rect(x - expandX, y - expandY, backgroundWidth, backgroundHeight)) : (context.beginPath(), createRectPath(context, x - expandX, y - expandY, backgroundWidth, backgroundHeight, backgroundRadius, !0)), backgroundFill && (context.globalAlpha = backgroundFillOpacity, context.fillStyle = backgroundFill, context.fill()), backgroundStroke && (context.globalAlpha = backgroundStrokeOpacity, context.strokeStyle = backgroundStroke, context.stroke());
27064
- }
27065
- const res = url && (null === (_a = null == icon ? void 0 : icon.resources) || void 0 === _a ? void 0 : _a.get(url));
27066
- res && "success" === res.state && (context.globalAlpha = opacity, context.drawImage(res.data, x, y, width, height));
27067
- }
27068
- draw(richtext, renderService, drawContext) {
27069
- const richtextAttribute = getTheme$1(richtext).richtext;
27070
- this._draw(richtext, richtextAttribute, !1, drawContext);
27071
- }
27072
- }
27073
-
27074
- const loadedRichtextModuleContexts = new WeakSet();
27075
- function bindRichtextRenderModule({
27076
- bind: bind
27077
- }) {
27078
- isBindingContextLoaded(loadedRichtextModuleContexts, bind) || (bind(DefaultCanvasRichTextRender).toDynamicValue(() => new DefaultCanvasRichTextRender()).inSingletonScope(), bind(RichTextRender).toService(DefaultCanvasRichTextRender), bind(GraphicRender).toService(RichTextRender));
27079
- }
27080
- const richtextModule = bindRichtextRenderModule;
27081
-
27082
- const loadedImageModuleContexts = new WeakSet();
27083
- function bindImageRenderModule({
27084
- bind: bind
27085
- }) {
27086
- isBindingContextLoaded(loadedImageModuleContexts, bind) || (bind(ImageRender).toDynamicValue(({
27087
- container: container
27088
- }) => new DefaultCanvasImageRender(createContributionProvider$1(ImageRenderContribution, container))).inSingletonScope(), bind(GraphicRender).toService(ImageRender), bind(ImageRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, ImageRenderContribution));
27089
- }
27090
- const imageModule = bindImageRenderModule;
27091
-
27092
- class Base3dRender extends BaseRender {
27093
- stroke(x, y, z, face3d, context) {
27094
- const vertices = face3d.vertices;
27095
- face3d.edges.forEach(edge => {
27096
- const p1 = vertices[edge[0]],
27097
- v1 = {
27098
- x: x + p1[0],
27099
- y: y + p1[1],
27100
- z: z + p1[2]
27101
- },
27102
- p2 = vertices[edge[1]],
27103
- v2 = {
27104
- x: x + p2[0],
27105
- y: y + p2[1],
27106
- z: z + p2[2]
27107
- };
27108
- context.beginPath(), context.moveTo(v1.x, v1.y, v1.z), context.lineTo(v2.x, v2.y, v2.z), context.stroke();
27109
- });
27110
- }
27111
- fill(x, y, z, face3d, faces, fillColor, context, light, graphic3d, graphic3dAttribute, fillCb) {
27112
- const rgbArray = ColorStore.Get(fillColor, ColorType.Color255),
27113
- vertices = face3d.vertices,
27114
- viewdVerticesZ = vertices.map(v => context.view(v[0], v[1], v[2])[2]),
27115
- sortFace = [];
27116
- face3d.polygons.forEach((p, i) => {
27117
- if (faces && !faces[i]) return;
27118
- sortFace.push({
27119
- faceIdx: i,
27120
- polygon: p
27121
- });
27122
- const {
27123
- polygon: polygon
27124
- } = p,
27125
- z1 = viewdVerticesZ[polygon[0]],
27126
- z2 = viewdVerticesZ[polygon[1]],
27127
- z3 = viewdVerticesZ[polygon[2]],
27128
- z4 = viewdVerticesZ[polygon[3]];
27129
- p.ave_z = z1 + z2 + z3 + z4;
27130
- }), sortFace.sort((a, b) => b.polygon.ave_z - a.polygon.ave_z), sortFace.forEach(item => {
27131
- const {
27132
- polygon: polygon,
27133
- normal: normal
27134
- } = item.polygon,
27135
- p1 = vertices[polygon[0]],
27136
- p2 = vertices[polygon[1]],
27137
- p3 = vertices[polygon[2]],
27138
- p4 = vertices[polygon[3]],
27139
- v1 = {
27140
- x: x + p1[0],
27141
- y: y + p1[1],
27142
- z: z + p1[2]
27143
- },
27144
- v2 = {
27145
- x: x + p2[0],
27146
- y: y + p2[1],
27147
- z: z + p2[2]
27148
- },
27149
- v3 = {
27150
- x: x + p3[0],
27151
- y: y + p3[1],
27152
- z: z + p3[2]
27153
- },
27154
- v4 = {
27155
- x: x + p4[0],
27156
- y: y + p4[1],
27157
- z: z + p4[2]
27158
- };
27159
- context.beginPath(), context.moveTo(v1.x, v1.y, v1.z), context.lineTo(v2.x, v2.y, v2.z), context.lineTo(v3.x, v3.y, v3.z), context.lineTo(v4.x, v4.y, v4.z), context.closePath(), fillCb ? fillCb(context, graphic3d && graphic3d.attribute, graphic3dAttribute) : (context.fillStyle = light ? light.computeColor(normal, rgbArray) : fillColor, context.fill());
27160
- });
27161
- }
27162
- }
27163
-
27164
- class DefaultCanvasRect3dRender extends Base3dRender {
27165
- constructor() {
27166
- super(...arguments), this.type = "rect3d", this.numberType = RECT3D_NUMBER_TYPE;
27167
- }
27168
- drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
27169
- var _a, _b;
27170
- const rectAttribute = getTheme$1(rect, null == params ? void 0 : params.theme).rect,
27171
- {
27172
- fill = rectAttribute.fill,
27173
- stroke = rectAttribute.stroke,
27174
- x1: x1,
27175
- y1: y1,
27176
- x: originX,
27177
- y: originY,
27178
- opacity = rectAttribute.opacity,
27179
- fillOpacity = rectAttribute.fillOpacity,
27180
- lineWidth = rectAttribute.lineWidth,
27181
- strokeOpacity = rectAttribute.strokeOpacity,
27182
- visible = rectAttribute.visible,
27183
- drawStrokeWhenZeroWH = null !== (_a = rectAttribute.drawStrokeWhenZeroWH) && void 0 !== _a && _a
27184
- } = rect.attribute;
27185
- let {
27186
- width: width,
27187
- height: height
27188
- } = rect.attribute;
27189
- width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0;
27190
- const z = null !== (_b = this.z) && void 0 !== _b ? _b : 0,
27191
- fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
27192
- sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH),
27193
- doFill = runFill(fill),
27194
- doStroke = runStroke(stroke, lineWidth);
27195
- if (!rect.valid || !visible) return;
27196
- if (!doFill && !doStroke) return;
27197
- if (!(fVisible || sVisible || fillCb || strokeCb)) return;
27198
- const {
27199
- light: light
27200
- } = drawContext.stage || {},
27201
- face3d = rect.findFace();
27202
- if (!1 !== fill) {
27203
- context.setCommonStyle(rect, rect.attribute, x, y, rectAttribute);
27204
- let fc = fill;
27205
- "string" != typeof fc && (fc = "black"), this.fill(x, y, z, face3d, null, fc, context, light, null, null, fillCb);
27206
- }
27207
- !1 !== stroke && (context.setStrokeStyle(rect, rect.attribute, x, y, rectAttribute), this.stroke(x, y, z, face3d, context));
27208
- }
27209
- draw(rect, renderService, drawContext) {
27210
- const rectAttribute = getTheme$1(rect).rect;
27211
- this._draw(rect, rectAttribute, !1, drawContext);
27212
- }
27213
- }
27214
-
27215
- const loadedRect3dModuleContexts = new WeakSet();
27216
- function bindRect3dRenderModule({
27217
- bind: bind
27218
- }) {
27219
- isBindingContextLoaded(loadedRect3dModuleContexts, bind) || (bind(DefaultCanvasRect3dRender).toDynamicValue(() => new DefaultCanvasRect3dRender()).inSingletonScope(), bind(Rect3DRender).toService(DefaultCanvasRect3dRender), bind(GraphicRender).toService(Rect3DRender));
27220
- }
27221
- const rect3dModule = bindRect3dRenderModule;
27222
-
27223
- function drawArcPath(arc, context, cx, cy, z, outerRadius, innerRadius) {
27224
- const {
27225
- startAngle: startAngle,
27226
- endAngle: endAngle
27227
- } = arc.getParsedAngle(),
27228
- deltaAngle = abs$1(endAngle - startAngle),
27229
- clockwise = endAngle > startAngle;
27230
- let collapsedToLine = !1;
27231
- if (outerRadius < innerRadius) {
27232
- const temp = outerRadius;
27233
- outerRadius = innerRadius, innerRadius = temp;
27234
- }
27235
- if (outerRadius <= epsilon$1) context.moveTo(cx, cy, z);else if (deltaAngle >= pi2 - epsilon$1) context.moveTo(cx + outerRadius * cos$1(startAngle), cy + outerRadius * sin$1(startAngle), z), context.arc(cx, cy, outerRadius, startAngle, endAngle, !clockwise, z), innerRadius > epsilon$1 && (context.moveTo(cx + innerRadius * cos$1(endAngle), cy + innerRadius * sin$1(endAngle), z), context.arc(cx, cy, innerRadius, endAngle, startAngle, clockwise, z));else {
27236
- const {
27237
- outerDeltaAngle: outerDeltaAngle,
27238
- innerDeltaAngle: innerDeltaAngle,
27239
- outerStartAngle: outerStartAngle,
27240
- outerEndAngle: outerEndAngle,
27241
- innerEndAngle: innerEndAngle,
27242
- innerStartAngle: innerStartAngle
27243
- } = arc.getParsePadAngle(startAngle, endAngle),
27244
- xors = outerRadius * cos$1(outerStartAngle),
27245
- yors = outerRadius * sin$1(outerStartAngle),
27246
- xire = innerRadius * cos$1(innerEndAngle),
27247
- yire = innerRadius * sin$1(innerEndAngle);
27248
- outerDeltaAngle < .001 ? collapsedToLine = !0 : (context.moveTo(cx + xors, cy + yors, z), context.arc(cx, cy, outerRadius, outerStartAngle, outerEndAngle, !clockwise, z)), !(innerRadius > epsilon$1) || innerDeltaAngle < .001 ? (context.lineTo(cx + xire, cy + yire, z), collapsedToLine = !0) : (context.lineTo(cx + xire, cy + yire, z), context.arc(cx, cy, innerRadius, innerEndAngle, innerStartAngle, clockwise, z));
27249
- }
27250
- return context.closePath(), collapsedToLine;
27201
+ }) => new DefaultCanvasPathRender(createContributionProvider$1(PathRenderContribution, container))).inSingletonScope(), bind(PathRender).toService(DefaultCanvasPathRender), bind(GraphicRender).toService(PathRender), bind(PathRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, PathRenderContribution));
27251
27202
  }
27252
- function drawInnerOuterArcPath(arc, context, cx, cy, z1, z2, radius, getParsePadAngle) {
27253
- const {
27254
- startAngle: startAngle,
27255
- endAngle: endAngle
27256
- } = arc.getParsedAngle(),
27257
- deltaAngle = abs$1(endAngle - startAngle),
27258
- clockwise = endAngle > startAngle;
27259
- let collapsedToLine = !1;
27260
- if (radius <= epsilon$1) context.moveTo(cx, cy, z1);else if (deltaAngle >= pi2 - epsilon$1) context.moveTo(cx + radius * cos$1(startAngle), cy + radius * sin$1(startAngle), z1), context.arc(cx, cy, radius, startAngle, endAngle, !clockwise, z1), context.lineTo(cx + radius * cos$1(endAngle), cy + radius * sin$1(endAngle), z2), context.arc(cx, cy, radius, endAngle, startAngle, clockwise, z2);else {
27261
- const {
27262
- innerouterDeltaAngle: innerouterDeltaAngle,
27263
- innerouterStartAngle: innerouterStartAngle,
27264
- innerouterEndAngle: innerouterEndAngle
27265
- } = getParsePadAngle(startAngle, endAngle),
27266
- xors = radius * cos$1(innerouterStartAngle),
27267
- yors = radius * sin$1(innerouterStartAngle),
27268
- xore = radius * cos$1(innerouterEndAngle),
27269
- yore = radius * sin$1(innerouterEndAngle);
27270
- innerouterDeltaAngle < .001 ? collapsedToLine = !0 : (context.moveTo(cx + xors, cy + yors, z1), context.arc(cx, cy, radius, innerouterStartAngle, innerouterEndAngle, !clockwise, z1), context.lineTo(cx + xore, cy + yore, z2), context.arc(cx, cy, radius, innerouterEndAngle, innerouterStartAngle, clockwise, z2));
27271
- }
27272
- return context.closePath(), collapsedToLine;
27203
+ const pathModule = bindPathRenderModule;
27204
+
27205
+ const loadedPolygonModuleContexts = new WeakSet();
27206
+ function bindPolygonRenderModule({
27207
+ bind: bind
27208
+ }) {
27209
+ isBindingContextLoaded(loadedPolygonModuleContexts, bind) || (bind(PolygonRender).toDynamicValue(({
27210
+ container: container
27211
+ }) => new DefaultCanvasPolygonRender(createContributionProvider$1(PolygonRenderContribution, container))).inSingletonScope(), bind(GraphicRender).toService(PolygonRender), bind(PolygonRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, PolygonRenderContribution));
27273
27212
  }
27274
- class DefaultCanvasArc3DRender extends BaseRender {
27275
- constructor() {
27276
- super(...arguments), this.numberType = ARC3D_NUMBER_TYPE;
27213
+ const polygonModule = bindPolygonRenderModule;
27214
+
27215
+ class DefaultCanvasStarRender extends BaseRender {
27216
+ constructor(graphicRenderContributions) {
27217
+ super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = STAR_NUMBER_TYPE, this.builtinContributions = [defaultStarBackgroundRenderContribution, defaultStarTextureRenderContribution], this.init(graphicRenderContributions);
27277
27218
  }
27278
- drawShape(arc, context, x, y, drawContext, params, fillCb, strokeCb) {
27279
- var _a;
27280
- const arcAttribute = getTheme$1(arc, null == params ? void 0 : params.theme).arc,
27219
+ drawShape(star, context, x, y, drawContext, params, fillCb, strokeCb) {
27220
+ const starAttribute = getTheme$1(star, null == params ? void 0 : params.theme).star,
27281
27221
  {
27282
- fill = arcAttribute.fill
27283
- } = arc.attribute,
27284
- data = this.valid(arc, arcAttribute, fillCb, strokeCb);
27222
+ x: originX = starAttribute.x,
27223
+ y: originY = starAttribute.y,
27224
+ fillStrokeOrder = starAttribute.fillStrokeOrder
27225
+ } = star.attribute,
27226
+ data = this.valid(star, starAttribute, fillCb, strokeCb);
27285
27227
  if (!data) return;
27286
27228
  const {
27287
27229
  fVisible: fVisible,
@@ -27289,97 +27231,155 @@
27289
27231
  doFill: doFill,
27290
27232
  doStroke: doStroke
27291
27233
  } = data,
27292
- z = null !== (_a = this.z) && void 0 !== _a ? _a : 0,
27293
- {
27294
- outerPadding = arcAttribute.outerPadding,
27295
- innerPadding = arcAttribute.innerPadding,
27296
- height = 10
27297
- } = arc.attribute;
27298
- let {
27299
- outerRadius = arcAttribute.outerRadius,
27300
- innerRadius = arcAttribute.innerRadius
27301
- } = arc.attribute;
27302
- outerRadius += outerPadding, innerRadius -= innerPadding;
27303
- const rgbArray = ColorStore.Get(fill, ColorType.Color255),
27304
- {
27305
- light: light
27306
- } = drawContext.stage || {},
27307
- face = drawContext.hack_pieFace,
27308
- z_face = {
27309
- top: z,
27310
- bottom: z + height
27234
+ points = star.getCachedPoints();
27235
+ context.beginPath(), points && points.length && points.forEach((point, index) => {
27236
+ 0 === index ? context.moveTo(x + point.x, y + point.y) : context.lineTo(x + point.x, y + point.y);
27237
+ }), context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(star, star.attribute, starAttribute), this.beforeRenderStep(star, context, x, y, doFill, doStroke, fVisible, sVisible, starAttribute, drawContext, fillCb, strokeCb);
27238
+ const _runFill = () => {
27239
+ doFill && (fillCb ? fillCb(context, star.attribute, starAttribute) : fVisible && (context.setCommonStyle(star, star.attribute, originX - x, originY - y, starAttribute), context.fill()));
27311
27240
  },
27312
- n_face = {
27313
- top: [0, 1, 0],
27314
- bottom: [0, -1, 0],
27315
- outside: [1, 0, -1],
27316
- inside: [1, 0, -1]
27317
- };
27318
- "bottom" === face || "top" === face ? (context.beginPath(), drawArcPath(arc, context, x, y, z_face[face], outerRadius, innerRadius), context.setShadowBlendStyle && context.setShadowBlendStyle(arc, arc.attribute, arcAttribute), doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute), context.fillStyle = light ? light.computeColor(n_face[face], rgbArray) : fill, context.fill())), doStroke && (strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke()))) : "outside" !== face && "inside" !== face || ("inside" === face && (context.save(), context.beginPath(), context.arc(x, y, innerRadius, 0, pi2, !0, z_face.top), context.clip()), context.beginPath(), drawInnerOuterArcPath(arc, context, x, y, z_face.top, z_face.bottom, "outside" === face ? outerRadius : innerRadius, (startAngle, endAngle) => {
27319
- const {
27320
- outerDeltaAngle: outerDeltaAngle,
27321
- innerDeltaAngle: innerDeltaAngle,
27322
- outerStartAngle: outerStartAngle,
27323
- outerEndAngle: outerEndAngle,
27324
- innerEndAngle: innerEndAngle,
27325
- innerStartAngle: innerStartAngle
27326
- } = arc.getParsePadAngle(startAngle, endAngle);
27327
- return "outside" === face ? {
27328
- innerouterDeltaAngle: outerDeltaAngle,
27329
- innerouterEndAngle: outerEndAngle,
27330
- innerouterStartAngle: outerStartAngle
27331
- } : {
27332
- innerouterDeltaAngle: innerDeltaAngle,
27333
- innerouterEndAngle: innerEndAngle,
27334
- innerouterStartAngle: innerStartAngle
27241
+ _runStroke = () => {
27242
+ doStroke && (strokeCb ? strokeCb(context, star.attribute, starAttribute) : sVisible && (context.setStrokeStyle(star, star.attribute, originX - x, originY - y, starAttribute), context.stroke()));
27335
27243
  };
27336
- }), context.setShadowBlendStyle && context.setShadowBlendStyle(arc, arc.attribute, arcAttribute), doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute), context.fillStyle = light ? light.computeColor(n_face[face], rgbArray) : fill, context.fill())), doStroke && (strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke())), "inside" === face && context.restore());
27244
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(star, context, x, y, doFill, doStroke, fVisible, sVisible, starAttribute, drawContext, fillCb, strokeCb);
27337
27245
  }
27338
- draw(arc, renderService, drawContext, params) {
27339
- const arcAttribute = getTheme$1(arc, null == params ? void 0 : params.theme).arc;
27340
- this._draw(arc, arcAttribute, !1, drawContext, params);
27246
+ draw(star, renderService, drawContext, params) {
27247
+ const starAttribute = getTheme$1(star, null == params ? void 0 : params.theme).star;
27248
+ this._draw(star, starAttribute, !1, drawContext, params);
27341
27249
  }
27342
27250
  }
27343
27251
 
27344
- const loadedArc3dModuleContexts = new WeakSet();
27345
- function bindArc3dRenderModule({
27252
+ const loadedStarModuleContexts = new WeakSet();
27253
+ function bindStarRenderModule({
27346
27254
  bind: bind
27347
27255
  }) {
27348
- isBindingContextLoaded(loadedArc3dModuleContexts, bind) || (bind(DefaultCanvasArc3DRender).toDynamicValue(() => new DefaultCanvasArc3DRender()).inSingletonScope(), bind(Arc3dRender).toService(DefaultCanvasArc3DRender), bind(GraphicRender).toService(Arc3dRender));
27256
+ isBindingContextLoaded(loadedStarModuleContexts, bind) || (bind(DefaultCanvasStarRender).toDynamicValue(({
27257
+ container: container
27258
+ }) => new DefaultCanvasStarRender(createContributionProvider$1(StarRenderContribution, container))).inSingletonScope(), bind(StarRender).toService(DefaultCanvasStarRender), bind(GraphicRender).toService(StarRender), bindContributionProvider(bind, StarRenderContribution));
27349
27259
  }
27350
- const arc3dModule = bindArc3dRenderModule;
27260
+ const starModule = bindStarRenderModule;
27351
27261
 
27352
- class DefaultCanvasPyramid3dRender extends Base3dRender {
27262
+ class DefaultCanvasGlyphRender {
27353
27263
  constructor() {
27354
- super(...arguments), this.type = "pyramid3d", this.numberType = PYRAMID3D_NUMBER_TYPE;
27264
+ this.numberType = GLYPH_NUMBER_TYPE;
27355
27265
  }
27356
- drawShape(pyramid3d, context, x, y, drawContext, params, fillCb, strokeCb) {
27266
+ reInit() {}
27267
+ drawShape(glyph, context, x, y, drawContext, params, fillCb, strokeCb) {
27268
+ drawContext.drawContribution && glyph.getSubGraphic().forEach(item => {
27269
+ const renderer = drawContext.drawContribution.getRenderContribution(item);
27270
+ renderer && renderer.drawShape && renderer.drawShape(item, context, x, y, drawContext, params, fillCb, strokeCb);
27271
+ });
27272
+ }
27273
+ draw(glyph, renderService, drawContext, params) {
27274
+ const {
27275
+ context: context
27276
+ } = drawContext;
27277
+ if (!context) return;
27278
+ if (context.highPerformanceSave(), !drawContext.drawContribution) return;
27279
+ const glyphTheme = getTheme$1(glyph),
27280
+ subGraphic = glyph.getSubGraphic();
27281
+ subGraphic.length && subGraphic.forEach(g => {
27282
+ drawContext.drawContribution.renderItem(g, drawContext, {
27283
+ theme: glyphTheme
27284
+ });
27285
+ }), context.highPerformanceRestore();
27286
+ }
27287
+ }
27288
+
27289
+ const loadedGlyphModuleContexts = new WeakSet();
27290
+ function bindGlyphRenderModule({
27291
+ bind: bind
27292
+ }) {
27293
+ isBindingContextLoaded(loadedGlyphModuleContexts, bind) || (bind(DefaultCanvasGlyphRender).toDynamicValue(() => new DefaultCanvasGlyphRender()).inSingletonScope(), bind(GlyphRender).toService(DefaultCanvasGlyphRender), bind(GraphicRender).toService(GlyphRender));
27294
+ }
27295
+ const glyphModule = bindGlyphRenderModule;
27296
+
27297
+ class DefaultCanvasRichTextRender extends BaseRender {
27298
+ constructor() {
27299
+ super(), this.numberType = RICHTEXT_NUMBER_TYPE, this.builtinContributions = [defaultTextBackgroundRenderContribution], this.init();
27300
+ }
27301
+ drawShape(richtext, context, x, y, drawContext) {
27302
+ const richtextAttribute = getTheme$1(richtext).richtext,
27303
+ {
27304
+ strokeOpacity = richtextAttribute.strokeOpacity,
27305
+ opacity = richtextAttribute.opacity,
27306
+ fillOpacity = richtextAttribute.fillOpacity,
27307
+ visible = richtextAttribute.visible
27308
+ } = richtext.attribute;
27309
+ if (!richtext.valid || !visible) return;
27310
+ const fVisible = fillVisible(opacity, fillOpacity, !0),
27311
+ sVisible = fillVisible(opacity, strokeOpacity, !0);
27312
+ if (!fVisible) return;
27313
+ context.setShadowBlendStyle && context.setShadowBlendStyle(richtext, richtext.attribute, richtextAttribute), context.translate(x, y), this.beforeRenderStep(richtext, context, x, y, fVisible, sVisible, fVisible, sVisible, richtextAttribute, drawContext);
27314
+ richtext.getFrameCache().draw(context, this.drawIcon), this.afterRenderStep(richtext, context, x, y, fVisible, sVisible, fVisible, sVisible, richtextAttribute, drawContext);
27315
+ }
27316
+ drawIcon(icon, context, x, y, baseline) {
27357
27317
  var _a;
27358
- const pyramidAttribute = getTheme$1(pyramid3d, null == params ? void 0 : params.theme).polygon,
27318
+ const richtextIconAttribute = getTheme$1(icon).richtextIcon,
27359
27319
  {
27360
- fill = pyramidAttribute.fill,
27361
- stroke = pyramidAttribute.stroke,
27362
- face = [!0, !0, !0, !0, !0, !0]
27363
- } = pyramid3d.attribute,
27364
- z = null !== (_a = this.z) && void 0 !== _a ? _a : 0;
27365
- if (!this.valid(pyramid3d, pyramidAttribute, fillCb, strokeCb)) return;
27366
- const {
27367
- light: light
27368
- } = drawContext.stage || {},
27369
- face3d = pyramid3d.findFace();
27370
- if (!1 !== fill) {
27371
- context.setCommonStyle(pyramid3d, pyramid3d.attribute, x, y, pyramidAttribute);
27372
- let fc = fill;
27373
- "string" != typeof fc && (fc = "black"), this.fill(x, y, z, face3d, face, fc, context, light, pyramid3d, pyramidAttribute, fillCb);
27320
+ width = richtextIconAttribute.width,
27321
+ height = richtextIconAttribute.height,
27322
+ opacity = richtextIconAttribute.opacity,
27323
+ image: url,
27324
+ backgroundFill = richtextIconAttribute.backgroundFill,
27325
+ backgroundFillOpacity = richtextIconAttribute.backgroundFillOpacity,
27326
+ backgroundStroke = richtextIconAttribute.backgroundStroke,
27327
+ backgroundStrokeOpacity = richtextIconAttribute.backgroundStrokeOpacity,
27328
+ backgroundRadius = richtextIconAttribute.backgroundRadius,
27329
+ margin: margin
27330
+ } = icon.attribute,
27331
+ {
27332
+ backgroundWidth = width,
27333
+ backgroundHeight = height
27334
+ } = icon.attribute;
27335
+ if (margin && (x += icon._marginArray[3], y += icon._marginArray[0]), icon._hovered) {
27336
+ const expandX = (backgroundWidth - width) / 2,
27337
+ expandY = (backgroundHeight - height) / 2;
27338
+ 0 === backgroundRadius ? (context.beginPath(), context.rect(x - expandX, y - expandY, backgroundWidth, backgroundHeight)) : (context.beginPath(), createRectPath(context, x - expandX, y - expandY, backgroundWidth, backgroundHeight, backgroundRadius, !0)), backgroundFill && (context.globalAlpha = backgroundFillOpacity, context.fillStyle = backgroundFill, context.fill()), backgroundStroke && (context.globalAlpha = backgroundStrokeOpacity, context.strokeStyle = backgroundStroke, context.stroke());
27374
27339
  }
27375
- !1 !== stroke && (context.setStrokeStyle(pyramid3d, pyramid3d.attribute, x, y, pyramidAttribute), this.stroke(x, y, z, face3d, context));
27340
+ const res = url && (null === (_a = null == icon ? void 0 : icon.resources) || void 0 === _a ? void 0 : _a.get(url));
27341
+ res && "success" === res.state && (context.globalAlpha = opacity, context.drawImage(res.data, x, y, width, height));
27376
27342
  }
27377
- draw(pyramid3d, renderService, drawContext) {
27378
- const pyramid3dAttribute = getTheme$1(pyramid3d).polygon;
27379
- this._draw(pyramid3d, pyramid3dAttribute, !1, drawContext);
27343
+ draw(richtext, renderService, drawContext) {
27344
+ const richtextAttribute = getTheme$1(richtext).richtext;
27345
+ this._draw(richtext, richtextAttribute, !1, drawContext);
27380
27346
  }
27381
27347
  }
27382
27348
 
27349
+ const loadedRichtextModuleContexts = new WeakSet();
27350
+ function bindRichtextRenderModule({
27351
+ bind: bind
27352
+ }) {
27353
+ isBindingContextLoaded(loadedRichtextModuleContexts, bind) || (bind(DefaultCanvasRichTextRender).toDynamicValue(() => new DefaultCanvasRichTextRender()).inSingletonScope(), bind(RichTextRender).toService(DefaultCanvasRichTextRender), bind(GraphicRender).toService(RichTextRender));
27354
+ }
27355
+ const richtextModule = bindRichtextRenderModule;
27356
+
27357
+ const loadedImageModuleContexts = new WeakSet();
27358
+ function bindImageRenderModule({
27359
+ bind: bind
27360
+ }) {
27361
+ isBindingContextLoaded(loadedImageModuleContexts, bind) || (bind(ImageRender).toDynamicValue(({
27362
+ container: container
27363
+ }) => new DefaultCanvasImageRender(createContributionProvider$1(ImageRenderContribution, container))).inSingletonScope(), bind(GraphicRender).toService(ImageRender), bind(ImageRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, ImageRenderContribution));
27364
+ }
27365
+ const imageModule = bindImageRenderModule;
27366
+
27367
+ const loadedRect3dModuleContexts = new WeakSet();
27368
+ function bindRect3dRenderModule({
27369
+ bind: bind
27370
+ }) {
27371
+ isBindingContextLoaded(loadedRect3dModuleContexts, bind) || (bind(DefaultCanvasRect3dRender).toDynamicValue(() => new DefaultCanvasRect3dRender()).inSingletonScope(), bind(Rect3DRender).toService(DefaultCanvasRect3dRender), bind(GraphicRender).toService(Rect3DRender));
27372
+ }
27373
+ const rect3dModule = bindRect3dRenderModule;
27374
+
27375
+ const loadedArc3dModuleContexts = new WeakSet();
27376
+ function bindArc3dRenderModule({
27377
+ bind: bind
27378
+ }) {
27379
+ isBindingContextLoaded(loadedArc3dModuleContexts, bind) || (bind(DefaultCanvasArc3DRender).toDynamicValue(() => new DefaultCanvasArc3DRender()).inSingletonScope(), bind(Arc3dRender).toService(DefaultCanvasArc3DRender), bind(GraphicRender).toService(Arc3dRender));
27380
+ }
27381
+ const arc3dModule = bindArc3dRenderModule;
27382
+
27383
27383
  const loadedPyramid3dModuleContexts = new WeakSet();
27384
27384
  function bindPyramid3dRenderModule({
27385
27385
  bind: bind
@@ -28043,6 +28043,7 @@
28043
28043
  AreaRenderContribution: AreaRenderContribution,
28044
28044
  get AttributeUpdateType () { return AttributeUpdateType; },
28045
28045
  AutoEnablePlugins: AutoEnablePlugins,
28046
+ Base3dRender: Base3dRender,
28046
28047
  BaseCanvas: BaseCanvas,
28047
28048
  BaseEnvContribution: BaseEnvContribution,
28048
28049
  BaseRender: BaseRender,
@@ -28091,6 +28092,7 @@
28091
28092
  DefaultBaseInteractiveRenderContribution: DefaultBaseInteractiveRenderContribution,
28092
28093
  DefaultBaseTextureRenderContribution: DefaultBaseTextureRenderContribution,
28093
28094
  DefaultCanvasAllocate: DefaultCanvasAllocate,
28095
+ DefaultCanvasArc3DRender: DefaultCanvasArc3DRender,
28094
28096
  DefaultCanvasArcRender: DefaultCanvasArcRender,
28095
28097
  DefaultCanvasAreaRender: DefaultCanvasAreaRender,
28096
28098
  DefaultCanvasCircleRender: DefaultCanvasCircleRender,
@@ -28099,6 +28101,8 @@
28099
28101
  DefaultCanvasLineRender: DefaultCanvasLineRender,
28100
28102
  DefaultCanvasPathRender: DefaultCanvasPathRender,
28101
28103
  DefaultCanvasPolygonRender: DefaultCanvasPolygonRender,
28104
+ DefaultCanvasPyramid3dRender: DefaultCanvasPyramid3dRender,
28105
+ DefaultCanvasRect3dRender: DefaultCanvasRect3dRender,
28102
28106
  DefaultCanvasRectRender: DefaultCanvasRectRender,
28103
28107
  DefaultCanvasSymbolRender: DefaultCanvasSymbolRender,
28104
28108
  DefaultCanvasTextRender: DefaultCanvasTextRender,
@@ -47240,12 +47244,6 @@
47240
47244
  _hasDiffAttrs(g) {
47241
47245
  return !!g.context.diffAttrs && Object.keys(g.context.diffAttrs).length > 0;
47242
47246
  }
47243
- _commitPreventedAnimationStaticAttrs(g, attrs) {
47244
- var _a, _b;
47245
- if (!attrs || !Object.keys(attrs).length) return;
47246
- const graphic = g;
47247
- null === (_a = graphic.setFinalAttributes) || void 0 === _a || _a.call(graphic, attrs), graphic._commitAnimationStaticAttributes ? graphic._commitAnimationStaticAttributes(attrs) : null === (_b = graphic.commitInternalBaseAttributes) || void 0 === _b || _b.call(graphic, attrs);
47248
- }
47249
47247
  _runApplyGraphic(graphics) {
47250
47248
  const hasAnimation = this.hasAnimation();
47251
47249
  graphics.forEach((g, index) => {
@@ -47254,7 +47252,7 @@
47254
47252
  hasStateAnimation = this.hasAnimationByState(g.context.animationState);
47255
47253
  if (g.setAttributes) {
47256
47254
  const diffAttrs = this._excludeStateControlledDiffAttrs(g, getDiffAttributesOfGraphic(g, finalAttrs));
47257
- g.context.diffAttrs = diffAttrs, g.context.reusing ? (g.context.lastAttrs = g.attribute, g.initAttributes(finalAttrs), g.context.reusing = !1) : hasStateAnimation || (hasAnimation ? (g.setAttributesAndPreventAnimate(diffAttrs), this._commitPreventedAnimationStaticAttrs(g, diffAttrs)) : g.setAttributes(diffAttrs)), !(null === (_b = this.renderContext) || void 0 === _b ? void 0 : _b.progressive) && this._product && g.parent !== this._product && this._product.appendChild(g);
47255
+ g.context.diffAttrs = diffAttrs, g.context.reusing ? (g.context.lastAttrs = g.attribute, g.initAttributes(finalAttrs), g.context.reusing = !1) : hasStateAnimation || (hasAnimation ? g.setAttributesAndPreventAnimate(diffAttrs) : g.setAttributes(diffAttrs)), !(null === (_b = this.renderContext) || void 0 === _b ? void 0 : _b.progressive) && this._product && g.parent !== this._product && this._product.appendChild(g);
47258
47256
  } else {
47259
47257
  const mockGraphic = g;
47260
47258
  (g = this._createGraphic(finalAttrs)).context = mockGraphic.context, g.context.diffAttrs = finalAttrs, g.stateSort = this._stateSort;
@@ -47557,7 +47555,7 @@
47557
47555
  if (this._product.context.finalAttrs = newAttrs, this._product.context.diffState === DiffState.update) {
47558
47556
  const hasAnimation = this.hasAnimation(),
47559
47557
  diffAttrs = getDiffAttributesOfGraphic(this._product, newAttrs);
47560
- this._product.context.diffAttrs = diffAttrs, this.hasAnimationByState(this._product.context.animationState) || (hasAnimation ? (this._product.setAttributesAndPreventAnimate(diffAttrs), this._commitPreventedAnimationStaticAttrs(this._product, diffAttrs)) : this._product.setAttributes(diffAttrs));
47558
+ this._product.context.diffAttrs = diffAttrs, this.hasAnimationByState(this._product.context.animationState) || (hasAnimation ? this._product.setAttributesAndPreventAnimate(diffAttrs) : this._product.setAttributes(diffAttrs));
47561
47559
  } else this._product.setAttributes(newAttrs);
47562
47560
  this.needClear = !0;
47563
47561
  }