@visactor/vchart 2.1.2-alpha.3 → 2.1.2-alpha.4

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.
Files changed (48) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +451 -477
  3. package/build/index.js +451 -477
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/animation/animation-planner.js +2 -1
  7. package/cjs/animation/grammar-dector.js +1 -2
  8. package/cjs/constant/event.js +1 -2
  9. package/cjs/constant/scatter.js +1 -1
  10. package/cjs/constant/scroll-bar.js +2 -1
  11. package/cjs/constant/sunburst.js +1 -1
  12. package/cjs/constant/waterfall.js +1 -1
  13. package/cjs/constant/word-cloud.js +1 -1
  14. package/cjs/core/index.js +1 -1
  15. package/cjs/core/instance-manager.js +1 -1
  16. package/cjs/core/interface.js +1 -1
  17. package/cjs/core/util.js +1 -1
  18. package/cjs/core/vchart.js +1 -1
  19. package/cjs/index.d.ts +6 -1
  20. package/cjs/index.js +32 -12
  21. package/cjs/index.js.map +1 -1
  22. package/cjs/mark/base/base-mark.d.ts +0 -1
  23. package/cjs/mark/base/base-mark.js +1 -9
  24. package/cjs/mark/base/base-mark.js.map +1 -1
  25. package/cjs/mark/group.js +1 -2
  26. package/cjs/mark/group.js.map +1 -1
  27. package/esm/animation/animation-planner.js +2 -1
  28. package/esm/animation/grammar-dector.js +1 -2
  29. package/esm/constant/event.js +1 -2
  30. package/esm/constant/scatter.js +1 -1
  31. package/esm/constant/scroll-bar.js +2 -1
  32. package/esm/constant/sunburst.js +1 -1
  33. package/esm/constant/waterfall.js +1 -1
  34. package/esm/constant/word-cloud.js +1 -1
  35. package/esm/core/index.js +1 -1
  36. package/esm/core/instance-manager.js +1 -1
  37. package/esm/core/interface.js +1 -1
  38. package/esm/core/util.js +1 -1
  39. package/esm/core/vchart.js +1 -1
  40. package/esm/index.d.ts +6 -1
  41. package/esm/index.js +11 -1
  42. package/esm/index.js.map +1 -1
  43. package/esm/mark/base/base-mark.d.ts +0 -1
  44. package/esm/mark/base/base-mark.js +1 -9
  45. package/esm/mark/base/base-mark.js.map +1 -1
  46. package/esm/mark/group.js +1 -2
  47. package/esm/mark/group.js.map +1 -1
  48. package/package.json +10 -10
package/build/index.js CHANGED
@@ -24488,6 +24488,199 @@
24488
24488
  }
24489
24489
  }
24490
24490
 
24491
+ function drawArcPath(arc, context, cx, cy, z, outerRadius, innerRadius) {
24492
+ const {
24493
+ startAngle: startAngle,
24494
+ endAngle: endAngle
24495
+ } = arc.getParsedAngle(),
24496
+ deltaAngle = abs$1(endAngle - startAngle),
24497
+ clockwise = endAngle > startAngle;
24498
+ let collapsedToLine = !1;
24499
+ if (outerRadius < innerRadius) {
24500
+ const temp = outerRadius;
24501
+ outerRadius = innerRadius, innerRadius = temp;
24502
+ }
24503
+ 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 {
24504
+ const {
24505
+ outerDeltaAngle: outerDeltaAngle,
24506
+ innerDeltaAngle: innerDeltaAngle,
24507
+ outerStartAngle: outerStartAngle,
24508
+ outerEndAngle: outerEndAngle,
24509
+ innerEndAngle: innerEndAngle,
24510
+ innerStartAngle: innerStartAngle
24511
+ } = arc.getParsePadAngle(startAngle, endAngle),
24512
+ xors = outerRadius * cos$1(outerStartAngle),
24513
+ yors = outerRadius * sin$1(outerStartAngle),
24514
+ xire = innerRadius * cos$1(innerEndAngle),
24515
+ yire = innerRadius * sin$1(innerEndAngle);
24516
+ 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));
24517
+ }
24518
+ return context.closePath(), collapsedToLine;
24519
+ }
24520
+ function drawInnerOuterArcPath(arc, context, cx, cy, z1, z2, radius, getParsePadAngle) {
24521
+ const {
24522
+ startAngle: startAngle,
24523
+ endAngle: endAngle
24524
+ } = arc.getParsedAngle(),
24525
+ deltaAngle = abs$1(endAngle - startAngle),
24526
+ clockwise = endAngle > startAngle;
24527
+ let collapsedToLine = !1;
24528
+ 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 {
24529
+ const {
24530
+ innerouterDeltaAngle: innerouterDeltaAngle,
24531
+ innerouterStartAngle: innerouterStartAngle,
24532
+ innerouterEndAngle: innerouterEndAngle
24533
+ } = getParsePadAngle(startAngle, endAngle),
24534
+ xors = radius * cos$1(innerouterStartAngle),
24535
+ yors = radius * sin$1(innerouterStartAngle),
24536
+ xore = radius * cos$1(innerouterEndAngle),
24537
+ yore = radius * sin$1(innerouterEndAngle);
24538
+ 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));
24539
+ }
24540
+ return context.closePath(), collapsedToLine;
24541
+ }
24542
+ class DefaultCanvasArc3DRender extends BaseRender {
24543
+ constructor() {
24544
+ super(...arguments), this.numberType = ARC3D_NUMBER_TYPE;
24545
+ }
24546
+ drawShape(arc, context, x, y, drawContext, params, fillCb, strokeCb) {
24547
+ var _a;
24548
+ const arcAttribute = getTheme$1(arc, null == params ? void 0 : params.theme).arc,
24549
+ {
24550
+ fill = arcAttribute.fill
24551
+ } = arc.attribute,
24552
+ data = this.valid(arc, arcAttribute, fillCb, strokeCb);
24553
+ if (!data) return;
24554
+ const {
24555
+ fVisible: fVisible,
24556
+ sVisible: sVisible,
24557
+ doFill: doFill,
24558
+ doStroke: doStroke
24559
+ } = data,
24560
+ z = null !== (_a = this.z) && void 0 !== _a ? _a : 0,
24561
+ {
24562
+ outerPadding = arcAttribute.outerPadding,
24563
+ innerPadding = arcAttribute.innerPadding,
24564
+ height = 10
24565
+ } = arc.attribute;
24566
+ let {
24567
+ outerRadius = arcAttribute.outerRadius,
24568
+ innerRadius = arcAttribute.innerRadius
24569
+ } = arc.attribute;
24570
+ outerRadius += outerPadding, innerRadius -= innerPadding;
24571
+ const rgbArray = ColorStore.Get(fill, ColorType.Color255),
24572
+ {
24573
+ light: light
24574
+ } = drawContext.stage || {},
24575
+ face = drawContext.hack_pieFace,
24576
+ z_face = {
24577
+ top: z,
24578
+ bottom: z + height
24579
+ },
24580
+ n_face = {
24581
+ top: [0, 1, 0],
24582
+ bottom: [0, -1, 0],
24583
+ outside: [1, 0, -1],
24584
+ inside: [1, 0, -1]
24585
+ };
24586
+ "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) => {
24587
+ const {
24588
+ outerDeltaAngle: outerDeltaAngle,
24589
+ innerDeltaAngle: innerDeltaAngle,
24590
+ outerStartAngle: outerStartAngle,
24591
+ outerEndAngle: outerEndAngle,
24592
+ innerEndAngle: innerEndAngle,
24593
+ innerStartAngle: innerStartAngle
24594
+ } = arc.getParsePadAngle(startAngle, endAngle);
24595
+ return "outside" === face ? {
24596
+ innerouterDeltaAngle: outerDeltaAngle,
24597
+ innerouterEndAngle: outerEndAngle,
24598
+ innerouterStartAngle: outerStartAngle
24599
+ } : {
24600
+ innerouterDeltaAngle: innerDeltaAngle,
24601
+ innerouterEndAngle: innerEndAngle,
24602
+ innerouterStartAngle: innerStartAngle
24603
+ };
24604
+ }), 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());
24605
+ }
24606
+ draw(arc, renderService, drawContext, params) {
24607
+ const arcAttribute = getTheme$1(arc, null == params ? void 0 : params.theme).arc;
24608
+ this._draw(arc, arcAttribute, !1, drawContext, params);
24609
+ }
24610
+ }
24611
+
24612
+ class Base3dRender extends BaseRender {
24613
+ stroke(x, y, z, face3d, context) {
24614
+ const vertices = face3d.vertices;
24615
+ face3d.edges.forEach(edge => {
24616
+ const p1 = vertices[edge[0]],
24617
+ v1 = {
24618
+ x: x + p1[0],
24619
+ y: y + p1[1],
24620
+ z: z + p1[2]
24621
+ },
24622
+ p2 = vertices[edge[1]],
24623
+ v2 = {
24624
+ x: x + p2[0],
24625
+ y: y + p2[1],
24626
+ z: z + p2[2]
24627
+ };
24628
+ context.beginPath(), context.moveTo(v1.x, v1.y, v1.z), context.lineTo(v2.x, v2.y, v2.z), context.stroke();
24629
+ });
24630
+ }
24631
+ fill(x, y, z, face3d, faces, fillColor, context, light, graphic3d, graphic3dAttribute, fillCb) {
24632
+ const rgbArray = ColorStore.Get(fillColor, ColorType.Color255),
24633
+ vertices = face3d.vertices,
24634
+ viewdVerticesZ = vertices.map(v => context.view(v[0], v[1], v[2])[2]),
24635
+ sortFace = [];
24636
+ face3d.polygons.forEach((p, i) => {
24637
+ if (faces && !faces[i]) return;
24638
+ sortFace.push({
24639
+ faceIdx: i,
24640
+ polygon: p
24641
+ });
24642
+ const {
24643
+ polygon: polygon
24644
+ } = p,
24645
+ z1 = viewdVerticesZ[polygon[0]],
24646
+ z2 = viewdVerticesZ[polygon[1]],
24647
+ z3 = viewdVerticesZ[polygon[2]],
24648
+ z4 = viewdVerticesZ[polygon[3]];
24649
+ p.ave_z = z1 + z2 + z3 + z4;
24650
+ }), sortFace.sort((a, b) => b.polygon.ave_z - a.polygon.ave_z), sortFace.forEach(item => {
24651
+ const {
24652
+ polygon: polygon,
24653
+ normal: normal
24654
+ } = item.polygon,
24655
+ p1 = vertices[polygon[0]],
24656
+ p2 = vertices[polygon[1]],
24657
+ p3 = vertices[polygon[2]],
24658
+ p4 = vertices[polygon[3]],
24659
+ v1 = {
24660
+ x: x + p1[0],
24661
+ y: y + p1[1],
24662
+ z: z + p1[2]
24663
+ },
24664
+ v2 = {
24665
+ x: x + p2[0],
24666
+ y: y + p2[1],
24667
+ z: z + p2[2]
24668
+ },
24669
+ v3 = {
24670
+ x: x + p3[0],
24671
+ y: y + p3[1],
24672
+ z: z + p3[2]
24673
+ },
24674
+ v4 = {
24675
+ x: x + p4[0],
24676
+ y: y + p4[1],
24677
+ z: z + p4[2]
24678
+ };
24679
+ 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());
24680
+ });
24681
+ }
24682
+ }
24683
+
24491
24684
  class DefaultCanvasCircleRender extends BaseRender {
24492
24685
  constructor(graphicRenderContributions) {
24493
24686
  super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = CIRCLE_NUMBER_TYPE, this.builtinContributions = [defaultCircleRenderContribution, defaultCircleBackgroundRenderContribution, defaultCircleTextureRenderContribution], this.init(graphicRenderContributions);
@@ -25174,6 +25367,57 @@
25174
25367
  }
25175
25368
  }
25176
25369
 
25370
+ class DefaultCanvasRect3dRender extends Base3dRender {
25371
+ constructor() {
25372
+ super(...arguments), this.type = "rect3d", this.numberType = RECT3D_NUMBER_TYPE;
25373
+ }
25374
+ drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
25375
+ var _a, _b;
25376
+ const rectAttribute = getTheme$1(rect, null == params ? void 0 : params.theme).rect,
25377
+ {
25378
+ fill = rectAttribute.fill,
25379
+ stroke = rectAttribute.stroke,
25380
+ x1: x1,
25381
+ y1: y1,
25382
+ x: originX,
25383
+ y: originY,
25384
+ opacity = rectAttribute.opacity,
25385
+ fillOpacity = rectAttribute.fillOpacity,
25386
+ lineWidth = rectAttribute.lineWidth,
25387
+ strokeOpacity = rectAttribute.strokeOpacity,
25388
+ visible = rectAttribute.visible,
25389
+ drawStrokeWhenZeroWH = null !== (_a = rectAttribute.drawStrokeWhenZeroWH) && void 0 !== _a && _a
25390
+ } = rect.attribute;
25391
+ let {
25392
+ width: width,
25393
+ height: height
25394
+ } = rect.attribute;
25395
+ width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0;
25396
+ const z = null !== (_b = this.z) && void 0 !== _b ? _b : 0,
25397
+ fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
25398
+ sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH),
25399
+ doFill = runFill(fill),
25400
+ doStroke = runStroke(stroke, lineWidth);
25401
+ if (!rect.valid || !visible) return;
25402
+ if (!doFill && !doStroke) return;
25403
+ if (!(fVisible || sVisible || fillCb || strokeCb)) return;
25404
+ const {
25405
+ light: light
25406
+ } = drawContext.stage || {},
25407
+ face3d = rect.findFace();
25408
+ if (!1 !== fill) {
25409
+ context.setCommonStyle(rect, rect.attribute, x, y, rectAttribute);
25410
+ let fc = fill;
25411
+ "string" != typeof fc && (fc = "black"), this.fill(x, y, z, face3d, null, fc, context, light, null, null, fillCb);
25412
+ }
25413
+ !1 !== stroke && (context.setStrokeStyle(rect, rect.attribute, x, y, rectAttribute), this.stroke(x, y, z, face3d, context));
25414
+ }
25415
+ draw(rect, renderService, drawContext) {
25416
+ const rectAttribute = getTheme$1(rect).rect;
25417
+ this._draw(rect, rectAttribute, !1, drawContext);
25418
+ }
25419
+ }
25420
+
25177
25421
  class DefaultCanvasSymbolRender extends BaseRender {
25178
25422
  constructor(graphicRenderContributions) {
25179
25423
  super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = SYMBOL_NUMBER_TYPE, this.builtinContributions = [defaultSymbolRenderContribution, defaultSymbolBackgroundRenderContribution, defaultSymbolTextureRenderContribution, defaultSymbolClipRangeStrokeRenderContribution], this.init(graphicRenderContributions);
@@ -25536,18 +25780,49 @@
25536
25780
  }
25537
25781
  }
25538
25782
 
25539
- const repeatStr = ["", "repeat-x", "repeat-y", "repeat"];
25540
- function resolveImageRepeatMode(repeatX, repeatY) {
25541
- let repeat = 0;
25542
- return "repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat ? repeatStr[repeat] : "no-repeat";
25543
- }
25544
- function resolveImageMode({
25545
- repeatX = "no-repeat",
25546
- repeatY = "no-repeat",
25547
- imageMode: imageMode
25548
- }) {
25549
- const repeatMode = resolveImageRepeatMode(repeatX, repeatY);
25550
- return {
25783
+ class DefaultCanvasPyramid3dRender extends Base3dRender {
25784
+ constructor() {
25785
+ super(...arguments), this.type = "pyramid3d", this.numberType = PYRAMID3D_NUMBER_TYPE;
25786
+ }
25787
+ drawShape(pyramid3d, context, x, y, drawContext, params, fillCb, strokeCb) {
25788
+ var _a;
25789
+ const pyramidAttribute = getTheme$1(pyramid3d, null == params ? void 0 : params.theme).polygon,
25790
+ {
25791
+ fill = pyramidAttribute.fill,
25792
+ stroke = pyramidAttribute.stroke,
25793
+ face = [!0, !0, !0, !0, !0, !0]
25794
+ } = pyramid3d.attribute,
25795
+ z = null !== (_a = this.z) && void 0 !== _a ? _a : 0;
25796
+ if (!this.valid(pyramid3d, pyramidAttribute, fillCb, strokeCb)) return;
25797
+ const {
25798
+ light: light
25799
+ } = drawContext.stage || {},
25800
+ face3d = pyramid3d.findFace();
25801
+ if (!1 !== fill) {
25802
+ context.setCommonStyle(pyramid3d, pyramid3d.attribute, x, y, pyramidAttribute);
25803
+ let fc = fill;
25804
+ "string" != typeof fc && (fc = "black"), this.fill(x, y, z, face3d, face, fc, context, light, pyramid3d, pyramidAttribute, fillCb);
25805
+ }
25806
+ !1 !== stroke && (context.setStrokeStyle(pyramid3d, pyramid3d.attribute, x, y, pyramidAttribute), this.stroke(x, y, z, face3d, context));
25807
+ }
25808
+ draw(pyramid3d, renderService, drawContext) {
25809
+ const pyramid3dAttribute = getTheme$1(pyramid3d).polygon;
25810
+ this._draw(pyramid3d, pyramid3dAttribute, !1, drawContext);
25811
+ }
25812
+ }
25813
+
25814
+ const repeatStr = ["", "repeat-x", "repeat-y", "repeat"];
25815
+ function resolveImageRepeatMode(repeatX, repeatY) {
25816
+ let repeat = 0;
25817
+ return "repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat ? repeatStr[repeat] : "no-repeat";
25818
+ }
25819
+ function resolveImageMode({
25820
+ repeatX = "no-repeat",
25821
+ repeatY = "no-repeat",
25822
+ imageMode: imageMode
25823
+ }) {
25824
+ const repeatMode = resolveImageRepeatMode(repeatX, repeatY);
25825
+ return {
25551
25826
  repeatMode: repeatMode,
25552
25827
  sizingMode: "no-repeat" === repeatMode && null != imageMode ? imageMode : "fill"
25553
25828
  };
@@ -26971,373 +27246,40 @@
26971
27246
  container: container
26972
27247
  }) => new DefaultCanvasTextRender(createContributionProvider$1(TextRenderContribution, container))).inSingletonScope(), bind(GraphicRender).toService(TextRender), bind(TextRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, TextRenderContribution));
26973
27248
  }
26974
- const textModule = bindTextRenderModule;
26975
-
26976
- const loadedPathModuleContexts = new WeakSet();
26977
- function bindPathRenderModule({
26978
- bind: bind
26979
- }) {
26980
- isBindingContextLoaded(loadedPathModuleContexts, bind) || (bind(DefaultCanvasPathRender).toDynamicValue(({
26981
- container: container
26982
- }) => new DefaultCanvasPathRender(createContributionProvider$1(PathRenderContribution, container))).inSingletonScope(), bind(PathRender).toService(DefaultCanvasPathRender), bind(GraphicRender).toService(PathRender), bind(PathRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, PathRenderContribution));
26983
- }
26984
- const pathModule = bindPathRenderModule;
26985
-
26986
- const loadedPolygonModuleContexts = new WeakSet();
26987
- function bindPolygonRenderModule({
26988
- bind: bind
26989
- }) {
26990
- isBindingContextLoaded(loadedPolygonModuleContexts, bind) || (bind(PolygonRender).toDynamicValue(({
26991
- container: container
26992
- }) => new DefaultCanvasPolygonRender(createContributionProvider$1(PolygonRenderContribution, container))).inSingletonScope(), bind(GraphicRender).toService(PolygonRender), bind(PolygonRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, PolygonRenderContribution));
26993
- }
26994
- const polygonModule = bindPolygonRenderModule;
26995
-
26996
- class DefaultCanvasStarRender extends BaseRender {
26997
- constructor(graphicRenderContributions) {
26998
- super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = STAR_NUMBER_TYPE, this.builtinContributions = [defaultStarBackgroundRenderContribution, defaultStarTextureRenderContribution], this.init(graphicRenderContributions);
26999
- }
27000
- drawShape(star, context, x, y, drawContext, params, fillCb, strokeCb) {
27001
- const starAttribute = getTheme$1(star, null == params ? void 0 : params.theme).star,
27002
- {
27003
- x: originX = starAttribute.x,
27004
- y: originY = starAttribute.y,
27005
- fillStrokeOrder = starAttribute.fillStrokeOrder
27006
- } = star.attribute,
27007
- data = this.valid(star, starAttribute, fillCb, strokeCb);
27008
- if (!data) return;
27009
- const {
27010
- fVisible: fVisible,
27011
- sVisible: sVisible,
27012
- doFill: doFill,
27013
- doStroke: doStroke
27014
- } = data,
27015
- points = star.getCachedPoints();
27016
- context.beginPath(), points && points.length && points.forEach((point, index) => {
27017
- 0 === index ? context.moveTo(x + point.x, y + point.y) : context.lineTo(x + point.x, y + point.y);
27018
- }), context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(star, star.attribute, starAttribute), this.beforeRenderStep(star, context, x, y, doFill, doStroke, fVisible, sVisible, starAttribute, drawContext, fillCb, strokeCb);
27019
- const _runFill = () => {
27020
- doFill && (fillCb ? fillCb(context, star.attribute, starAttribute) : fVisible && (context.setCommonStyle(star, star.attribute, originX - x, originY - y, starAttribute), context.fill()));
27021
- },
27022
- _runStroke = () => {
27023
- doStroke && (strokeCb ? strokeCb(context, star.attribute, starAttribute) : sVisible && (context.setStrokeStyle(star, star.attribute, originX - x, originY - y, starAttribute), context.stroke()));
27024
- };
27025
- fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(star, context, x, y, doFill, doStroke, fVisible, sVisible, starAttribute, drawContext, fillCb, strokeCb);
27026
- }
27027
- draw(star, renderService, drawContext, params) {
27028
- const starAttribute = getTheme$1(star, null == params ? void 0 : params.theme).star;
27029
- this._draw(star, starAttribute, !1, drawContext, params);
27030
- }
27031
- }
27032
-
27033
- const loadedStarModuleContexts = new WeakSet();
27034
- function bindStarRenderModule({
27035
- bind: bind
27036
- }) {
27037
- isBindingContextLoaded(loadedStarModuleContexts, bind) || (bind(DefaultCanvasStarRender).toDynamicValue(({
27038
- container: container
27039
- }) => new DefaultCanvasStarRender(createContributionProvider$1(StarRenderContribution, container))).inSingletonScope(), bind(StarRender).toService(DefaultCanvasStarRender), bind(GraphicRender).toService(StarRender), bindContributionProvider(bind, StarRenderContribution));
27040
- }
27041
- const starModule = bindStarRenderModule;
27042
-
27043
- class DefaultCanvasGlyphRender {
27044
- constructor() {
27045
- this.numberType = GLYPH_NUMBER_TYPE;
27046
- }
27047
- reInit() {}
27048
- drawShape(glyph, context, x, y, drawContext, params, fillCb, strokeCb) {
27049
- drawContext.drawContribution && glyph.getSubGraphic().forEach(item => {
27050
- const renderer = drawContext.drawContribution.getRenderContribution(item);
27051
- renderer && renderer.drawShape && renderer.drawShape(item, context, x, y, drawContext, params, fillCb, strokeCb);
27052
- });
27053
- }
27054
- draw(glyph, renderService, drawContext, params) {
27055
- const {
27056
- context: context
27057
- } = drawContext;
27058
- if (!context) return;
27059
- if (context.highPerformanceSave(), !drawContext.drawContribution) return;
27060
- const glyphTheme = getTheme$1(glyph),
27061
- subGraphic = glyph.getSubGraphic();
27062
- subGraphic.length && subGraphic.forEach(g => {
27063
- drawContext.drawContribution.renderItem(g, drawContext, {
27064
- theme: glyphTheme
27065
- });
27066
- }), context.highPerformanceRestore();
27067
- }
27068
- }
27069
-
27070
- const loadedGlyphModuleContexts = new WeakSet();
27071
- function bindGlyphRenderModule({
27072
- bind: bind
27073
- }) {
27074
- isBindingContextLoaded(loadedGlyphModuleContexts, bind) || (bind(DefaultCanvasGlyphRender).toDynamicValue(() => new DefaultCanvasGlyphRender()).inSingletonScope(), bind(GlyphRender).toService(DefaultCanvasGlyphRender), bind(GraphicRender).toService(GlyphRender));
27075
- }
27076
- const glyphModule = bindGlyphRenderModule;
27077
-
27078
- class DefaultCanvasRichTextRender extends BaseRender {
27079
- constructor() {
27080
- super(), this.numberType = RICHTEXT_NUMBER_TYPE, this.builtinContributions = [defaultTextBackgroundRenderContribution], this.init();
27081
- }
27082
- drawShape(richtext, context, x, y, drawContext) {
27083
- const richtextAttribute = getTheme$1(richtext).richtext,
27084
- {
27085
- strokeOpacity = richtextAttribute.strokeOpacity,
27086
- opacity = richtextAttribute.opacity,
27087
- fillOpacity = richtextAttribute.fillOpacity,
27088
- visible = richtextAttribute.visible
27089
- } = richtext.attribute;
27090
- if (!richtext.valid || !visible) return;
27091
- const fVisible = fillVisible(opacity, fillOpacity, !0),
27092
- sVisible = fillVisible(opacity, strokeOpacity, !0);
27093
- if (!fVisible) return;
27094
- context.setShadowBlendStyle && context.setShadowBlendStyle(richtext, richtext.attribute, richtextAttribute), context.translate(x, y), this.beforeRenderStep(richtext, context, x, y, fVisible, sVisible, fVisible, sVisible, richtextAttribute, drawContext);
27095
- richtext.getFrameCache().draw(context, this.drawIcon), this.afterRenderStep(richtext, context, x, y, fVisible, sVisible, fVisible, sVisible, richtextAttribute, drawContext);
27096
- }
27097
- drawIcon(icon, context, x, y, baseline) {
27098
- var _a;
27099
- const richtextIconAttribute = getTheme$1(icon).richtextIcon,
27100
- {
27101
- width = richtextIconAttribute.width,
27102
- height = richtextIconAttribute.height,
27103
- opacity = richtextIconAttribute.opacity,
27104
- image: url,
27105
- backgroundFill = richtextIconAttribute.backgroundFill,
27106
- backgroundFillOpacity = richtextIconAttribute.backgroundFillOpacity,
27107
- backgroundStroke = richtextIconAttribute.backgroundStroke,
27108
- backgroundStrokeOpacity = richtextIconAttribute.backgroundStrokeOpacity,
27109
- backgroundRadius = richtextIconAttribute.backgroundRadius,
27110
- margin: margin
27111
- } = icon.attribute,
27112
- {
27113
- backgroundWidth = width,
27114
- backgroundHeight = height
27115
- } = icon.attribute;
27116
- if (margin && (x += icon._marginArray[3], y += icon._marginArray[0]), icon._hovered) {
27117
- const expandX = (backgroundWidth - width) / 2,
27118
- expandY = (backgroundHeight - height) / 2;
27119
- 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());
27120
- }
27121
- const res = url && (null === (_a = null == icon ? void 0 : icon.resources) || void 0 === _a ? void 0 : _a.get(url));
27122
- res && "success" === res.state && (context.globalAlpha = opacity, context.drawImage(res.data, x, y, width, height));
27123
- }
27124
- draw(richtext, renderService, drawContext) {
27125
- const richtextAttribute = getTheme$1(richtext).richtext;
27126
- this._draw(richtext, richtextAttribute, !1, drawContext);
27127
- }
27128
- }
27129
-
27130
- const loadedRichtextModuleContexts = new WeakSet();
27131
- function bindRichtextRenderModule({
27132
- bind: bind
27133
- }) {
27134
- isBindingContextLoaded(loadedRichtextModuleContexts, bind) || (bind(DefaultCanvasRichTextRender).toDynamicValue(() => new DefaultCanvasRichTextRender()).inSingletonScope(), bind(RichTextRender).toService(DefaultCanvasRichTextRender), bind(GraphicRender).toService(RichTextRender));
27135
- }
27136
- const richtextModule = bindRichtextRenderModule;
27137
-
27138
- const loadedImageModuleContexts = new WeakSet();
27139
- function bindImageRenderModule({
27140
- bind: bind
27141
- }) {
27142
- isBindingContextLoaded(loadedImageModuleContexts, bind) || (bind(ImageRender).toDynamicValue(({
27143
- container: container
27144
- }) => new DefaultCanvasImageRender(createContributionProvider$1(ImageRenderContribution, container))).inSingletonScope(), bind(GraphicRender).toService(ImageRender), bind(ImageRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, ImageRenderContribution));
27145
- }
27146
- const imageModule = bindImageRenderModule;
27147
-
27148
- class Base3dRender extends BaseRender {
27149
- stroke(x, y, z, face3d, context) {
27150
- const vertices = face3d.vertices;
27151
- face3d.edges.forEach(edge => {
27152
- const p1 = vertices[edge[0]],
27153
- v1 = {
27154
- x: x + p1[0],
27155
- y: y + p1[1],
27156
- z: z + p1[2]
27157
- },
27158
- p2 = vertices[edge[1]],
27159
- v2 = {
27160
- x: x + p2[0],
27161
- y: y + p2[1],
27162
- z: z + p2[2]
27163
- };
27164
- context.beginPath(), context.moveTo(v1.x, v1.y, v1.z), context.lineTo(v2.x, v2.y, v2.z), context.stroke();
27165
- });
27166
- }
27167
- fill(x, y, z, face3d, faces, fillColor, context, light, graphic3d, graphic3dAttribute, fillCb) {
27168
- const rgbArray = ColorStore.Get(fillColor, ColorType.Color255),
27169
- vertices = face3d.vertices,
27170
- viewdVerticesZ = vertices.map(v => context.view(v[0], v[1], v[2])[2]),
27171
- sortFace = [];
27172
- face3d.polygons.forEach((p, i) => {
27173
- if (faces && !faces[i]) return;
27174
- sortFace.push({
27175
- faceIdx: i,
27176
- polygon: p
27177
- });
27178
- const {
27179
- polygon: polygon
27180
- } = p,
27181
- z1 = viewdVerticesZ[polygon[0]],
27182
- z2 = viewdVerticesZ[polygon[1]],
27183
- z3 = viewdVerticesZ[polygon[2]],
27184
- z4 = viewdVerticesZ[polygon[3]];
27185
- p.ave_z = z1 + z2 + z3 + z4;
27186
- }), sortFace.sort((a, b) => b.polygon.ave_z - a.polygon.ave_z), sortFace.forEach(item => {
27187
- const {
27188
- polygon: polygon,
27189
- normal: normal
27190
- } = item.polygon,
27191
- p1 = vertices[polygon[0]],
27192
- p2 = vertices[polygon[1]],
27193
- p3 = vertices[polygon[2]],
27194
- p4 = vertices[polygon[3]],
27195
- v1 = {
27196
- x: x + p1[0],
27197
- y: y + p1[1],
27198
- z: z + p1[2]
27199
- },
27200
- v2 = {
27201
- x: x + p2[0],
27202
- y: y + p2[1],
27203
- z: z + p2[2]
27204
- },
27205
- v3 = {
27206
- x: x + p3[0],
27207
- y: y + p3[1],
27208
- z: z + p3[2]
27209
- },
27210
- v4 = {
27211
- x: x + p4[0],
27212
- y: y + p4[1],
27213
- z: z + p4[2]
27214
- };
27215
- 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());
27216
- });
27217
- }
27218
- }
27219
-
27220
- class DefaultCanvasRect3dRender extends Base3dRender {
27221
- constructor() {
27222
- super(...arguments), this.type = "rect3d", this.numberType = RECT3D_NUMBER_TYPE;
27223
- }
27224
- drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
27225
- var _a, _b;
27226
- const rectAttribute = getTheme$1(rect, null == params ? void 0 : params.theme).rect,
27227
- {
27228
- fill = rectAttribute.fill,
27229
- stroke = rectAttribute.stroke,
27230
- x1: x1,
27231
- y1: y1,
27232
- x: originX,
27233
- y: originY,
27234
- opacity = rectAttribute.opacity,
27235
- fillOpacity = rectAttribute.fillOpacity,
27236
- lineWidth = rectAttribute.lineWidth,
27237
- strokeOpacity = rectAttribute.strokeOpacity,
27238
- visible = rectAttribute.visible,
27239
- drawStrokeWhenZeroWH = null !== (_a = rectAttribute.drawStrokeWhenZeroWH) && void 0 !== _a && _a
27240
- } = rect.attribute;
27241
- let {
27242
- width: width,
27243
- height: height
27244
- } = rect.attribute;
27245
- width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0;
27246
- const z = null !== (_b = this.z) && void 0 !== _b ? _b : 0,
27247
- fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
27248
- sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH),
27249
- doFill = runFill(fill),
27250
- doStroke = runStroke(stroke, lineWidth);
27251
- if (!rect.valid || !visible) return;
27252
- if (!doFill && !doStroke) return;
27253
- if (!(fVisible || sVisible || fillCb || strokeCb)) return;
27254
- const {
27255
- light: light
27256
- } = drawContext.stage || {},
27257
- face3d = rect.findFace();
27258
- if (!1 !== fill) {
27259
- context.setCommonStyle(rect, rect.attribute, x, y, rectAttribute);
27260
- let fc = fill;
27261
- "string" != typeof fc && (fc = "black"), this.fill(x, y, z, face3d, null, fc, context, light, null, null, fillCb);
27262
- }
27263
- !1 !== stroke && (context.setStrokeStyle(rect, rect.attribute, x, y, rectAttribute), this.stroke(x, y, z, face3d, context));
27264
- }
27265
- draw(rect, renderService, drawContext) {
27266
- const rectAttribute = getTheme$1(rect).rect;
27267
- this._draw(rect, rectAttribute, !1, drawContext);
27268
- }
27269
- }
27270
-
27271
- const loadedRect3dModuleContexts = new WeakSet();
27272
- function bindRect3dRenderModule({
27273
- bind: bind
27274
- }) {
27275
- isBindingContextLoaded(loadedRect3dModuleContexts, bind) || (bind(DefaultCanvasRect3dRender).toDynamicValue(() => new DefaultCanvasRect3dRender()).inSingletonScope(), bind(Rect3DRender).toService(DefaultCanvasRect3dRender), bind(GraphicRender).toService(Rect3DRender));
27276
- }
27277
- const rect3dModule = bindRect3dRenderModule;
27278
-
27279
- function drawArcPath(arc, context, cx, cy, z, outerRadius, innerRadius) {
27280
- const {
27281
- startAngle: startAngle,
27282
- endAngle: endAngle
27283
- } = arc.getParsedAngle(),
27284
- deltaAngle = abs$1(endAngle - startAngle),
27285
- clockwise = endAngle > startAngle;
27286
- let collapsedToLine = !1;
27287
- if (outerRadius < innerRadius) {
27288
- const temp = outerRadius;
27289
- outerRadius = innerRadius, innerRadius = temp;
27290
- }
27291
- 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 {
27292
- const {
27293
- outerDeltaAngle: outerDeltaAngle,
27294
- innerDeltaAngle: innerDeltaAngle,
27295
- outerStartAngle: outerStartAngle,
27296
- outerEndAngle: outerEndAngle,
27297
- innerEndAngle: innerEndAngle,
27298
- innerStartAngle: innerStartAngle
27299
- } = arc.getParsePadAngle(startAngle, endAngle),
27300
- xors = outerRadius * cos$1(outerStartAngle),
27301
- yors = outerRadius * sin$1(outerStartAngle),
27302
- xire = innerRadius * cos$1(innerEndAngle),
27303
- yire = innerRadius * sin$1(innerEndAngle);
27304
- 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));
27305
- }
27306
- return context.closePath(), collapsedToLine;
27307
- }
27308
- function drawInnerOuterArcPath(arc, context, cx, cy, z1, z2, radius, getParsePadAngle) {
27309
- const {
27310
- startAngle: startAngle,
27311
- endAngle: endAngle
27312
- } = arc.getParsedAngle(),
27313
- deltaAngle = abs$1(endAngle - startAngle),
27314
- clockwise = endAngle > startAngle;
27315
- let collapsedToLine = !1;
27316
- 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 {
27317
- const {
27318
- innerouterDeltaAngle: innerouterDeltaAngle,
27319
- innerouterStartAngle: innerouterStartAngle,
27320
- innerouterEndAngle: innerouterEndAngle
27321
- } = getParsePadAngle(startAngle, endAngle),
27322
- xors = radius * cos$1(innerouterStartAngle),
27323
- yors = radius * sin$1(innerouterStartAngle),
27324
- xore = radius * cos$1(innerouterEndAngle),
27325
- yore = radius * sin$1(innerouterEndAngle);
27326
- 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));
27327
- }
27328
- return context.closePath(), collapsedToLine;
27329
- }
27330
- class DefaultCanvasArc3DRender extends BaseRender {
27331
- constructor() {
27332
- super(...arguments), this.numberType = ARC3D_NUMBER_TYPE;
27249
+ const textModule = bindTextRenderModule;
27250
+
27251
+ const loadedPathModuleContexts = new WeakSet();
27252
+ function bindPathRenderModule({
27253
+ bind: bind
27254
+ }) {
27255
+ isBindingContextLoaded(loadedPathModuleContexts, bind) || (bind(DefaultCanvasPathRender).toDynamicValue(({
27256
+ container: container
27257
+ }) => new DefaultCanvasPathRender(createContributionProvider$1(PathRenderContribution, container))).inSingletonScope(), bind(PathRender).toService(DefaultCanvasPathRender), bind(GraphicRender).toService(PathRender), bind(PathRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, PathRenderContribution));
27258
+ }
27259
+ const pathModule = bindPathRenderModule;
27260
+
27261
+ const loadedPolygonModuleContexts = new WeakSet();
27262
+ function bindPolygonRenderModule({
27263
+ bind: bind
27264
+ }) {
27265
+ isBindingContextLoaded(loadedPolygonModuleContexts, bind) || (bind(PolygonRender).toDynamicValue(({
27266
+ container: container
27267
+ }) => new DefaultCanvasPolygonRender(createContributionProvider$1(PolygonRenderContribution, container))).inSingletonScope(), bind(GraphicRender).toService(PolygonRender), bind(PolygonRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, PolygonRenderContribution));
27268
+ }
27269
+ const polygonModule = bindPolygonRenderModule;
27270
+
27271
+ class DefaultCanvasStarRender extends BaseRender {
27272
+ constructor(graphicRenderContributions) {
27273
+ super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = STAR_NUMBER_TYPE, this.builtinContributions = [defaultStarBackgroundRenderContribution, defaultStarTextureRenderContribution], this.init(graphicRenderContributions);
27333
27274
  }
27334
- drawShape(arc, context, x, y, drawContext, params, fillCb, strokeCb) {
27335
- var _a;
27336
- const arcAttribute = getTheme$1(arc, null == params ? void 0 : params.theme).arc,
27275
+ drawShape(star, context, x, y, drawContext, params, fillCb, strokeCb) {
27276
+ const starAttribute = getTheme$1(star, null == params ? void 0 : params.theme).star,
27337
27277
  {
27338
- fill = arcAttribute.fill
27339
- } = arc.attribute,
27340
- data = this.valid(arc, arcAttribute, fillCb, strokeCb);
27278
+ x: originX = starAttribute.x,
27279
+ y: originY = starAttribute.y,
27280
+ fillStrokeOrder = starAttribute.fillStrokeOrder
27281
+ } = star.attribute,
27282
+ data = this.valid(star, starAttribute, fillCb, strokeCb);
27341
27283
  if (!data) return;
27342
27284
  const {
27343
27285
  fVisible: fVisible,
@@ -27345,97 +27287,155 @@
27345
27287
  doFill: doFill,
27346
27288
  doStroke: doStroke
27347
27289
  } = data,
27348
- z = null !== (_a = this.z) && void 0 !== _a ? _a : 0,
27349
- {
27350
- outerPadding = arcAttribute.outerPadding,
27351
- innerPadding = arcAttribute.innerPadding,
27352
- height = 10
27353
- } = arc.attribute;
27354
- let {
27355
- outerRadius = arcAttribute.outerRadius,
27356
- innerRadius = arcAttribute.innerRadius
27357
- } = arc.attribute;
27358
- outerRadius += outerPadding, innerRadius -= innerPadding;
27359
- const rgbArray = ColorStore.Get(fill, ColorType.Color255),
27360
- {
27361
- light: light
27362
- } = drawContext.stage || {},
27363
- face = drawContext.hack_pieFace,
27364
- z_face = {
27365
- top: z,
27366
- bottom: z + height
27290
+ points = star.getCachedPoints();
27291
+ context.beginPath(), points && points.length && points.forEach((point, index) => {
27292
+ 0 === index ? context.moveTo(x + point.x, y + point.y) : context.lineTo(x + point.x, y + point.y);
27293
+ }), context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(star, star.attribute, starAttribute), this.beforeRenderStep(star, context, x, y, doFill, doStroke, fVisible, sVisible, starAttribute, drawContext, fillCb, strokeCb);
27294
+ const _runFill = () => {
27295
+ doFill && (fillCb ? fillCb(context, star.attribute, starAttribute) : fVisible && (context.setCommonStyle(star, star.attribute, originX - x, originY - y, starAttribute), context.fill()));
27367
27296
  },
27368
- n_face = {
27369
- top: [0, 1, 0],
27370
- bottom: [0, -1, 0],
27371
- outside: [1, 0, -1],
27372
- inside: [1, 0, -1]
27373
- };
27374
- "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) => {
27375
- const {
27376
- outerDeltaAngle: outerDeltaAngle,
27377
- innerDeltaAngle: innerDeltaAngle,
27378
- outerStartAngle: outerStartAngle,
27379
- outerEndAngle: outerEndAngle,
27380
- innerEndAngle: innerEndAngle,
27381
- innerStartAngle: innerStartAngle
27382
- } = arc.getParsePadAngle(startAngle, endAngle);
27383
- return "outside" === face ? {
27384
- innerouterDeltaAngle: outerDeltaAngle,
27385
- innerouterEndAngle: outerEndAngle,
27386
- innerouterStartAngle: outerStartAngle
27387
- } : {
27388
- innerouterDeltaAngle: innerDeltaAngle,
27389
- innerouterEndAngle: innerEndAngle,
27390
- innerouterStartAngle: innerStartAngle
27297
+ _runStroke = () => {
27298
+ doStroke && (strokeCb ? strokeCb(context, star.attribute, starAttribute) : sVisible && (context.setStrokeStyle(star, star.attribute, originX - x, originY - y, starAttribute), context.stroke()));
27391
27299
  };
27392
- }), 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());
27300
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(star, context, x, y, doFill, doStroke, fVisible, sVisible, starAttribute, drawContext, fillCb, strokeCb);
27393
27301
  }
27394
- draw(arc, renderService, drawContext, params) {
27395
- const arcAttribute = getTheme$1(arc, null == params ? void 0 : params.theme).arc;
27396
- this._draw(arc, arcAttribute, !1, drawContext, params);
27302
+ draw(star, renderService, drawContext, params) {
27303
+ const starAttribute = getTheme$1(star, null == params ? void 0 : params.theme).star;
27304
+ this._draw(star, starAttribute, !1, drawContext, params);
27397
27305
  }
27398
27306
  }
27399
27307
 
27400
- const loadedArc3dModuleContexts = new WeakSet();
27401
- function bindArc3dRenderModule({
27308
+ const loadedStarModuleContexts = new WeakSet();
27309
+ function bindStarRenderModule({
27402
27310
  bind: bind
27403
27311
  }) {
27404
- isBindingContextLoaded(loadedArc3dModuleContexts, bind) || (bind(DefaultCanvasArc3DRender).toDynamicValue(() => new DefaultCanvasArc3DRender()).inSingletonScope(), bind(Arc3dRender).toService(DefaultCanvasArc3DRender), bind(GraphicRender).toService(Arc3dRender));
27312
+ isBindingContextLoaded(loadedStarModuleContexts, bind) || (bind(DefaultCanvasStarRender).toDynamicValue(({
27313
+ container: container
27314
+ }) => new DefaultCanvasStarRender(createContributionProvider$1(StarRenderContribution, container))).inSingletonScope(), bind(StarRender).toService(DefaultCanvasStarRender), bind(GraphicRender).toService(StarRender), bindContributionProvider(bind, StarRenderContribution));
27405
27315
  }
27406
- const arc3dModule = bindArc3dRenderModule;
27316
+ const starModule = bindStarRenderModule;
27407
27317
 
27408
- class DefaultCanvasPyramid3dRender extends Base3dRender {
27318
+ class DefaultCanvasGlyphRender {
27409
27319
  constructor() {
27410
- super(...arguments), this.type = "pyramid3d", this.numberType = PYRAMID3D_NUMBER_TYPE;
27320
+ this.numberType = GLYPH_NUMBER_TYPE;
27411
27321
  }
27412
- drawShape(pyramid3d, context, x, y, drawContext, params, fillCb, strokeCb) {
27322
+ reInit() {}
27323
+ drawShape(glyph, context, x, y, drawContext, params, fillCb, strokeCb) {
27324
+ drawContext.drawContribution && glyph.getSubGraphic().forEach(item => {
27325
+ const renderer = drawContext.drawContribution.getRenderContribution(item);
27326
+ renderer && renderer.drawShape && renderer.drawShape(item, context, x, y, drawContext, params, fillCb, strokeCb);
27327
+ });
27328
+ }
27329
+ draw(glyph, renderService, drawContext, params) {
27330
+ const {
27331
+ context: context
27332
+ } = drawContext;
27333
+ if (!context) return;
27334
+ if (context.highPerformanceSave(), !drawContext.drawContribution) return;
27335
+ const glyphTheme = getTheme$1(glyph),
27336
+ subGraphic = glyph.getSubGraphic();
27337
+ subGraphic.length && subGraphic.forEach(g => {
27338
+ drawContext.drawContribution.renderItem(g, drawContext, {
27339
+ theme: glyphTheme
27340
+ });
27341
+ }), context.highPerformanceRestore();
27342
+ }
27343
+ }
27344
+
27345
+ const loadedGlyphModuleContexts = new WeakSet();
27346
+ function bindGlyphRenderModule({
27347
+ bind: bind
27348
+ }) {
27349
+ isBindingContextLoaded(loadedGlyphModuleContexts, bind) || (bind(DefaultCanvasGlyphRender).toDynamicValue(() => new DefaultCanvasGlyphRender()).inSingletonScope(), bind(GlyphRender).toService(DefaultCanvasGlyphRender), bind(GraphicRender).toService(GlyphRender));
27350
+ }
27351
+ const glyphModule = bindGlyphRenderModule;
27352
+
27353
+ class DefaultCanvasRichTextRender extends BaseRender {
27354
+ constructor() {
27355
+ super(), this.numberType = RICHTEXT_NUMBER_TYPE, this.builtinContributions = [defaultTextBackgroundRenderContribution], this.init();
27356
+ }
27357
+ drawShape(richtext, context, x, y, drawContext) {
27358
+ const richtextAttribute = getTheme$1(richtext).richtext,
27359
+ {
27360
+ strokeOpacity = richtextAttribute.strokeOpacity,
27361
+ opacity = richtextAttribute.opacity,
27362
+ fillOpacity = richtextAttribute.fillOpacity,
27363
+ visible = richtextAttribute.visible
27364
+ } = richtext.attribute;
27365
+ if (!richtext.valid || !visible) return;
27366
+ const fVisible = fillVisible(opacity, fillOpacity, !0),
27367
+ sVisible = fillVisible(opacity, strokeOpacity, !0);
27368
+ if (!fVisible) return;
27369
+ context.setShadowBlendStyle && context.setShadowBlendStyle(richtext, richtext.attribute, richtextAttribute), context.translate(x, y), this.beforeRenderStep(richtext, context, x, y, fVisible, sVisible, fVisible, sVisible, richtextAttribute, drawContext);
27370
+ richtext.getFrameCache().draw(context, this.drawIcon), this.afterRenderStep(richtext, context, x, y, fVisible, sVisible, fVisible, sVisible, richtextAttribute, drawContext);
27371
+ }
27372
+ drawIcon(icon, context, x, y, baseline) {
27413
27373
  var _a;
27414
- const pyramidAttribute = getTheme$1(pyramid3d, null == params ? void 0 : params.theme).polygon,
27374
+ const richtextIconAttribute = getTheme$1(icon).richtextIcon,
27415
27375
  {
27416
- fill = pyramidAttribute.fill,
27417
- stroke = pyramidAttribute.stroke,
27418
- face = [!0, !0, !0, !0, !0, !0]
27419
- } = pyramid3d.attribute,
27420
- z = null !== (_a = this.z) && void 0 !== _a ? _a : 0;
27421
- if (!this.valid(pyramid3d, pyramidAttribute, fillCb, strokeCb)) return;
27422
- const {
27423
- light: light
27424
- } = drawContext.stage || {},
27425
- face3d = pyramid3d.findFace();
27426
- if (!1 !== fill) {
27427
- context.setCommonStyle(pyramid3d, pyramid3d.attribute, x, y, pyramidAttribute);
27428
- let fc = fill;
27429
- "string" != typeof fc && (fc = "black"), this.fill(x, y, z, face3d, face, fc, context, light, pyramid3d, pyramidAttribute, fillCb);
27376
+ width = richtextIconAttribute.width,
27377
+ height = richtextIconAttribute.height,
27378
+ opacity = richtextIconAttribute.opacity,
27379
+ image: url,
27380
+ backgroundFill = richtextIconAttribute.backgroundFill,
27381
+ backgroundFillOpacity = richtextIconAttribute.backgroundFillOpacity,
27382
+ backgroundStroke = richtextIconAttribute.backgroundStroke,
27383
+ backgroundStrokeOpacity = richtextIconAttribute.backgroundStrokeOpacity,
27384
+ backgroundRadius = richtextIconAttribute.backgroundRadius,
27385
+ margin: margin
27386
+ } = icon.attribute,
27387
+ {
27388
+ backgroundWidth = width,
27389
+ backgroundHeight = height
27390
+ } = icon.attribute;
27391
+ if (margin && (x += icon._marginArray[3], y += icon._marginArray[0]), icon._hovered) {
27392
+ const expandX = (backgroundWidth - width) / 2,
27393
+ expandY = (backgroundHeight - height) / 2;
27394
+ 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());
27430
27395
  }
27431
- !1 !== stroke && (context.setStrokeStyle(pyramid3d, pyramid3d.attribute, x, y, pyramidAttribute), this.stroke(x, y, z, face3d, context));
27396
+ const res = url && (null === (_a = null == icon ? void 0 : icon.resources) || void 0 === _a ? void 0 : _a.get(url));
27397
+ res && "success" === res.state && (context.globalAlpha = opacity, context.drawImage(res.data, x, y, width, height));
27432
27398
  }
27433
- draw(pyramid3d, renderService, drawContext) {
27434
- const pyramid3dAttribute = getTheme$1(pyramid3d).polygon;
27435
- this._draw(pyramid3d, pyramid3dAttribute, !1, drawContext);
27399
+ draw(richtext, renderService, drawContext) {
27400
+ const richtextAttribute = getTheme$1(richtext).richtext;
27401
+ this._draw(richtext, richtextAttribute, !1, drawContext);
27436
27402
  }
27437
27403
  }
27438
27404
 
27405
+ const loadedRichtextModuleContexts = new WeakSet();
27406
+ function bindRichtextRenderModule({
27407
+ bind: bind
27408
+ }) {
27409
+ isBindingContextLoaded(loadedRichtextModuleContexts, bind) || (bind(DefaultCanvasRichTextRender).toDynamicValue(() => new DefaultCanvasRichTextRender()).inSingletonScope(), bind(RichTextRender).toService(DefaultCanvasRichTextRender), bind(GraphicRender).toService(RichTextRender));
27410
+ }
27411
+ const richtextModule = bindRichtextRenderModule;
27412
+
27413
+ const loadedImageModuleContexts = new WeakSet();
27414
+ function bindImageRenderModule({
27415
+ bind: bind
27416
+ }) {
27417
+ isBindingContextLoaded(loadedImageModuleContexts, bind) || (bind(ImageRender).toDynamicValue(({
27418
+ container: container
27419
+ }) => new DefaultCanvasImageRender(createContributionProvider$1(ImageRenderContribution, container))).inSingletonScope(), bind(GraphicRender).toService(ImageRender), bind(ImageRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, ImageRenderContribution));
27420
+ }
27421
+ const imageModule = bindImageRenderModule;
27422
+
27423
+ const loadedRect3dModuleContexts = new WeakSet();
27424
+ function bindRect3dRenderModule({
27425
+ bind: bind
27426
+ }) {
27427
+ isBindingContextLoaded(loadedRect3dModuleContexts, bind) || (bind(DefaultCanvasRect3dRender).toDynamicValue(() => new DefaultCanvasRect3dRender()).inSingletonScope(), bind(Rect3DRender).toService(DefaultCanvasRect3dRender), bind(GraphicRender).toService(Rect3DRender));
27428
+ }
27429
+ const rect3dModule = bindRect3dRenderModule;
27430
+
27431
+ const loadedArc3dModuleContexts = new WeakSet();
27432
+ function bindArc3dRenderModule({
27433
+ bind: bind
27434
+ }) {
27435
+ isBindingContextLoaded(loadedArc3dModuleContexts, bind) || (bind(DefaultCanvasArc3DRender).toDynamicValue(() => new DefaultCanvasArc3DRender()).inSingletonScope(), bind(Arc3dRender).toService(DefaultCanvasArc3DRender), bind(GraphicRender).toService(Arc3dRender));
27436
+ }
27437
+ const arc3dModule = bindArc3dRenderModule;
27438
+
27439
27439
  const loadedPyramid3dModuleContexts = new WeakSet();
27440
27440
  function bindPyramid3dRenderModule({
27441
27441
  bind: bind
@@ -41634,20 +41634,6 @@
41634
41634
  _hasDiffAttrs(g) {
41635
41635
  return !!g.context.diffAttrs && Object.keys(g.context.diffAttrs).length > 0;
41636
41636
  }
41637
- _commitPreventedAnimationStaticAttrs(g, attrs) {
41638
- var _a, _b;
41639
- if (!attrs || !Object.keys(attrs).length) {
41640
- return;
41641
- }
41642
- const graphic = g;
41643
- (_a = graphic.setFinalAttributes) === null || _a === void 0 ? void 0 : _a.call(graphic, attrs);
41644
- if (graphic._commitAnimationStaticAttributes) {
41645
- graphic._commitAnimationStaticAttributes(attrs);
41646
- }
41647
- else {
41648
- (_b = graphic.commitInternalBaseAttributes) === null || _b === void 0 ? void 0 : _b.call(graphic, attrs);
41649
- }
41650
- }
41651
41637
  _runApplyGraphic(graphics) {
41652
41638
  const hasAnimation = this.hasAnimation();
41653
41639
  graphics.forEach((g, index) => {
@@ -41685,13 +41671,7 @@
41685
41671
  g.context.reusing = false;
41686
41672
  }
41687
41673
  else if (!hasStateAnimation) {
41688
- if (hasAnimation) {
41689
- g.setAttributesAndPreventAnimate(diffAttrs);
41690
- this._commitPreventedAnimationStaticAttrs(g, diffAttrs);
41691
- }
41692
- else {
41693
- g.setAttributes(diffAttrs);
41694
- }
41674
+ hasAnimation ? g.setAttributesAndPreventAnimate(diffAttrs) : g.setAttributes(diffAttrs);
41695
41675
  }
41696
41676
  if (!((_b = this.renderContext) === null || _b === void 0 ? void 0 : _b.progressive) && this._product && g.parent !== this._product) {
41697
41677
  this._product.appendChild(g);
@@ -42167,13 +42147,7 @@
42167
42147
  const diffAttrs = getDiffAttributesOfGraphic(this._product, newAttrs);
42168
42148
  this._product.context.diffAttrs = diffAttrs;
42169
42149
  if (!this.hasAnimationByState(this._product.context.animationState)) {
42170
- if (hasAnimation) {
42171
- this._product.setAttributesAndPreventAnimate(diffAttrs);
42172
- this._commitPreventedAnimationStaticAttrs(this._product, diffAttrs);
42173
- }
42174
- else {
42175
- this._product.setAttributes(diffAttrs);
42176
- }
42150
+ hasAnimation ? this._product.setAttributesAndPreventAnimate(diffAttrs) : this._product.setAttributes(diffAttrs);
42177
42151
  }
42178
42152
  }
42179
42153
  else {