@visactor/react-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/index.js +291 -287
- package/build/index.min.js +3 -3
- package/package.json +7 -7
package/build/index.js
CHANGED
|
@@ -23192,6 +23192,199 @@
|
|
|
23192
23192
|
}
|
|
23193
23193
|
}
|
|
23194
23194
|
|
|
23195
|
+
function drawArcPath(arc, context, cx, cy, z, outerRadius, innerRadius) {
|
|
23196
|
+
const {
|
|
23197
|
+
startAngle: startAngle,
|
|
23198
|
+
endAngle: endAngle
|
|
23199
|
+
} = arc.getParsedAngle(),
|
|
23200
|
+
deltaAngle = abs$1(endAngle - startAngle),
|
|
23201
|
+
clockwise = endAngle > startAngle;
|
|
23202
|
+
let collapsedToLine = !1;
|
|
23203
|
+
if (outerRadius < innerRadius) {
|
|
23204
|
+
const temp = outerRadius;
|
|
23205
|
+
outerRadius = innerRadius, innerRadius = temp;
|
|
23206
|
+
}
|
|
23207
|
+
if (outerRadius <= epsilon$1) context.moveTo(cx, cy, z);else if (deltaAngle >= pi2 - epsilon$1) context.moveTo(cx + outerRadius * cos$1(startAngle), cy + outerRadius * sin$1(startAngle), z), context.arc(cx, cy, outerRadius, startAngle, endAngle, !clockwise, z), innerRadius > epsilon$1 && (context.moveTo(cx + innerRadius * cos$1(endAngle), cy + innerRadius * sin$1(endAngle), z), context.arc(cx, cy, innerRadius, endAngle, startAngle, clockwise, z));else {
|
|
23208
|
+
const {
|
|
23209
|
+
outerDeltaAngle: outerDeltaAngle,
|
|
23210
|
+
innerDeltaAngle: innerDeltaAngle,
|
|
23211
|
+
outerStartAngle: outerStartAngle,
|
|
23212
|
+
outerEndAngle: outerEndAngle,
|
|
23213
|
+
innerEndAngle: innerEndAngle,
|
|
23214
|
+
innerStartAngle: innerStartAngle
|
|
23215
|
+
} = arc.getParsePadAngle(startAngle, endAngle),
|
|
23216
|
+
xors = outerRadius * cos$1(outerStartAngle),
|
|
23217
|
+
yors = outerRadius * sin$1(outerStartAngle),
|
|
23218
|
+
xire = innerRadius * cos$1(innerEndAngle),
|
|
23219
|
+
yire = innerRadius * sin$1(innerEndAngle);
|
|
23220
|
+
outerDeltaAngle < .001 ? collapsedToLine = !0 : (context.moveTo(cx + xors, cy + yors, z), context.arc(cx, cy, outerRadius, outerStartAngle, outerEndAngle, !clockwise, z)), !(innerRadius > epsilon$1) || innerDeltaAngle < .001 ? (context.lineTo(cx + xire, cy + yire, z), collapsedToLine = !0) : (context.lineTo(cx + xire, cy + yire, z), context.arc(cx, cy, innerRadius, innerEndAngle, innerStartAngle, clockwise, z));
|
|
23221
|
+
}
|
|
23222
|
+
return context.closePath(), collapsedToLine;
|
|
23223
|
+
}
|
|
23224
|
+
function drawInnerOuterArcPath(arc, context, cx, cy, z1, z2, radius, getParsePadAngle) {
|
|
23225
|
+
const {
|
|
23226
|
+
startAngle: startAngle,
|
|
23227
|
+
endAngle: endAngle
|
|
23228
|
+
} = arc.getParsedAngle(),
|
|
23229
|
+
deltaAngle = abs$1(endAngle - startAngle),
|
|
23230
|
+
clockwise = endAngle > startAngle;
|
|
23231
|
+
let collapsedToLine = !1;
|
|
23232
|
+
if (radius <= epsilon$1) context.moveTo(cx, cy, z1);else if (deltaAngle >= pi2 - epsilon$1) context.moveTo(cx + radius * cos$1(startAngle), cy + radius * sin$1(startAngle), z1), context.arc(cx, cy, radius, startAngle, endAngle, !clockwise, z1), context.lineTo(cx + radius * cos$1(endAngle), cy + radius * sin$1(endAngle), z2), context.arc(cx, cy, radius, endAngle, startAngle, clockwise, z2);else {
|
|
23233
|
+
const {
|
|
23234
|
+
innerouterDeltaAngle: innerouterDeltaAngle,
|
|
23235
|
+
innerouterStartAngle: innerouterStartAngle,
|
|
23236
|
+
innerouterEndAngle: innerouterEndAngle
|
|
23237
|
+
} = getParsePadAngle(startAngle, endAngle),
|
|
23238
|
+
xors = radius * cos$1(innerouterStartAngle),
|
|
23239
|
+
yors = radius * sin$1(innerouterStartAngle),
|
|
23240
|
+
xore = radius * cos$1(innerouterEndAngle),
|
|
23241
|
+
yore = radius * sin$1(innerouterEndAngle);
|
|
23242
|
+
innerouterDeltaAngle < .001 ? collapsedToLine = !0 : (context.moveTo(cx + xors, cy + yors, z1), context.arc(cx, cy, radius, innerouterStartAngle, innerouterEndAngle, !clockwise, z1), context.lineTo(cx + xore, cy + yore, z2), context.arc(cx, cy, radius, innerouterEndAngle, innerouterStartAngle, clockwise, z2));
|
|
23243
|
+
}
|
|
23244
|
+
return context.closePath(), collapsedToLine;
|
|
23245
|
+
}
|
|
23246
|
+
class DefaultCanvasArc3DRender extends BaseRender {
|
|
23247
|
+
constructor() {
|
|
23248
|
+
super(...arguments), this.numberType = ARC3D_NUMBER_TYPE;
|
|
23249
|
+
}
|
|
23250
|
+
drawShape(arc, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
23251
|
+
var _a;
|
|
23252
|
+
const arcAttribute = getTheme$1(arc, null == params ? void 0 : params.theme).arc,
|
|
23253
|
+
{
|
|
23254
|
+
fill = arcAttribute.fill
|
|
23255
|
+
} = arc.attribute,
|
|
23256
|
+
data = this.valid(arc, arcAttribute, fillCb, strokeCb);
|
|
23257
|
+
if (!data) return;
|
|
23258
|
+
const {
|
|
23259
|
+
fVisible: fVisible,
|
|
23260
|
+
sVisible: sVisible,
|
|
23261
|
+
doFill: doFill,
|
|
23262
|
+
doStroke: doStroke
|
|
23263
|
+
} = data,
|
|
23264
|
+
z = null !== (_a = this.z) && void 0 !== _a ? _a : 0,
|
|
23265
|
+
{
|
|
23266
|
+
outerPadding = arcAttribute.outerPadding,
|
|
23267
|
+
innerPadding = arcAttribute.innerPadding,
|
|
23268
|
+
height = 10
|
|
23269
|
+
} = arc.attribute;
|
|
23270
|
+
let {
|
|
23271
|
+
outerRadius = arcAttribute.outerRadius,
|
|
23272
|
+
innerRadius = arcAttribute.innerRadius
|
|
23273
|
+
} = arc.attribute;
|
|
23274
|
+
outerRadius += outerPadding, innerRadius -= innerPadding;
|
|
23275
|
+
const rgbArray = ColorStore.Get(fill, ColorType.Color255),
|
|
23276
|
+
{
|
|
23277
|
+
light: light
|
|
23278
|
+
} = drawContext.stage || {},
|
|
23279
|
+
face = drawContext.hack_pieFace,
|
|
23280
|
+
z_face = {
|
|
23281
|
+
top: z,
|
|
23282
|
+
bottom: z + height
|
|
23283
|
+
},
|
|
23284
|
+
n_face = {
|
|
23285
|
+
top: [0, 1, 0],
|
|
23286
|
+
bottom: [0, -1, 0],
|
|
23287
|
+
outside: [1, 0, -1],
|
|
23288
|
+
inside: [1, 0, -1]
|
|
23289
|
+
};
|
|
23290
|
+
"bottom" === face || "top" === face ? (context.beginPath(), drawArcPath(arc, context, x, y, z_face[face], outerRadius, innerRadius), context.setShadowBlendStyle && context.setShadowBlendStyle(arc, arc.attribute, arcAttribute), doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute), context.fillStyle = light ? light.computeColor(n_face[face], rgbArray) : fill, context.fill())), doStroke && (strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke()))) : "outside" !== face && "inside" !== face || ("inside" === face && (context.save(), context.beginPath(), context.arc(x, y, innerRadius, 0, pi2, !0, z_face.top), context.clip()), context.beginPath(), drawInnerOuterArcPath(arc, context, x, y, z_face.top, z_face.bottom, "outside" === face ? outerRadius : innerRadius, (startAngle, endAngle) => {
|
|
23291
|
+
const {
|
|
23292
|
+
outerDeltaAngle: outerDeltaAngle,
|
|
23293
|
+
innerDeltaAngle: innerDeltaAngle,
|
|
23294
|
+
outerStartAngle: outerStartAngle,
|
|
23295
|
+
outerEndAngle: outerEndAngle,
|
|
23296
|
+
innerEndAngle: innerEndAngle,
|
|
23297
|
+
innerStartAngle: innerStartAngle
|
|
23298
|
+
} = arc.getParsePadAngle(startAngle, endAngle);
|
|
23299
|
+
return "outside" === face ? {
|
|
23300
|
+
innerouterDeltaAngle: outerDeltaAngle,
|
|
23301
|
+
innerouterEndAngle: outerEndAngle,
|
|
23302
|
+
innerouterStartAngle: outerStartAngle
|
|
23303
|
+
} : {
|
|
23304
|
+
innerouterDeltaAngle: innerDeltaAngle,
|
|
23305
|
+
innerouterEndAngle: innerEndAngle,
|
|
23306
|
+
innerouterStartAngle: innerStartAngle
|
|
23307
|
+
};
|
|
23308
|
+
}), context.setShadowBlendStyle && context.setShadowBlendStyle(arc, arc.attribute, arcAttribute), doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute), context.fillStyle = light ? light.computeColor(n_face[face], rgbArray) : fill, context.fill())), doStroke && (strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke())), "inside" === face && context.restore());
|
|
23309
|
+
}
|
|
23310
|
+
draw(arc, renderService, drawContext, params) {
|
|
23311
|
+
const arcAttribute = getTheme$1(arc, null == params ? void 0 : params.theme).arc;
|
|
23312
|
+
this._draw(arc, arcAttribute, !1, drawContext, params);
|
|
23313
|
+
}
|
|
23314
|
+
}
|
|
23315
|
+
|
|
23316
|
+
class Base3dRender extends BaseRender {
|
|
23317
|
+
stroke(x, y, z, face3d, context) {
|
|
23318
|
+
const vertices = face3d.vertices;
|
|
23319
|
+
face3d.edges.forEach(edge => {
|
|
23320
|
+
const p1 = vertices[edge[0]],
|
|
23321
|
+
v1 = {
|
|
23322
|
+
x: x + p1[0],
|
|
23323
|
+
y: y + p1[1],
|
|
23324
|
+
z: z + p1[2]
|
|
23325
|
+
},
|
|
23326
|
+
p2 = vertices[edge[1]],
|
|
23327
|
+
v2 = {
|
|
23328
|
+
x: x + p2[0],
|
|
23329
|
+
y: y + p2[1],
|
|
23330
|
+
z: z + p2[2]
|
|
23331
|
+
};
|
|
23332
|
+
context.beginPath(), context.moveTo(v1.x, v1.y, v1.z), context.lineTo(v2.x, v2.y, v2.z), context.stroke();
|
|
23333
|
+
});
|
|
23334
|
+
}
|
|
23335
|
+
fill(x, y, z, face3d, faces, fillColor, context, light, graphic3d, graphic3dAttribute, fillCb) {
|
|
23336
|
+
const rgbArray = ColorStore.Get(fillColor, ColorType.Color255),
|
|
23337
|
+
vertices = face3d.vertices,
|
|
23338
|
+
viewdVerticesZ = vertices.map(v => context.view(v[0], v[1], v[2])[2]),
|
|
23339
|
+
sortFace = [];
|
|
23340
|
+
face3d.polygons.forEach((p, i) => {
|
|
23341
|
+
if (faces && !faces[i]) return;
|
|
23342
|
+
sortFace.push({
|
|
23343
|
+
faceIdx: i,
|
|
23344
|
+
polygon: p
|
|
23345
|
+
});
|
|
23346
|
+
const {
|
|
23347
|
+
polygon: polygon
|
|
23348
|
+
} = p,
|
|
23349
|
+
z1 = viewdVerticesZ[polygon[0]],
|
|
23350
|
+
z2 = viewdVerticesZ[polygon[1]],
|
|
23351
|
+
z3 = viewdVerticesZ[polygon[2]],
|
|
23352
|
+
z4 = viewdVerticesZ[polygon[3]];
|
|
23353
|
+
p.ave_z = z1 + z2 + z3 + z4;
|
|
23354
|
+
}), sortFace.sort((a, b) => b.polygon.ave_z - a.polygon.ave_z), sortFace.forEach(item => {
|
|
23355
|
+
const {
|
|
23356
|
+
polygon: polygon,
|
|
23357
|
+
normal: normal
|
|
23358
|
+
} = item.polygon,
|
|
23359
|
+
p1 = vertices[polygon[0]],
|
|
23360
|
+
p2 = vertices[polygon[1]],
|
|
23361
|
+
p3 = vertices[polygon[2]],
|
|
23362
|
+
p4 = vertices[polygon[3]],
|
|
23363
|
+
v1 = {
|
|
23364
|
+
x: x + p1[0],
|
|
23365
|
+
y: y + p1[1],
|
|
23366
|
+
z: z + p1[2]
|
|
23367
|
+
},
|
|
23368
|
+
v2 = {
|
|
23369
|
+
x: x + p2[0],
|
|
23370
|
+
y: y + p2[1],
|
|
23371
|
+
z: z + p2[2]
|
|
23372
|
+
},
|
|
23373
|
+
v3 = {
|
|
23374
|
+
x: x + p3[0],
|
|
23375
|
+
y: y + p3[1],
|
|
23376
|
+
z: z + p3[2]
|
|
23377
|
+
},
|
|
23378
|
+
v4 = {
|
|
23379
|
+
x: x + p4[0],
|
|
23380
|
+
y: y + p4[1],
|
|
23381
|
+
z: z + p4[2]
|
|
23382
|
+
};
|
|
23383
|
+
context.beginPath(), context.moveTo(v1.x, v1.y, v1.z), context.lineTo(v2.x, v2.y, v2.z), context.lineTo(v3.x, v3.y, v3.z), context.lineTo(v4.x, v4.y, v4.z), context.closePath(), fillCb ? fillCb(context, graphic3d && graphic3d.attribute, graphic3dAttribute) : (context.fillStyle = light ? light.computeColor(normal, rgbArray) : fillColor, context.fill());
|
|
23384
|
+
});
|
|
23385
|
+
}
|
|
23386
|
+
}
|
|
23387
|
+
|
|
23195
23388
|
class DefaultCanvasCircleRender extends BaseRender {
|
|
23196
23389
|
constructor(graphicRenderContributions) {
|
|
23197
23390
|
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = CIRCLE_NUMBER_TYPE, this.builtinContributions = [defaultCircleRenderContribution, defaultCircleBackgroundRenderContribution, defaultCircleTextureRenderContribution], this.init(graphicRenderContributions);
|
|
@@ -23878,6 +24071,57 @@
|
|
|
23878
24071
|
}
|
|
23879
24072
|
}
|
|
23880
24073
|
|
|
24074
|
+
class DefaultCanvasRect3dRender extends Base3dRender {
|
|
24075
|
+
constructor() {
|
|
24076
|
+
super(...arguments), this.type = "rect3d", this.numberType = RECT3D_NUMBER_TYPE;
|
|
24077
|
+
}
|
|
24078
|
+
drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
24079
|
+
var _a, _b;
|
|
24080
|
+
const rectAttribute = getTheme$1(rect, null == params ? void 0 : params.theme).rect,
|
|
24081
|
+
{
|
|
24082
|
+
fill = rectAttribute.fill,
|
|
24083
|
+
stroke = rectAttribute.stroke,
|
|
24084
|
+
x1: x1,
|
|
24085
|
+
y1: y1,
|
|
24086
|
+
x: originX,
|
|
24087
|
+
y: originY,
|
|
24088
|
+
opacity = rectAttribute.opacity,
|
|
24089
|
+
fillOpacity = rectAttribute.fillOpacity,
|
|
24090
|
+
lineWidth = rectAttribute.lineWidth,
|
|
24091
|
+
strokeOpacity = rectAttribute.strokeOpacity,
|
|
24092
|
+
visible = rectAttribute.visible,
|
|
24093
|
+
drawStrokeWhenZeroWH = null !== (_a = rectAttribute.drawStrokeWhenZeroWH) && void 0 !== _a && _a
|
|
24094
|
+
} = rect.attribute;
|
|
24095
|
+
let {
|
|
24096
|
+
width: width,
|
|
24097
|
+
height: height
|
|
24098
|
+
} = rect.attribute;
|
|
24099
|
+
width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0;
|
|
24100
|
+
const z = null !== (_b = this.z) && void 0 !== _b ? _b : 0,
|
|
24101
|
+
fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
|
|
24102
|
+
sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH),
|
|
24103
|
+
doFill = runFill(fill),
|
|
24104
|
+
doStroke = runStroke(stroke, lineWidth);
|
|
24105
|
+
if (!rect.valid || !visible) return;
|
|
24106
|
+
if (!doFill && !doStroke) return;
|
|
24107
|
+
if (!(fVisible || sVisible || fillCb || strokeCb)) return;
|
|
24108
|
+
const {
|
|
24109
|
+
light: light
|
|
24110
|
+
} = drawContext.stage || {},
|
|
24111
|
+
face3d = rect.findFace();
|
|
24112
|
+
if (!1 !== fill) {
|
|
24113
|
+
context.setCommonStyle(rect, rect.attribute, x, y, rectAttribute);
|
|
24114
|
+
let fc = fill;
|
|
24115
|
+
"string" != typeof fc && (fc = "black"), this.fill(x, y, z, face3d, null, fc, context, light, null, null, fillCb);
|
|
24116
|
+
}
|
|
24117
|
+
!1 !== stroke && (context.setStrokeStyle(rect, rect.attribute, x, y, rectAttribute), this.stroke(x, y, z, face3d, context));
|
|
24118
|
+
}
|
|
24119
|
+
draw(rect, renderService, drawContext) {
|
|
24120
|
+
const rectAttribute = getTheme$1(rect).rect;
|
|
24121
|
+
this._draw(rect, rectAttribute, !1, drawContext);
|
|
24122
|
+
}
|
|
24123
|
+
}
|
|
24124
|
+
|
|
23881
24125
|
class DefaultCanvasSymbolRender extends BaseRender {
|
|
23882
24126
|
constructor(graphicRenderContributions) {
|
|
23883
24127
|
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = SYMBOL_NUMBER_TYPE, this.builtinContributions = [defaultSymbolRenderContribution, defaultSymbolBackgroundRenderContribution, defaultSymbolTextureRenderContribution, defaultSymbolClipRangeStrokeRenderContribution], this.init(graphicRenderContributions);
|
|
@@ -24242,18 +24486,49 @@
|
|
|
24242
24486
|
}
|
|
24243
24487
|
}
|
|
24244
24488
|
|
|
24245
|
-
|
|
24246
|
-
|
|
24247
|
-
|
|
24248
|
-
|
|
24249
|
-
|
|
24250
|
-
|
|
24251
|
-
|
|
24252
|
-
|
|
24253
|
-
|
|
24254
|
-
|
|
24255
|
-
|
|
24256
|
-
|
|
24489
|
+
class DefaultCanvasPyramid3dRender extends Base3dRender {
|
|
24490
|
+
constructor() {
|
|
24491
|
+
super(...arguments), this.type = "pyramid3d", this.numberType = PYRAMID3D_NUMBER_TYPE;
|
|
24492
|
+
}
|
|
24493
|
+
drawShape(pyramid3d, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
24494
|
+
var _a;
|
|
24495
|
+
const pyramidAttribute = getTheme$1(pyramid3d, null == params ? void 0 : params.theme).polygon,
|
|
24496
|
+
{
|
|
24497
|
+
fill = pyramidAttribute.fill,
|
|
24498
|
+
stroke = pyramidAttribute.stroke,
|
|
24499
|
+
face = [!0, !0, !0, !0, !0, !0]
|
|
24500
|
+
} = pyramid3d.attribute,
|
|
24501
|
+
z = null !== (_a = this.z) && void 0 !== _a ? _a : 0;
|
|
24502
|
+
if (!this.valid(pyramid3d, pyramidAttribute, fillCb, strokeCb)) return;
|
|
24503
|
+
const {
|
|
24504
|
+
light: light
|
|
24505
|
+
} = drawContext.stage || {},
|
|
24506
|
+
face3d = pyramid3d.findFace();
|
|
24507
|
+
if (!1 !== fill) {
|
|
24508
|
+
context.setCommonStyle(pyramid3d, pyramid3d.attribute, x, y, pyramidAttribute);
|
|
24509
|
+
let fc = fill;
|
|
24510
|
+
"string" != typeof fc && (fc = "black"), this.fill(x, y, z, face3d, face, fc, context, light, pyramid3d, pyramidAttribute, fillCb);
|
|
24511
|
+
}
|
|
24512
|
+
!1 !== stroke && (context.setStrokeStyle(pyramid3d, pyramid3d.attribute, x, y, pyramidAttribute), this.stroke(x, y, z, face3d, context));
|
|
24513
|
+
}
|
|
24514
|
+
draw(pyramid3d, renderService, drawContext) {
|
|
24515
|
+
const pyramid3dAttribute = getTheme$1(pyramid3d).polygon;
|
|
24516
|
+
this._draw(pyramid3d, pyramid3dAttribute, !1, drawContext);
|
|
24517
|
+
}
|
|
24518
|
+
}
|
|
24519
|
+
|
|
24520
|
+
const repeatStr = ["", "repeat-x", "repeat-y", "repeat"];
|
|
24521
|
+
function resolveImageRepeatMode(repeatX, repeatY) {
|
|
24522
|
+
let repeat = 0;
|
|
24523
|
+
return "repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat ? repeatStr[repeat] : "no-repeat";
|
|
24524
|
+
}
|
|
24525
|
+
function resolveImageMode({
|
|
24526
|
+
repeatX = "no-repeat",
|
|
24527
|
+
repeatY = "no-repeat",
|
|
24528
|
+
imageMode: imageMode
|
|
24529
|
+
}) {
|
|
24530
|
+
const repeatMode = resolveImageRepeatMode(repeatX, repeatY);
|
|
24531
|
+
return {
|
|
24257
24532
|
repeatMode: repeatMode,
|
|
24258
24533
|
sizingMode: "no-repeat" === repeatMode && null != imageMode ? imageMode : "fill"
|
|
24259
24534
|
};
|
|
@@ -27089,129 +27364,6 @@
|
|
|
27089
27364
|
}
|
|
27090
27365
|
const imageModule = bindImageRenderModule;
|
|
27091
27366
|
|
|
27092
|
-
class Base3dRender extends BaseRender {
|
|
27093
|
-
stroke(x, y, z, face3d, context) {
|
|
27094
|
-
const vertices = face3d.vertices;
|
|
27095
|
-
face3d.edges.forEach(edge => {
|
|
27096
|
-
const p1 = vertices[edge[0]],
|
|
27097
|
-
v1 = {
|
|
27098
|
-
x: x + p1[0],
|
|
27099
|
-
y: y + p1[1],
|
|
27100
|
-
z: z + p1[2]
|
|
27101
|
-
},
|
|
27102
|
-
p2 = vertices[edge[1]],
|
|
27103
|
-
v2 = {
|
|
27104
|
-
x: x + p2[0],
|
|
27105
|
-
y: y + p2[1],
|
|
27106
|
-
z: z + p2[2]
|
|
27107
|
-
};
|
|
27108
|
-
context.beginPath(), context.moveTo(v1.x, v1.y, v1.z), context.lineTo(v2.x, v2.y, v2.z), context.stroke();
|
|
27109
|
-
});
|
|
27110
|
-
}
|
|
27111
|
-
fill(x, y, z, face3d, faces, fillColor, context, light, graphic3d, graphic3dAttribute, fillCb) {
|
|
27112
|
-
const rgbArray = ColorStore.Get(fillColor, ColorType.Color255),
|
|
27113
|
-
vertices = face3d.vertices,
|
|
27114
|
-
viewdVerticesZ = vertices.map(v => context.view(v[0], v[1], v[2])[2]),
|
|
27115
|
-
sortFace = [];
|
|
27116
|
-
face3d.polygons.forEach((p, i) => {
|
|
27117
|
-
if (faces && !faces[i]) return;
|
|
27118
|
-
sortFace.push({
|
|
27119
|
-
faceIdx: i,
|
|
27120
|
-
polygon: p
|
|
27121
|
-
});
|
|
27122
|
-
const {
|
|
27123
|
-
polygon: polygon
|
|
27124
|
-
} = p,
|
|
27125
|
-
z1 = viewdVerticesZ[polygon[0]],
|
|
27126
|
-
z2 = viewdVerticesZ[polygon[1]],
|
|
27127
|
-
z3 = viewdVerticesZ[polygon[2]],
|
|
27128
|
-
z4 = viewdVerticesZ[polygon[3]];
|
|
27129
|
-
p.ave_z = z1 + z2 + z3 + z4;
|
|
27130
|
-
}), sortFace.sort((a, b) => b.polygon.ave_z - a.polygon.ave_z), sortFace.forEach(item => {
|
|
27131
|
-
const {
|
|
27132
|
-
polygon: polygon,
|
|
27133
|
-
normal: normal
|
|
27134
|
-
} = item.polygon,
|
|
27135
|
-
p1 = vertices[polygon[0]],
|
|
27136
|
-
p2 = vertices[polygon[1]],
|
|
27137
|
-
p3 = vertices[polygon[2]],
|
|
27138
|
-
p4 = vertices[polygon[3]],
|
|
27139
|
-
v1 = {
|
|
27140
|
-
x: x + p1[0],
|
|
27141
|
-
y: y + p1[1],
|
|
27142
|
-
z: z + p1[2]
|
|
27143
|
-
},
|
|
27144
|
-
v2 = {
|
|
27145
|
-
x: x + p2[0],
|
|
27146
|
-
y: y + p2[1],
|
|
27147
|
-
z: z + p2[2]
|
|
27148
|
-
},
|
|
27149
|
-
v3 = {
|
|
27150
|
-
x: x + p3[0],
|
|
27151
|
-
y: y + p3[1],
|
|
27152
|
-
z: z + p3[2]
|
|
27153
|
-
},
|
|
27154
|
-
v4 = {
|
|
27155
|
-
x: x + p4[0],
|
|
27156
|
-
y: y + p4[1],
|
|
27157
|
-
z: z + p4[2]
|
|
27158
|
-
};
|
|
27159
|
-
context.beginPath(), context.moveTo(v1.x, v1.y, v1.z), context.lineTo(v2.x, v2.y, v2.z), context.lineTo(v3.x, v3.y, v3.z), context.lineTo(v4.x, v4.y, v4.z), context.closePath(), fillCb ? fillCb(context, graphic3d && graphic3d.attribute, graphic3dAttribute) : (context.fillStyle = light ? light.computeColor(normal, rgbArray) : fillColor, context.fill());
|
|
27160
|
-
});
|
|
27161
|
-
}
|
|
27162
|
-
}
|
|
27163
|
-
|
|
27164
|
-
class DefaultCanvasRect3dRender extends Base3dRender {
|
|
27165
|
-
constructor() {
|
|
27166
|
-
super(...arguments), this.type = "rect3d", this.numberType = RECT3D_NUMBER_TYPE;
|
|
27167
|
-
}
|
|
27168
|
-
drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
27169
|
-
var _a, _b;
|
|
27170
|
-
const rectAttribute = getTheme$1(rect, null == params ? void 0 : params.theme).rect,
|
|
27171
|
-
{
|
|
27172
|
-
fill = rectAttribute.fill,
|
|
27173
|
-
stroke = rectAttribute.stroke,
|
|
27174
|
-
x1: x1,
|
|
27175
|
-
y1: y1,
|
|
27176
|
-
x: originX,
|
|
27177
|
-
y: originY,
|
|
27178
|
-
opacity = rectAttribute.opacity,
|
|
27179
|
-
fillOpacity = rectAttribute.fillOpacity,
|
|
27180
|
-
lineWidth = rectAttribute.lineWidth,
|
|
27181
|
-
strokeOpacity = rectAttribute.strokeOpacity,
|
|
27182
|
-
visible = rectAttribute.visible,
|
|
27183
|
-
drawStrokeWhenZeroWH = null !== (_a = rectAttribute.drawStrokeWhenZeroWH) && void 0 !== _a && _a
|
|
27184
|
-
} = rect.attribute;
|
|
27185
|
-
let {
|
|
27186
|
-
width: width,
|
|
27187
|
-
height: height
|
|
27188
|
-
} = rect.attribute;
|
|
27189
|
-
width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0;
|
|
27190
|
-
const z = null !== (_b = this.z) && void 0 !== _b ? _b : 0,
|
|
27191
|
-
fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
|
|
27192
|
-
sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH),
|
|
27193
|
-
doFill = runFill(fill),
|
|
27194
|
-
doStroke = runStroke(stroke, lineWidth);
|
|
27195
|
-
if (!rect.valid || !visible) return;
|
|
27196
|
-
if (!doFill && !doStroke) return;
|
|
27197
|
-
if (!(fVisible || sVisible || fillCb || strokeCb)) return;
|
|
27198
|
-
const {
|
|
27199
|
-
light: light
|
|
27200
|
-
} = drawContext.stage || {},
|
|
27201
|
-
face3d = rect.findFace();
|
|
27202
|
-
if (!1 !== fill) {
|
|
27203
|
-
context.setCommonStyle(rect, rect.attribute, x, y, rectAttribute);
|
|
27204
|
-
let fc = fill;
|
|
27205
|
-
"string" != typeof fc && (fc = "black"), this.fill(x, y, z, face3d, null, fc, context, light, null, null, fillCb);
|
|
27206
|
-
}
|
|
27207
|
-
!1 !== stroke && (context.setStrokeStyle(rect, rect.attribute, x, y, rectAttribute), this.stroke(x, y, z, face3d, context));
|
|
27208
|
-
}
|
|
27209
|
-
draw(rect, renderService, drawContext) {
|
|
27210
|
-
const rectAttribute = getTheme$1(rect).rect;
|
|
27211
|
-
this._draw(rect, rectAttribute, !1, drawContext);
|
|
27212
|
-
}
|
|
27213
|
-
}
|
|
27214
|
-
|
|
27215
27367
|
const loadedRect3dModuleContexts = new WeakSet();
|
|
27216
27368
|
function bindRect3dRenderModule({
|
|
27217
27369
|
bind: bind
|
|
@@ -27220,127 +27372,6 @@
|
|
|
27220
27372
|
}
|
|
27221
27373
|
const rect3dModule = bindRect3dRenderModule;
|
|
27222
27374
|
|
|
27223
|
-
function drawArcPath(arc, context, cx, cy, z, outerRadius, innerRadius) {
|
|
27224
|
-
const {
|
|
27225
|
-
startAngle: startAngle,
|
|
27226
|
-
endAngle: endAngle
|
|
27227
|
-
} = arc.getParsedAngle(),
|
|
27228
|
-
deltaAngle = abs$1(endAngle - startAngle),
|
|
27229
|
-
clockwise = endAngle > startAngle;
|
|
27230
|
-
let collapsedToLine = !1;
|
|
27231
|
-
if (outerRadius < innerRadius) {
|
|
27232
|
-
const temp = outerRadius;
|
|
27233
|
-
outerRadius = innerRadius, innerRadius = temp;
|
|
27234
|
-
}
|
|
27235
|
-
if (outerRadius <= epsilon$1) context.moveTo(cx, cy, z);else if (deltaAngle >= pi2 - epsilon$1) context.moveTo(cx + outerRadius * cos$1(startAngle), cy + outerRadius * sin$1(startAngle), z), context.arc(cx, cy, outerRadius, startAngle, endAngle, !clockwise, z), innerRadius > epsilon$1 && (context.moveTo(cx + innerRadius * cos$1(endAngle), cy + innerRadius * sin$1(endAngle), z), context.arc(cx, cy, innerRadius, endAngle, startAngle, clockwise, z));else {
|
|
27236
|
-
const {
|
|
27237
|
-
outerDeltaAngle: outerDeltaAngle,
|
|
27238
|
-
innerDeltaAngle: innerDeltaAngle,
|
|
27239
|
-
outerStartAngle: outerStartAngle,
|
|
27240
|
-
outerEndAngle: outerEndAngle,
|
|
27241
|
-
innerEndAngle: innerEndAngle,
|
|
27242
|
-
innerStartAngle: innerStartAngle
|
|
27243
|
-
} = arc.getParsePadAngle(startAngle, endAngle),
|
|
27244
|
-
xors = outerRadius * cos$1(outerStartAngle),
|
|
27245
|
-
yors = outerRadius * sin$1(outerStartAngle),
|
|
27246
|
-
xire = innerRadius * cos$1(innerEndAngle),
|
|
27247
|
-
yire = innerRadius * sin$1(innerEndAngle);
|
|
27248
|
-
outerDeltaAngle < .001 ? collapsedToLine = !0 : (context.moveTo(cx + xors, cy + yors, z), context.arc(cx, cy, outerRadius, outerStartAngle, outerEndAngle, !clockwise, z)), !(innerRadius > epsilon$1) || innerDeltaAngle < .001 ? (context.lineTo(cx + xire, cy + yire, z), collapsedToLine = !0) : (context.lineTo(cx + xire, cy + yire, z), context.arc(cx, cy, innerRadius, innerEndAngle, innerStartAngle, clockwise, z));
|
|
27249
|
-
}
|
|
27250
|
-
return context.closePath(), collapsedToLine;
|
|
27251
|
-
}
|
|
27252
|
-
function drawInnerOuterArcPath(arc, context, cx, cy, z1, z2, radius, getParsePadAngle) {
|
|
27253
|
-
const {
|
|
27254
|
-
startAngle: startAngle,
|
|
27255
|
-
endAngle: endAngle
|
|
27256
|
-
} = arc.getParsedAngle(),
|
|
27257
|
-
deltaAngle = abs$1(endAngle - startAngle),
|
|
27258
|
-
clockwise = endAngle > startAngle;
|
|
27259
|
-
let collapsedToLine = !1;
|
|
27260
|
-
if (radius <= epsilon$1) context.moveTo(cx, cy, z1);else if (deltaAngle >= pi2 - epsilon$1) context.moveTo(cx + radius * cos$1(startAngle), cy + radius * sin$1(startAngle), z1), context.arc(cx, cy, radius, startAngle, endAngle, !clockwise, z1), context.lineTo(cx + radius * cos$1(endAngle), cy + radius * sin$1(endAngle), z2), context.arc(cx, cy, radius, endAngle, startAngle, clockwise, z2);else {
|
|
27261
|
-
const {
|
|
27262
|
-
innerouterDeltaAngle: innerouterDeltaAngle,
|
|
27263
|
-
innerouterStartAngle: innerouterStartAngle,
|
|
27264
|
-
innerouterEndAngle: innerouterEndAngle
|
|
27265
|
-
} = getParsePadAngle(startAngle, endAngle),
|
|
27266
|
-
xors = radius * cos$1(innerouterStartAngle),
|
|
27267
|
-
yors = radius * sin$1(innerouterStartAngle),
|
|
27268
|
-
xore = radius * cos$1(innerouterEndAngle),
|
|
27269
|
-
yore = radius * sin$1(innerouterEndAngle);
|
|
27270
|
-
innerouterDeltaAngle < .001 ? collapsedToLine = !0 : (context.moveTo(cx + xors, cy + yors, z1), context.arc(cx, cy, radius, innerouterStartAngle, innerouterEndAngle, !clockwise, z1), context.lineTo(cx + xore, cy + yore, z2), context.arc(cx, cy, radius, innerouterEndAngle, innerouterStartAngle, clockwise, z2));
|
|
27271
|
-
}
|
|
27272
|
-
return context.closePath(), collapsedToLine;
|
|
27273
|
-
}
|
|
27274
|
-
class DefaultCanvasArc3DRender extends BaseRender {
|
|
27275
|
-
constructor() {
|
|
27276
|
-
super(...arguments), this.numberType = ARC3D_NUMBER_TYPE;
|
|
27277
|
-
}
|
|
27278
|
-
drawShape(arc, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
27279
|
-
var _a;
|
|
27280
|
-
const arcAttribute = getTheme$1(arc, null == params ? void 0 : params.theme).arc,
|
|
27281
|
-
{
|
|
27282
|
-
fill = arcAttribute.fill
|
|
27283
|
-
} = arc.attribute,
|
|
27284
|
-
data = this.valid(arc, arcAttribute, fillCb, strokeCb);
|
|
27285
|
-
if (!data) return;
|
|
27286
|
-
const {
|
|
27287
|
-
fVisible: fVisible,
|
|
27288
|
-
sVisible: sVisible,
|
|
27289
|
-
doFill: doFill,
|
|
27290
|
-
doStroke: doStroke
|
|
27291
|
-
} = data,
|
|
27292
|
-
z = null !== (_a = this.z) && void 0 !== _a ? _a : 0,
|
|
27293
|
-
{
|
|
27294
|
-
outerPadding = arcAttribute.outerPadding,
|
|
27295
|
-
innerPadding = arcAttribute.innerPadding,
|
|
27296
|
-
height = 10
|
|
27297
|
-
} = arc.attribute;
|
|
27298
|
-
let {
|
|
27299
|
-
outerRadius = arcAttribute.outerRadius,
|
|
27300
|
-
innerRadius = arcAttribute.innerRadius
|
|
27301
|
-
} = arc.attribute;
|
|
27302
|
-
outerRadius += outerPadding, innerRadius -= innerPadding;
|
|
27303
|
-
const rgbArray = ColorStore.Get(fill, ColorType.Color255),
|
|
27304
|
-
{
|
|
27305
|
-
light: light
|
|
27306
|
-
} = drawContext.stage || {},
|
|
27307
|
-
face = drawContext.hack_pieFace,
|
|
27308
|
-
z_face = {
|
|
27309
|
-
top: z,
|
|
27310
|
-
bottom: z + height
|
|
27311
|
-
},
|
|
27312
|
-
n_face = {
|
|
27313
|
-
top: [0, 1, 0],
|
|
27314
|
-
bottom: [0, -1, 0],
|
|
27315
|
-
outside: [1, 0, -1],
|
|
27316
|
-
inside: [1, 0, -1]
|
|
27317
|
-
};
|
|
27318
|
-
"bottom" === face || "top" === face ? (context.beginPath(), drawArcPath(arc, context, x, y, z_face[face], outerRadius, innerRadius), context.setShadowBlendStyle && context.setShadowBlendStyle(arc, arc.attribute, arcAttribute), doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute), context.fillStyle = light ? light.computeColor(n_face[face], rgbArray) : fill, context.fill())), doStroke && (strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke()))) : "outside" !== face && "inside" !== face || ("inside" === face && (context.save(), context.beginPath(), context.arc(x, y, innerRadius, 0, pi2, !0, z_face.top), context.clip()), context.beginPath(), drawInnerOuterArcPath(arc, context, x, y, z_face.top, z_face.bottom, "outside" === face ? outerRadius : innerRadius, (startAngle, endAngle) => {
|
|
27319
|
-
const {
|
|
27320
|
-
outerDeltaAngle: outerDeltaAngle,
|
|
27321
|
-
innerDeltaAngle: innerDeltaAngle,
|
|
27322
|
-
outerStartAngle: outerStartAngle,
|
|
27323
|
-
outerEndAngle: outerEndAngle,
|
|
27324
|
-
innerEndAngle: innerEndAngle,
|
|
27325
|
-
innerStartAngle: innerStartAngle
|
|
27326
|
-
} = arc.getParsePadAngle(startAngle, endAngle);
|
|
27327
|
-
return "outside" === face ? {
|
|
27328
|
-
innerouterDeltaAngle: outerDeltaAngle,
|
|
27329
|
-
innerouterEndAngle: outerEndAngle,
|
|
27330
|
-
innerouterStartAngle: outerStartAngle
|
|
27331
|
-
} : {
|
|
27332
|
-
innerouterDeltaAngle: innerDeltaAngle,
|
|
27333
|
-
innerouterEndAngle: innerEndAngle,
|
|
27334
|
-
innerouterStartAngle: innerStartAngle
|
|
27335
|
-
};
|
|
27336
|
-
}), context.setShadowBlendStyle && context.setShadowBlendStyle(arc, arc.attribute, arcAttribute), doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute), context.fillStyle = light ? light.computeColor(n_face[face], rgbArray) : fill, context.fill())), doStroke && (strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke())), "inside" === face && context.restore());
|
|
27337
|
-
}
|
|
27338
|
-
draw(arc, renderService, drawContext, params) {
|
|
27339
|
-
const arcAttribute = getTheme$1(arc, null == params ? void 0 : params.theme).arc;
|
|
27340
|
-
this._draw(arc, arcAttribute, !1, drawContext, params);
|
|
27341
|
-
}
|
|
27342
|
-
}
|
|
27343
|
-
|
|
27344
27375
|
const loadedArc3dModuleContexts = new WeakSet();
|
|
27345
27376
|
function bindArc3dRenderModule({
|
|
27346
27377
|
bind: bind
|
|
@@ -27349,37 +27380,6 @@
|
|
|
27349
27380
|
}
|
|
27350
27381
|
const arc3dModule = bindArc3dRenderModule;
|
|
27351
27382
|
|
|
27352
|
-
class DefaultCanvasPyramid3dRender extends Base3dRender {
|
|
27353
|
-
constructor() {
|
|
27354
|
-
super(...arguments), this.type = "pyramid3d", this.numberType = PYRAMID3D_NUMBER_TYPE;
|
|
27355
|
-
}
|
|
27356
|
-
drawShape(pyramid3d, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
27357
|
-
var _a;
|
|
27358
|
-
const pyramidAttribute = getTheme$1(pyramid3d, null == params ? void 0 : params.theme).polygon,
|
|
27359
|
-
{
|
|
27360
|
-
fill = pyramidAttribute.fill,
|
|
27361
|
-
stroke = pyramidAttribute.stroke,
|
|
27362
|
-
face = [!0, !0, !0, !0, !0, !0]
|
|
27363
|
-
} = pyramid3d.attribute,
|
|
27364
|
-
z = null !== (_a = this.z) && void 0 !== _a ? _a : 0;
|
|
27365
|
-
if (!this.valid(pyramid3d, pyramidAttribute, fillCb, strokeCb)) return;
|
|
27366
|
-
const {
|
|
27367
|
-
light: light
|
|
27368
|
-
} = drawContext.stage || {},
|
|
27369
|
-
face3d = pyramid3d.findFace();
|
|
27370
|
-
if (!1 !== fill) {
|
|
27371
|
-
context.setCommonStyle(pyramid3d, pyramid3d.attribute, x, y, pyramidAttribute);
|
|
27372
|
-
let fc = fill;
|
|
27373
|
-
"string" != typeof fc && (fc = "black"), this.fill(x, y, z, face3d, face, fc, context, light, pyramid3d, pyramidAttribute, fillCb);
|
|
27374
|
-
}
|
|
27375
|
-
!1 !== stroke && (context.setStrokeStyle(pyramid3d, pyramid3d.attribute, x, y, pyramidAttribute), this.stroke(x, y, z, face3d, context));
|
|
27376
|
-
}
|
|
27377
|
-
draw(pyramid3d, renderService, drawContext) {
|
|
27378
|
-
const pyramid3dAttribute = getTheme$1(pyramid3d).polygon;
|
|
27379
|
-
this._draw(pyramid3d, pyramid3dAttribute, !1, drawContext);
|
|
27380
|
-
}
|
|
27381
|
-
}
|
|
27382
|
-
|
|
27383
27383
|
const loadedPyramid3dModuleContexts = new WeakSet();
|
|
27384
27384
|
function bindPyramid3dRenderModule({
|
|
27385
27385
|
bind: bind
|
|
@@ -28043,6 +28043,7 @@
|
|
|
28043
28043
|
AreaRenderContribution: AreaRenderContribution,
|
|
28044
28044
|
get AttributeUpdateType () { return AttributeUpdateType; },
|
|
28045
28045
|
AutoEnablePlugins: AutoEnablePlugins,
|
|
28046
|
+
Base3dRender: Base3dRender,
|
|
28046
28047
|
BaseCanvas: BaseCanvas,
|
|
28047
28048
|
BaseEnvContribution: BaseEnvContribution,
|
|
28048
28049
|
BaseRender: BaseRender,
|
|
@@ -28091,6 +28092,7 @@
|
|
|
28091
28092
|
DefaultBaseInteractiveRenderContribution: DefaultBaseInteractiveRenderContribution,
|
|
28092
28093
|
DefaultBaseTextureRenderContribution: DefaultBaseTextureRenderContribution,
|
|
28093
28094
|
DefaultCanvasAllocate: DefaultCanvasAllocate,
|
|
28095
|
+
DefaultCanvasArc3DRender: DefaultCanvasArc3DRender,
|
|
28094
28096
|
DefaultCanvasArcRender: DefaultCanvasArcRender,
|
|
28095
28097
|
DefaultCanvasAreaRender: DefaultCanvasAreaRender,
|
|
28096
28098
|
DefaultCanvasCircleRender: DefaultCanvasCircleRender,
|
|
@@ -28099,6 +28101,8 @@
|
|
|
28099
28101
|
DefaultCanvasLineRender: DefaultCanvasLineRender,
|
|
28100
28102
|
DefaultCanvasPathRender: DefaultCanvasPathRender,
|
|
28101
28103
|
DefaultCanvasPolygonRender: DefaultCanvasPolygonRender,
|
|
28104
|
+
DefaultCanvasPyramid3dRender: DefaultCanvasPyramid3dRender,
|
|
28105
|
+
DefaultCanvasRect3dRender: DefaultCanvasRect3dRender,
|
|
28102
28106
|
DefaultCanvasRectRender: DefaultCanvasRectRender,
|
|
28103
28107
|
DefaultCanvasSymbolRender: DefaultCanvasSymbolRender,
|
|
28104
28108
|
DefaultCanvasTextRender: DefaultCanvasTextRender,
|