@visactor/vchart 2.1.1 → 2.1.2-alpha.1
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/es5/index.js +1 -1
- package/build/index.es.js +287 -287
- package/build/index.js +287 -287
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/constant/box-plot.js +2 -1
- package/cjs/constant/layout.js +1 -1
- package/cjs/constant/marker.js +1 -1
- package/cjs/constant/polar.js +1 -2
- package/cjs/constant/scatter.js +1 -1
- package/cjs/constant/scroll-bar.js +1 -1
- package/cjs/constant/sunburst.js +1 -1
- package/cjs/constant/waterfall.js +1 -1
- package/cjs/constant/word-cloud.js +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/instance-manager.js +1 -1
- package/cjs/core/interface.js +1 -1
- package/cjs/core/util.js +1 -1
- package/cjs/core/vchart.js +1 -1
- package/cjs/data/data-view-utils.js +1 -1
- package/cjs/data/initialize.js +1 -1
- package/cjs/data/register.js +1 -1
- package/cjs/index.d.ts +6 -1
- package/cjs/index.js +32 -12
- package/cjs/index.js.map +1 -1
- package/esm/constant/box-plot.js +2 -1
- package/esm/constant/layout.js +1 -1
- package/esm/constant/marker.js +1 -1
- package/esm/constant/polar.js +1 -2
- package/esm/constant/scatter.js +1 -1
- package/esm/constant/scroll-bar.js +1 -1
- package/esm/constant/sunburst.js +1 -1
- package/esm/constant/waterfall.js +1 -1
- package/esm/constant/word-cloud.js +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/instance-manager.js +1 -1
- package/esm/core/interface.js +1 -1
- package/esm/core/util.js +1 -1
- package/esm/core/vchart.js +1 -1
- package/esm/data/data-view-utils.js +1 -1
- package/esm/data/initialize.js +1 -1
- package/esm/data/register.js +1 -1
- package/esm/index.d.ts +6 -1
- package/esm/index.js +11 -1
- package/esm/index.js.map +1 -1
- package/package.json +9 -9
package/build/index.es.js
CHANGED
|
@@ -24482,6 +24482,199 @@ class DefaultCanvasArcRender extends BaseRender {
|
|
|
24482
24482
|
}
|
|
24483
24483
|
}
|
|
24484
24484
|
|
|
24485
|
+
function drawArcPath(arc, context, cx, cy, z, outerRadius, innerRadius) {
|
|
24486
|
+
const {
|
|
24487
|
+
startAngle: startAngle,
|
|
24488
|
+
endAngle: endAngle
|
|
24489
|
+
} = arc.getParsedAngle(),
|
|
24490
|
+
deltaAngle = abs$1(endAngle - startAngle),
|
|
24491
|
+
clockwise = endAngle > startAngle;
|
|
24492
|
+
let collapsedToLine = !1;
|
|
24493
|
+
if (outerRadius < innerRadius) {
|
|
24494
|
+
const temp = outerRadius;
|
|
24495
|
+
outerRadius = innerRadius, innerRadius = temp;
|
|
24496
|
+
}
|
|
24497
|
+
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 {
|
|
24498
|
+
const {
|
|
24499
|
+
outerDeltaAngle: outerDeltaAngle,
|
|
24500
|
+
innerDeltaAngle: innerDeltaAngle,
|
|
24501
|
+
outerStartAngle: outerStartAngle,
|
|
24502
|
+
outerEndAngle: outerEndAngle,
|
|
24503
|
+
innerEndAngle: innerEndAngle,
|
|
24504
|
+
innerStartAngle: innerStartAngle
|
|
24505
|
+
} = arc.getParsePadAngle(startAngle, endAngle),
|
|
24506
|
+
xors = outerRadius * cos$1(outerStartAngle),
|
|
24507
|
+
yors = outerRadius * sin$1(outerStartAngle),
|
|
24508
|
+
xire = innerRadius * cos$1(innerEndAngle),
|
|
24509
|
+
yire = innerRadius * sin$1(innerEndAngle);
|
|
24510
|
+
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));
|
|
24511
|
+
}
|
|
24512
|
+
return context.closePath(), collapsedToLine;
|
|
24513
|
+
}
|
|
24514
|
+
function drawInnerOuterArcPath(arc, context, cx, cy, z1, z2, radius, getParsePadAngle) {
|
|
24515
|
+
const {
|
|
24516
|
+
startAngle: startAngle,
|
|
24517
|
+
endAngle: endAngle
|
|
24518
|
+
} = arc.getParsedAngle(),
|
|
24519
|
+
deltaAngle = abs$1(endAngle - startAngle),
|
|
24520
|
+
clockwise = endAngle > startAngle;
|
|
24521
|
+
let collapsedToLine = !1;
|
|
24522
|
+
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 {
|
|
24523
|
+
const {
|
|
24524
|
+
innerouterDeltaAngle: innerouterDeltaAngle,
|
|
24525
|
+
innerouterStartAngle: innerouterStartAngle,
|
|
24526
|
+
innerouterEndAngle: innerouterEndAngle
|
|
24527
|
+
} = getParsePadAngle(startAngle, endAngle),
|
|
24528
|
+
xors = radius * cos$1(innerouterStartAngle),
|
|
24529
|
+
yors = radius * sin$1(innerouterStartAngle),
|
|
24530
|
+
xore = radius * cos$1(innerouterEndAngle),
|
|
24531
|
+
yore = radius * sin$1(innerouterEndAngle);
|
|
24532
|
+
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));
|
|
24533
|
+
}
|
|
24534
|
+
return context.closePath(), collapsedToLine;
|
|
24535
|
+
}
|
|
24536
|
+
class DefaultCanvasArc3DRender extends BaseRender {
|
|
24537
|
+
constructor() {
|
|
24538
|
+
super(...arguments), this.numberType = ARC3D_NUMBER_TYPE;
|
|
24539
|
+
}
|
|
24540
|
+
drawShape(arc, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
24541
|
+
var _a;
|
|
24542
|
+
const arcAttribute = getTheme$1(arc, null == params ? void 0 : params.theme).arc,
|
|
24543
|
+
{
|
|
24544
|
+
fill = arcAttribute.fill
|
|
24545
|
+
} = arc.attribute,
|
|
24546
|
+
data = this.valid(arc, arcAttribute, fillCb, strokeCb);
|
|
24547
|
+
if (!data) return;
|
|
24548
|
+
const {
|
|
24549
|
+
fVisible: fVisible,
|
|
24550
|
+
sVisible: sVisible,
|
|
24551
|
+
doFill: doFill,
|
|
24552
|
+
doStroke: doStroke
|
|
24553
|
+
} = data,
|
|
24554
|
+
z = null !== (_a = this.z) && void 0 !== _a ? _a : 0,
|
|
24555
|
+
{
|
|
24556
|
+
outerPadding = arcAttribute.outerPadding,
|
|
24557
|
+
innerPadding = arcAttribute.innerPadding,
|
|
24558
|
+
height = 10
|
|
24559
|
+
} = arc.attribute;
|
|
24560
|
+
let {
|
|
24561
|
+
outerRadius = arcAttribute.outerRadius,
|
|
24562
|
+
innerRadius = arcAttribute.innerRadius
|
|
24563
|
+
} = arc.attribute;
|
|
24564
|
+
outerRadius += outerPadding, innerRadius -= innerPadding;
|
|
24565
|
+
const rgbArray = ColorStore.Get(fill, ColorType.Color255),
|
|
24566
|
+
{
|
|
24567
|
+
light: light
|
|
24568
|
+
} = drawContext.stage || {},
|
|
24569
|
+
face = drawContext.hack_pieFace,
|
|
24570
|
+
z_face = {
|
|
24571
|
+
top: z,
|
|
24572
|
+
bottom: z + height
|
|
24573
|
+
},
|
|
24574
|
+
n_face = {
|
|
24575
|
+
top: [0, 1, 0],
|
|
24576
|
+
bottom: [0, -1, 0],
|
|
24577
|
+
outside: [1, 0, -1],
|
|
24578
|
+
inside: [1, 0, -1]
|
|
24579
|
+
};
|
|
24580
|
+
"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) => {
|
|
24581
|
+
const {
|
|
24582
|
+
outerDeltaAngle: outerDeltaAngle,
|
|
24583
|
+
innerDeltaAngle: innerDeltaAngle,
|
|
24584
|
+
outerStartAngle: outerStartAngle,
|
|
24585
|
+
outerEndAngle: outerEndAngle,
|
|
24586
|
+
innerEndAngle: innerEndAngle,
|
|
24587
|
+
innerStartAngle: innerStartAngle
|
|
24588
|
+
} = arc.getParsePadAngle(startAngle, endAngle);
|
|
24589
|
+
return "outside" === face ? {
|
|
24590
|
+
innerouterDeltaAngle: outerDeltaAngle,
|
|
24591
|
+
innerouterEndAngle: outerEndAngle,
|
|
24592
|
+
innerouterStartAngle: outerStartAngle
|
|
24593
|
+
} : {
|
|
24594
|
+
innerouterDeltaAngle: innerDeltaAngle,
|
|
24595
|
+
innerouterEndAngle: innerEndAngle,
|
|
24596
|
+
innerouterStartAngle: innerStartAngle
|
|
24597
|
+
};
|
|
24598
|
+
}), 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());
|
|
24599
|
+
}
|
|
24600
|
+
draw(arc, renderService, drawContext, params) {
|
|
24601
|
+
const arcAttribute = getTheme$1(arc, null == params ? void 0 : params.theme).arc;
|
|
24602
|
+
this._draw(arc, arcAttribute, !1, drawContext, params);
|
|
24603
|
+
}
|
|
24604
|
+
}
|
|
24605
|
+
|
|
24606
|
+
class Base3dRender extends BaseRender {
|
|
24607
|
+
stroke(x, y, z, face3d, context) {
|
|
24608
|
+
const vertices = face3d.vertices;
|
|
24609
|
+
face3d.edges.forEach(edge => {
|
|
24610
|
+
const p1 = vertices[edge[0]],
|
|
24611
|
+
v1 = {
|
|
24612
|
+
x: x + p1[0],
|
|
24613
|
+
y: y + p1[1],
|
|
24614
|
+
z: z + p1[2]
|
|
24615
|
+
},
|
|
24616
|
+
p2 = vertices[edge[1]],
|
|
24617
|
+
v2 = {
|
|
24618
|
+
x: x + p2[0],
|
|
24619
|
+
y: y + p2[1],
|
|
24620
|
+
z: z + p2[2]
|
|
24621
|
+
};
|
|
24622
|
+
context.beginPath(), context.moveTo(v1.x, v1.y, v1.z), context.lineTo(v2.x, v2.y, v2.z), context.stroke();
|
|
24623
|
+
});
|
|
24624
|
+
}
|
|
24625
|
+
fill(x, y, z, face3d, faces, fillColor, context, light, graphic3d, graphic3dAttribute, fillCb) {
|
|
24626
|
+
const rgbArray = ColorStore.Get(fillColor, ColorType.Color255),
|
|
24627
|
+
vertices = face3d.vertices,
|
|
24628
|
+
viewdVerticesZ = vertices.map(v => context.view(v[0], v[1], v[2])[2]),
|
|
24629
|
+
sortFace = [];
|
|
24630
|
+
face3d.polygons.forEach((p, i) => {
|
|
24631
|
+
if (faces && !faces[i]) return;
|
|
24632
|
+
sortFace.push({
|
|
24633
|
+
faceIdx: i,
|
|
24634
|
+
polygon: p
|
|
24635
|
+
});
|
|
24636
|
+
const {
|
|
24637
|
+
polygon: polygon
|
|
24638
|
+
} = p,
|
|
24639
|
+
z1 = viewdVerticesZ[polygon[0]],
|
|
24640
|
+
z2 = viewdVerticesZ[polygon[1]],
|
|
24641
|
+
z3 = viewdVerticesZ[polygon[2]],
|
|
24642
|
+
z4 = viewdVerticesZ[polygon[3]];
|
|
24643
|
+
p.ave_z = z1 + z2 + z3 + z4;
|
|
24644
|
+
}), sortFace.sort((a, b) => b.polygon.ave_z - a.polygon.ave_z), sortFace.forEach(item => {
|
|
24645
|
+
const {
|
|
24646
|
+
polygon: polygon,
|
|
24647
|
+
normal: normal
|
|
24648
|
+
} = item.polygon,
|
|
24649
|
+
p1 = vertices[polygon[0]],
|
|
24650
|
+
p2 = vertices[polygon[1]],
|
|
24651
|
+
p3 = vertices[polygon[2]],
|
|
24652
|
+
p4 = vertices[polygon[3]],
|
|
24653
|
+
v1 = {
|
|
24654
|
+
x: x + p1[0],
|
|
24655
|
+
y: y + p1[1],
|
|
24656
|
+
z: z + p1[2]
|
|
24657
|
+
},
|
|
24658
|
+
v2 = {
|
|
24659
|
+
x: x + p2[0],
|
|
24660
|
+
y: y + p2[1],
|
|
24661
|
+
z: z + p2[2]
|
|
24662
|
+
},
|
|
24663
|
+
v3 = {
|
|
24664
|
+
x: x + p3[0],
|
|
24665
|
+
y: y + p3[1],
|
|
24666
|
+
z: z + p3[2]
|
|
24667
|
+
},
|
|
24668
|
+
v4 = {
|
|
24669
|
+
x: x + p4[0],
|
|
24670
|
+
y: y + p4[1],
|
|
24671
|
+
z: z + p4[2]
|
|
24672
|
+
};
|
|
24673
|
+
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());
|
|
24674
|
+
});
|
|
24675
|
+
}
|
|
24676
|
+
}
|
|
24677
|
+
|
|
24485
24678
|
class DefaultCanvasCircleRender extends BaseRender {
|
|
24486
24679
|
constructor(graphicRenderContributions) {
|
|
24487
24680
|
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = CIRCLE_NUMBER_TYPE, this.builtinContributions = [defaultCircleRenderContribution, defaultCircleBackgroundRenderContribution, defaultCircleTextureRenderContribution], this.init(graphicRenderContributions);
|
|
@@ -25168,6 +25361,57 @@ class DefaultCanvasRectRender extends BaseRender {
|
|
|
25168
25361
|
}
|
|
25169
25362
|
}
|
|
25170
25363
|
|
|
25364
|
+
class DefaultCanvasRect3dRender extends Base3dRender {
|
|
25365
|
+
constructor() {
|
|
25366
|
+
super(...arguments), this.type = "rect3d", this.numberType = RECT3D_NUMBER_TYPE;
|
|
25367
|
+
}
|
|
25368
|
+
drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
25369
|
+
var _a, _b;
|
|
25370
|
+
const rectAttribute = getTheme$1(rect, null == params ? void 0 : params.theme).rect,
|
|
25371
|
+
{
|
|
25372
|
+
fill = rectAttribute.fill,
|
|
25373
|
+
stroke = rectAttribute.stroke,
|
|
25374
|
+
x1: x1,
|
|
25375
|
+
y1: y1,
|
|
25376
|
+
x: originX,
|
|
25377
|
+
y: originY,
|
|
25378
|
+
opacity = rectAttribute.opacity,
|
|
25379
|
+
fillOpacity = rectAttribute.fillOpacity,
|
|
25380
|
+
lineWidth = rectAttribute.lineWidth,
|
|
25381
|
+
strokeOpacity = rectAttribute.strokeOpacity,
|
|
25382
|
+
visible = rectAttribute.visible,
|
|
25383
|
+
drawStrokeWhenZeroWH = null !== (_a = rectAttribute.drawStrokeWhenZeroWH) && void 0 !== _a && _a
|
|
25384
|
+
} = rect.attribute;
|
|
25385
|
+
let {
|
|
25386
|
+
width: width,
|
|
25387
|
+
height: height
|
|
25388
|
+
} = rect.attribute;
|
|
25389
|
+
width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0;
|
|
25390
|
+
const z = null !== (_b = this.z) && void 0 !== _b ? _b : 0,
|
|
25391
|
+
fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
|
|
25392
|
+
sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH),
|
|
25393
|
+
doFill = runFill(fill),
|
|
25394
|
+
doStroke = runStroke(stroke, lineWidth);
|
|
25395
|
+
if (!rect.valid || !visible) return;
|
|
25396
|
+
if (!doFill && !doStroke) return;
|
|
25397
|
+
if (!(fVisible || sVisible || fillCb || strokeCb)) return;
|
|
25398
|
+
const {
|
|
25399
|
+
light: light
|
|
25400
|
+
} = drawContext.stage || {},
|
|
25401
|
+
face3d = rect.findFace();
|
|
25402
|
+
if (!1 !== fill) {
|
|
25403
|
+
context.setCommonStyle(rect, rect.attribute, x, y, rectAttribute);
|
|
25404
|
+
let fc = fill;
|
|
25405
|
+
"string" != typeof fc && (fc = "black"), this.fill(x, y, z, face3d, null, fc, context, light, null, null, fillCb);
|
|
25406
|
+
}
|
|
25407
|
+
!1 !== stroke && (context.setStrokeStyle(rect, rect.attribute, x, y, rectAttribute), this.stroke(x, y, z, face3d, context));
|
|
25408
|
+
}
|
|
25409
|
+
draw(rect, renderService, drawContext) {
|
|
25410
|
+
const rectAttribute = getTheme$1(rect).rect;
|
|
25411
|
+
this._draw(rect, rectAttribute, !1, drawContext);
|
|
25412
|
+
}
|
|
25413
|
+
}
|
|
25414
|
+
|
|
25171
25415
|
class DefaultCanvasSymbolRender extends BaseRender {
|
|
25172
25416
|
constructor(graphicRenderContributions) {
|
|
25173
25417
|
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = SYMBOL_NUMBER_TYPE, this.builtinContributions = [defaultSymbolRenderContribution, defaultSymbolBackgroundRenderContribution, defaultSymbolTextureRenderContribution, defaultSymbolClipRangeStrokeRenderContribution], this.init(graphicRenderContributions);
|
|
@@ -25530,18 +25774,49 @@ class DefaultCanvasPolygonRender extends BaseRender {
|
|
|
25530
25774
|
}
|
|
25531
25775
|
}
|
|
25532
25776
|
|
|
25533
|
-
|
|
25534
|
-
|
|
25535
|
-
|
|
25536
|
-
|
|
25537
|
-
|
|
25538
|
-
|
|
25539
|
-
|
|
25540
|
-
|
|
25541
|
-
|
|
25542
|
-
|
|
25543
|
-
|
|
25544
|
-
|
|
25777
|
+
class DefaultCanvasPyramid3dRender extends Base3dRender {
|
|
25778
|
+
constructor() {
|
|
25779
|
+
super(...arguments), this.type = "pyramid3d", this.numberType = PYRAMID3D_NUMBER_TYPE;
|
|
25780
|
+
}
|
|
25781
|
+
drawShape(pyramid3d, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
25782
|
+
var _a;
|
|
25783
|
+
const pyramidAttribute = getTheme$1(pyramid3d, null == params ? void 0 : params.theme).polygon,
|
|
25784
|
+
{
|
|
25785
|
+
fill = pyramidAttribute.fill,
|
|
25786
|
+
stroke = pyramidAttribute.stroke,
|
|
25787
|
+
face = [!0, !0, !0, !0, !0, !0]
|
|
25788
|
+
} = pyramid3d.attribute,
|
|
25789
|
+
z = null !== (_a = this.z) && void 0 !== _a ? _a : 0;
|
|
25790
|
+
if (!this.valid(pyramid3d, pyramidAttribute, fillCb, strokeCb)) return;
|
|
25791
|
+
const {
|
|
25792
|
+
light: light
|
|
25793
|
+
} = drawContext.stage || {},
|
|
25794
|
+
face3d = pyramid3d.findFace();
|
|
25795
|
+
if (!1 !== fill) {
|
|
25796
|
+
context.setCommonStyle(pyramid3d, pyramid3d.attribute, x, y, pyramidAttribute);
|
|
25797
|
+
let fc = fill;
|
|
25798
|
+
"string" != typeof fc && (fc = "black"), this.fill(x, y, z, face3d, face, fc, context, light, pyramid3d, pyramidAttribute, fillCb);
|
|
25799
|
+
}
|
|
25800
|
+
!1 !== stroke && (context.setStrokeStyle(pyramid3d, pyramid3d.attribute, x, y, pyramidAttribute), this.stroke(x, y, z, face3d, context));
|
|
25801
|
+
}
|
|
25802
|
+
draw(pyramid3d, renderService, drawContext) {
|
|
25803
|
+
const pyramid3dAttribute = getTheme$1(pyramid3d).polygon;
|
|
25804
|
+
this._draw(pyramid3d, pyramid3dAttribute, !1, drawContext);
|
|
25805
|
+
}
|
|
25806
|
+
}
|
|
25807
|
+
|
|
25808
|
+
const repeatStr = ["", "repeat-x", "repeat-y", "repeat"];
|
|
25809
|
+
function resolveImageRepeatMode(repeatX, repeatY) {
|
|
25810
|
+
let repeat = 0;
|
|
25811
|
+
return "repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat ? repeatStr[repeat] : "no-repeat";
|
|
25812
|
+
}
|
|
25813
|
+
function resolveImageMode({
|
|
25814
|
+
repeatX = "no-repeat",
|
|
25815
|
+
repeatY = "no-repeat",
|
|
25816
|
+
imageMode: imageMode
|
|
25817
|
+
}) {
|
|
25818
|
+
const repeatMode = resolveImageRepeatMode(repeatX, repeatY);
|
|
25819
|
+
return {
|
|
25545
25820
|
repeatMode: repeatMode,
|
|
25546
25821
|
sizingMode: "no-repeat" === repeatMode && null != imageMode ? imageMode : "fill"
|
|
25547
25822
|
};
|
|
@@ -27139,129 +27414,6 @@ function bindImageRenderModule({
|
|
|
27139
27414
|
}
|
|
27140
27415
|
const imageModule = bindImageRenderModule;
|
|
27141
27416
|
|
|
27142
|
-
class Base3dRender extends BaseRender {
|
|
27143
|
-
stroke(x, y, z, face3d, context) {
|
|
27144
|
-
const vertices = face3d.vertices;
|
|
27145
|
-
face3d.edges.forEach(edge => {
|
|
27146
|
-
const p1 = vertices[edge[0]],
|
|
27147
|
-
v1 = {
|
|
27148
|
-
x: x + p1[0],
|
|
27149
|
-
y: y + p1[1],
|
|
27150
|
-
z: z + p1[2]
|
|
27151
|
-
},
|
|
27152
|
-
p2 = vertices[edge[1]],
|
|
27153
|
-
v2 = {
|
|
27154
|
-
x: x + p2[0],
|
|
27155
|
-
y: y + p2[1],
|
|
27156
|
-
z: z + p2[2]
|
|
27157
|
-
};
|
|
27158
|
-
context.beginPath(), context.moveTo(v1.x, v1.y, v1.z), context.lineTo(v2.x, v2.y, v2.z), context.stroke();
|
|
27159
|
-
});
|
|
27160
|
-
}
|
|
27161
|
-
fill(x, y, z, face3d, faces, fillColor, context, light, graphic3d, graphic3dAttribute, fillCb) {
|
|
27162
|
-
const rgbArray = ColorStore.Get(fillColor, ColorType.Color255),
|
|
27163
|
-
vertices = face3d.vertices,
|
|
27164
|
-
viewdVerticesZ = vertices.map(v => context.view(v[0], v[1], v[2])[2]),
|
|
27165
|
-
sortFace = [];
|
|
27166
|
-
face3d.polygons.forEach((p, i) => {
|
|
27167
|
-
if (faces && !faces[i]) return;
|
|
27168
|
-
sortFace.push({
|
|
27169
|
-
faceIdx: i,
|
|
27170
|
-
polygon: p
|
|
27171
|
-
});
|
|
27172
|
-
const {
|
|
27173
|
-
polygon: polygon
|
|
27174
|
-
} = p,
|
|
27175
|
-
z1 = viewdVerticesZ[polygon[0]],
|
|
27176
|
-
z2 = viewdVerticesZ[polygon[1]],
|
|
27177
|
-
z3 = viewdVerticesZ[polygon[2]],
|
|
27178
|
-
z4 = viewdVerticesZ[polygon[3]];
|
|
27179
|
-
p.ave_z = z1 + z2 + z3 + z4;
|
|
27180
|
-
}), sortFace.sort((a, b) => b.polygon.ave_z - a.polygon.ave_z), sortFace.forEach(item => {
|
|
27181
|
-
const {
|
|
27182
|
-
polygon: polygon,
|
|
27183
|
-
normal: normal
|
|
27184
|
-
} = item.polygon,
|
|
27185
|
-
p1 = vertices[polygon[0]],
|
|
27186
|
-
p2 = vertices[polygon[1]],
|
|
27187
|
-
p3 = vertices[polygon[2]],
|
|
27188
|
-
p4 = vertices[polygon[3]],
|
|
27189
|
-
v1 = {
|
|
27190
|
-
x: x + p1[0],
|
|
27191
|
-
y: y + p1[1],
|
|
27192
|
-
z: z + p1[2]
|
|
27193
|
-
},
|
|
27194
|
-
v2 = {
|
|
27195
|
-
x: x + p2[0],
|
|
27196
|
-
y: y + p2[1],
|
|
27197
|
-
z: z + p2[2]
|
|
27198
|
-
},
|
|
27199
|
-
v3 = {
|
|
27200
|
-
x: x + p3[0],
|
|
27201
|
-
y: y + p3[1],
|
|
27202
|
-
z: z + p3[2]
|
|
27203
|
-
},
|
|
27204
|
-
v4 = {
|
|
27205
|
-
x: x + p4[0],
|
|
27206
|
-
y: y + p4[1],
|
|
27207
|
-
z: z + p4[2]
|
|
27208
|
-
};
|
|
27209
|
-
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());
|
|
27210
|
-
});
|
|
27211
|
-
}
|
|
27212
|
-
}
|
|
27213
|
-
|
|
27214
|
-
class DefaultCanvasRect3dRender extends Base3dRender {
|
|
27215
|
-
constructor() {
|
|
27216
|
-
super(...arguments), this.type = "rect3d", this.numberType = RECT3D_NUMBER_TYPE;
|
|
27217
|
-
}
|
|
27218
|
-
drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
27219
|
-
var _a, _b;
|
|
27220
|
-
const rectAttribute = getTheme$1(rect, null == params ? void 0 : params.theme).rect,
|
|
27221
|
-
{
|
|
27222
|
-
fill = rectAttribute.fill,
|
|
27223
|
-
stroke = rectAttribute.stroke,
|
|
27224
|
-
x1: x1,
|
|
27225
|
-
y1: y1,
|
|
27226
|
-
x: originX,
|
|
27227
|
-
y: originY,
|
|
27228
|
-
opacity = rectAttribute.opacity,
|
|
27229
|
-
fillOpacity = rectAttribute.fillOpacity,
|
|
27230
|
-
lineWidth = rectAttribute.lineWidth,
|
|
27231
|
-
strokeOpacity = rectAttribute.strokeOpacity,
|
|
27232
|
-
visible = rectAttribute.visible,
|
|
27233
|
-
drawStrokeWhenZeroWH = null !== (_a = rectAttribute.drawStrokeWhenZeroWH) && void 0 !== _a && _a
|
|
27234
|
-
} = rect.attribute;
|
|
27235
|
-
let {
|
|
27236
|
-
width: width,
|
|
27237
|
-
height: height
|
|
27238
|
-
} = rect.attribute;
|
|
27239
|
-
width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0;
|
|
27240
|
-
const z = null !== (_b = this.z) && void 0 !== _b ? _b : 0,
|
|
27241
|
-
fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
|
|
27242
|
-
sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH),
|
|
27243
|
-
doFill = runFill(fill),
|
|
27244
|
-
doStroke = runStroke(stroke, lineWidth);
|
|
27245
|
-
if (!rect.valid || !visible) return;
|
|
27246
|
-
if (!doFill && !doStroke) return;
|
|
27247
|
-
if (!(fVisible || sVisible || fillCb || strokeCb)) return;
|
|
27248
|
-
const {
|
|
27249
|
-
light: light
|
|
27250
|
-
} = drawContext.stage || {},
|
|
27251
|
-
face3d = rect.findFace();
|
|
27252
|
-
if (!1 !== fill) {
|
|
27253
|
-
context.setCommonStyle(rect, rect.attribute, x, y, rectAttribute);
|
|
27254
|
-
let fc = fill;
|
|
27255
|
-
"string" != typeof fc && (fc = "black"), this.fill(x, y, z, face3d, null, fc, context, light, null, null, fillCb);
|
|
27256
|
-
}
|
|
27257
|
-
!1 !== stroke && (context.setStrokeStyle(rect, rect.attribute, x, y, rectAttribute), this.stroke(x, y, z, face3d, context));
|
|
27258
|
-
}
|
|
27259
|
-
draw(rect, renderService, drawContext) {
|
|
27260
|
-
const rectAttribute = getTheme$1(rect).rect;
|
|
27261
|
-
this._draw(rect, rectAttribute, !1, drawContext);
|
|
27262
|
-
}
|
|
27263
|
-
}
|
|
27264
|
-
|
|
27265
27417
|
const loadedRect3dModuleContexts = new WeakSet();
|
|
27266
27418
|
function bindRect3dRenderModule({
|
|
27267
27419
|
bind: bind
|
|
@@ -27270,127 +27422,6 @@ function bindRect3dRenderModule({
|
|
|
27270
27422
|
}
|
|
27271
27423
|
const rect3dModule = bindRect3dRenderModule;
|
|
27272
27424
|
|
|
27273
|
-
function drawArcPath(arc, context, cx, cy, z, outerRadius, innerRadius) {
|
|
27274
|
-
const {
|
|
27275
|
-
startAngle: startAngle,
|
|
27276
|
-
endAngle: endAngle
|
|
27277
|
-
} = arc.getParsedAngle(),
|
|
27278
|
-
deltaAngle = abs$1(endAngle - startAngle),
|
|
27279
|
-
clockwise = endAngle > startAngle;
|
|
27280
|
-
let collapsedToLine = !1;
|
|
27281
|
-
if (outerRadius < innerRadius) {
|
|
27282
|
-
const temp = outerRadius;
|
|
27283
|
-
outerRadius = innerRadius, innerRadius = temp;
|
|
27284
|
-
}
|
|
27285
|
-
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 {
|
|
27286
|
-
const {
|
|
27287
|
-
outerDeltaAngle: outerDeltaAngle,
|
|
27288
|
-
innerDeltaAngle: innerDeltaAngle,
|
|
27289
|
-
outerStartAngle: outerStartAngle,
|
|
27290
|
-
outerEndAngle: outerEndAngle,
|
|
27291
|
-
innerEndAngle: innerEndAngle,
|
|
27292
|
-
innerStartAngle: innerStartAngle
|
|
27293
|
-
} = arc.getParsePadAngle(startAngle, endAngle),
|
|
27294
|
-
xors = outerRadius * cos$1(outerStartAngle),
|
|
27295
|
-
yors = outerRadius * sin$1(outerStartAngle),
|
|
27296
|
-
xire = innerRadius * cos$1(innerEndAngle),
|
|
27297
|
-
yire = innerRadius * sin$1(innerEndAngle);
|
|
27298
|
-
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));
|
|
27299
|
-
}
|
|
27300
|
-
return context.closePath(), collapsedToLine;
|
|
27301
|
-
}
|
|
27302
|
-
function drawInnerOuterArcPath(arc, context, cx, cy, z1, z2, radius, getParsePadAngle) {
|
|
27303
|
-
const {
|
|
27304
|
-
startAngle: startAngle,
|
|
27305
|
-
endAngle: endAngle
|
|
27306
|
-
} = arc.getParsedAngle(),
|
|
27307
|
-
deltaAngle = abs$1(endAngle - startAngle),
|
|
27308
|
-
clockwise = endAngle > startAngle;
|
|
27309
|
-
let collapsedToLine = !1;
|
|
27310
|
-
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 {
|
|
27311
|
-
const {
|
|
27312
|
-
innerouterDeltaAngle: innerouterDeltaAngle,
|
|
27313
|
-
innerouterStartAngle: innerouterStartAngle,
|
|
27314
|
-
innerouterEndAngle: innerouterEndAngle
|
|
27315
|
-
} = getParsePadAngle(startAngle, endAngle),
|
|
27316
|
-
xors = radius * cos$1(innerouterStartAngle),
|
|
27317
|
-
yors = radius * sin$1(innerouterStartAngle),
|
|
27318
|
-
xore = radius * cos$1(innerouterEndAngle),
|
|
27319
|
-
yore = radius * sin$1(innerouterEndAngle);
|
|
27320
|
-
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));
|
|
27321
|
-
}
|
|
27322
|
-
return context.closePath(), collapsedToLine;
|
|
27323
|
-
}
|
|
27324
|
-
class DefaultCanvasArc3DRender extends BaseRender {
|
|
27325
|
-
constructor() {
|
|
27326
|
-
super(...arguments), this.numberType = ARC3D_NUMBER_TYPE;
|
|
27327
|
-
}
|
|
27328
|
-
drawShape(arc, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
27329
|
-
var _a;
|
|
27330
|
-
const arcAttribute = getTheme$1(arc, null == params ? void 0 : params.theme).arc,
|
|
27331
|
-
{
|
|
27332
|
-
fill = arcAttribute.fill
|
|
27333
|
-
} = arc.attribute,
|
|
27334
|
-
data = this.valid(arc, arcAttribute, fillCb, strokeCb);
|
|
27335
|
-
if (!data) return;
|
|
27336
|
-
const {
|
|
27337
|
-
fVisible: fVisible,
|
|
27338
|
-
sVisible: sVisible,
|
|
27339
|
-
doFill: doFill,
|
|
27340
|
-
doStroke: doStroke
|
|
27341
|
-
} = data,
|
|
27342
|
-
z = null !== (_a = this.z) && void 0 !== _a ? _a : 0,
|
|
27343
|
-
{
|
|
27344
|
-
outerPadding = arcAttribute.outerPadding,
|
|
27345
|
-
innerPadding = arcAttribute.innerPadding,
|
|
27346
|
-
height = 10
|
|
27347
|
-
} = arc.attribute;
|
|
27348
|
-
let {
|
|
27349
|
-
outerRadius = arcAttribute.outerRadius,
|
|
27350
|
-
innerRadius = arcAttribute.innerRadius
|
|
27351
|
-
} = arc.attribute;
|
|
27352
|
-
outerRadius += outerPadding, innerRadius -= innerPadding;
|
|
27353
|
-
const rgbArray = ColorStore.Get(fill, ColorType.Color255),
|
|
27354
|
-
{
|
|
27355
|
-
light: light
|
|
27356
|
-
} = drawContext.stage || {},
|
|
27357
|
-
face = drawContext.hack_pieFace,
|
|
27358
|
-
z_face = {
|
|
27359
|
-
top: z,
|
|
27360
|
-
bottom: z + height
|
|
27361
|
-
},
|
|
27362
|
-
n_face = {
|
|
27363
|
-
top: [0, 1, 0],
|
|
27364
|
-
bottom: [0, -1, 0],
|
|
27365
|
-
outside: [1, 0, -1],
|
|
27366
|
-
inside: [1, 0, -1]
|
|
27367
|
-
};
|
|
27368
|
-
"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) => {
|
|
27369
|
-
const {
|
|
27370
|
-
outerDeltaAngle: outerDeltaAngle,
|
|
27371
|
-
innerDeltaAngle: innerDeltaAngle,
|
|
27372
|
-
outerStartAngle: outerStartAngle,
|
|
27373
|
-
outerEndAngle: outerEndAngle,
|
|
27374
|
-
innerEndAngle: innerEndAngle,
|
|
27375
|
-
innerStartAngle: innerStartAngle
|
|
27376
|
-
} = arc.getParsePadAngle(startAngle, endAngle);
|
|
27377
|
-
return "outside" === face ? {
|
|
27378
|
-
innerouterDeltaAngle: outerDeltaAngle,
|
|
27379
|
-
innerouterEndAngle: outerEndAngle,
|
|
27380
|
-
innerouterStartAngle: outerStartAngle
|
|
27381
|
-
} : {
|
|
27382
|
-
innerouterDeltaAngle: innerDeltaAngle,
|
|
27383
|
-
innerouterEndAngle: innerEndAngle,
|
|
27384
|
-
innerouterStartAngle: innerStartAngle
|
|
27385
|
-
};
|
|
27386
|
-
}), 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());
|
|
27387
|
-
}
|
|
27388
|
-
draw(arc, renderService, drawContext, params) {
|
|
27389
|
-
const arcAttribute = getTheme$1(arc, null == params ? void 0 : params.theme).arc;
|
|
27390
|
-
this._draw(arc, arcAttribute, !1, drawContext, params);
|
|
27391
|
-
}
|
|
27392
|
-
}
|
|
27393
|
-
|
|
27394
27425
|
const loadedArc3dModuleContexts = new WeakSet();
|
|
27395
27426
|
function bindArc3dRenderModule({
|
|
27396
27427
|
bind: bind
|
|
@@ -27399,37 +27430,6 @@ function bindArc3dRenderModule({
|
|
|
27399
27430
|
}
|
|
27400
27431
|
const arc3dModule = bindArc3dRenderModule;
|
|
27401
27432
|
|
|
27402
|
-
class DefaultCanvasPyramid3dRender extends Base3dRender {
|
|
27403
|
-
constructor() {
|
|
27404
|
-
super(...arguments), this.type = "pyramid3d", this.numberType = PYRAMID3D_NUMBER_TYPE;
|
|
27405
|
-
}
|
|
27406
|
-
drawShape(pyramid3d, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
27407
|
-
var _a;
|
|
27408
|
-
const pyramidAttribute = getTheme$1(pyramid3d, null == params ? void 0 : params.theme).polygon,
|
|
27409
|
-
{
|
|
27410
|
-
fill = pyramidAttribute.fill,
|
|
27411
|
-
stroke = pyramidAttribute.stroke,
|
|
27412
|
-
face = [!0, !0, !0, !0, !0, !0]
|
|
27413
|
-
} = pyramid3d.attribute,
|
|
27414
|
-
z = null !== (_a = this.z) && void 0 !== _a ? _a : 0;
|
|
27415
|
-
if (!this.valid(pyramid3d, pyramidAttribute, fillCb, strokeCb)) return;
|
|
27416
|
-
const {
|
|
27417
|
-
light: light
|
|
27418
|
-
} = drawContext.stage || {},
|
|
27419
|
-
face3d = pyramid3d.findFace();
|
|
27420
|
-
if (!1 !== fill) {
|
|
27421
|
-
context.setCommonStyle(pyramid3d, pyramid3d.attribute, x, y, pyramidAttribute);
|
|
27422
|
-
let fc = fill;
|
|
27423
|
-
"string" != typeof fc && (fc = "black"), this.fill(x, y, z, face3d, face, fc, context, light, pyramid3d, pyramidAttribute, fillCb);
|
|
27424
|
-
}
|
|
27425
|
-
!1 !== stroke && (context.setStrokeStyle(pyramid3d, pyramid3d.attribute, x, y, pyramidAttribute), this.stroke(x, y, z, face3d, context));
|
|
27426
|
-
}
|
|
27427
|
-
draw(pyramid3d, renderService, drawContext) {
|
|
27428
|
-
const pyramid3dAttribute = getTheme$1(pyramid3d).polygon;
|
|
27429
|
-
this._draw(pyramid3d, pyramid3dAttribute, !1, drawContext);
|
|
27430
|
-
}
|
|
27431
|
-
}
|
|
27432
|
-
|
|
27433
27433
|
const loadedPyramid3dModuleContexts = new WeakSet();
|
|
27434
27434
|
function bindPyramid3dRenderModule({
|
|
27435
27435
|
bind: bind
|