feat:2.6.1增加 数物对应 和 根据颜色画图形

This commit is contained in:
R524809
2025-12-23 13:35:19 +08:00
parent 9b6a0a26cc
commit 20496c3cc8
28 changed files with 940 additions and 277 deletions
@@ -145,12 +145,13 @@ export function drawShapeSymbolShape(
break;
case 'triangle':
// 三角形缩小为原来的0.9倍
const triangleRadius = radius * 0.9;
// 三角形缩小为原来的0.9倍,整体中心提高
// const triangleRadius = radius * 0.9;
const bottomY = radius * 0.7; // 减少底部Y坐标,使整体中心提高
ctx.beginPath();
ctx.moveTo(0, -triangleRadius);
ctx.lineTo(-triangleRadius, triangleRadius);
ctx.lineTo(triangleRadius, triangleRadius);
ctx.moveTo(0, -radius);
ctx.lineTo(-radius, bottomY);
ctx.lineTo(radius, bottomY);
ctx.closePath();
drawPath();
break;
@@ -176,9 +177,10 @@ export function drawShapeSymbolShape(
drawPath();
break;
// 椭圆
case 'ellipse':
ctx.beginPath();
ctx.ellipse(0, 0, radius * 0.8, radius * 0.6, 0, 0, Math.PI * 2);
ctx.ellipse(0, 0, radius, radius * 0.8, 0, 0, Math.PI * 2);
drawPath();
break;
@@ -287,17 +289,21 @@ export function drawShapeSymbolShape(
// 扇形
case 'sector':
// 扇形(90度扇形),圆心在格子中心点偏左二分之一的位置
const sectorCenterX = -radius / 2; // 向左偏移半径的一半
const sectorCenterY = 0;
const sectorRadius = radius * 1.5;
// 扇形(圆弧在正上方,圆点在正下方)
const sectorCenterX = 0; // 圆心在水平中心
const sectorCenterY = sectorRadius * 0.55; // 圆心在正下方
ctx.beginPath();
ctx.moveTo(sectorCenterX, sectorCenterY);
// 从左侧上方到右侧上方绘制圆弧(135度到225度)
ctx.arc(
sectorCenterX,
sectorCenterY,
radius,
sectorRadius,
(-3 * Math.PI) / 4,
-Math.PI / 4,
Math.PI / 4,
// (Math.PI * 3) / 4, // 左侧上方(135度)
// (Math.PI * 5) / 4, // 右侧上方(225度)
false,
);
ctx.lineTo(sectorCenterX, sectorCenterY);