|
@ -73,44 +73,44 @@ export default function StandardLayer(props: { |
|
|
// 绘制标准线
|
|
|
// 绘制标准线
|
|
|
ctx.beginPath(); |
|
|
ctx.beginPath(); |
|
|
ctx.strokeStyle = "red"; |
|
|
ctx.strokeStyle = "red"; |
|
|
// ---- 右侧
|
|
|
|
|
|
|
|
|
// ---- 右侧 (从上到下)
|
|
|
let point0 = pointsRight[0]; |
|
|
let point0 = pointsRight[0]; |
|
|
let point1 = pointsRight[1]; |
|
|
let point1 = pointsRight[1]; |
|
|
ctx.moveTo(point0[0], point0[1]); |
|
|
ctx.moveTo(point0[0], point0[1]); |
|
|
let param = calculateCircleBelow(point0[0], point0[1], point1[0], point1[1], 300 * unitPx); |
|
|
let param = calculateCircleBelow(point0[0], point0[1], point1[0], point1[1], 300 * unitPx); |
|
|
console.log(param); |
|
|
|
|
|
|
|
|
// console.log(param);
|
|
|
ctx.arc( |
|
|
ctx.arc( |
|
|
param.center.x, |
|
|
param.center.x, |
|
|
param.center.y, |
|
|
param.center.y, |
|
|
300 * unitPx, |
|
|
300 * unitPx, |
|
|
param.anglesForCenter.startAngle, |
|
|
|
|
|
param.anglesForCenter.endAngle |
|
|
|
|
|
|
|
|
param.angles.startAngle, |
|
|
|
|
|
param.angles.endAngle |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
point0 = pointsRight[1]; |
|
|
point0 = pointsRight[1]; |
|
|
point1 = pointsRight[2]; |
|
|
point1 = pointsRight[2]; |
|
|
ctx.moveTo(point0[0], point0[1]); |
|
|
ctx.moveTo(point0[0], point0[1]); |
|
|
param = calculateCircleBelow(point0[0], point0[1], point1[0], point1[1], 80 * unitPx); |
|
|
param = calculateCircleBelow(point0[0], point0[1], point1[0], point1[1], 80 * unitPx); |
|
|
console.log(param); |
|
|
|
|
|
|
|
|
// console.log(param);
|
|
|
ctx.arc( |
|
|
ctx.arc( |
|
|
param.center.x, |
|
|
param.center.x, |
|
|
param.center.y, |
|
|
param.center.y, |
|
|
80 * unitPx, |
|
|
80 * unitPx, |
|
|
param.anglesForCenter.startAngle, |
|
|
|
|
|
param.anglesForCenter.endAngle |
|
|
|
|
|
|
|
|
param.angles.startAngle, |
|
|
|
|
|
param.angles.endAngle |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
point0 = pointsRight[2]; |
|
|
point0 = pointsRight[2]; |
|
|
point1 = pointsRight[3]; |
|
|
point1 = pointsRight[3]; |
|
|
ctx.moveTo(point0[0], point0[1]); |
|
|
ctx.moveTo(point0[0], point0[1]); |
|
|
param = calculateCircleBelow(point0[0], point0[1], point1[0], point1[1], 13 * unitPx); |
|
|
param = calculateCircleBelow(point0[0], point0[1], point1[0], point1[1], 13 * unitPx); |
|
|
console.log(param); |
|
|
|
|
|
|
|
|
// console.log(param);
|
|
|
ctx.arc( |
|
|
ctx.arc( |
|
|
param.center.x, |
|
|
param.center.x, |
|
|
param.center.y, |
|
|
param.center.y, |
|
|
13 * unitPx, |
|
|
13 * unitPx, |
|
|
param.anglesForCenter.startAngle, |
|
|
|
|
|
param.anglesForCenter.endAngle |
|
|
|
|
|
|
|
|
param.angles.startAngle, |
|
|
|
|
|
param.angles.endAngle |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
point0 = pointsRight[3]; |
|
|
point0 = pointsRight[3]; |
|
@ -122,15 +122,15 @@ export default function StandardLayer(props: { |
|
|
point1 = pointsRight[5]; |
|
|
point1 = pointsRight[5]; |
|
|
ctx.moveTo(point0[0], point0[1]); |
|
|
ctx.moveTo(point0[0], point0[1]); |
|
|
param = calculateCircleAbove(point0[0], point0[1], point1[0], point1[1], 5 * unitPx); |
|
|
param = calculateCircleAbove(point0[0], point0[1], point1[0], point1[1], 5 * unitPx); |
|
|
console.log(param); |
|
|
|
|
|
ctx.arc(param.center.x, param.center.y, 5 * unitPx, param.anglesForCenter.startAngle, param.anglesForCenter.endAngle); |
|
|
|
|
|
|
|
|
// console.log(param);
|
|
|
|
|
|
ctx.arc(param.center.x, param.center.y, 5 * unitPx, param.angles.startAngle, param.angles.endAngle); |
|
|
|
|
|
|
|
|
point0 = pointsRight[5]; |
|
|
point0 = pointsRight[5]; |
|
|
point1 = pointsRight[6]; |
|
|
point1 = pointsRight[6]; |
|
|
ctx.moveTo(point0[0], point0[1]); |
|
|
ctx.moveTo(point0[0], point0[1]); |
|
|
ctx.lineTo(point1[0], point1[1]); |
|
|
ctx.lineTo(point1[0], point1[1]); |
|
|
|
|
|
|
|
|
// ---- 左侧
|
|
|
|
|
|
|
|
|
// ---- 左侧 (从下向上)
|
|
|
point0 = pointsLeft[0]; |
|
|
point0 = pointsLeft[0]; |
|
|
point1 = pointsLeft[1]; |
|
|
point1 = pointsLeft[1]; |
|
|
ctx.moveTo(point0[0], point0[1]); |
|
|
ctx.moveTo(point0[0], point0[1]); |
|
@ -140,8 +140,8 @@ export default function StandardLayer(props: { |
|
|
point1 = pointsLeft[2]; |
|
|
point1 = pointsLeft[2]; |
|
|
ctx.moveTo(point0[0], point0[1]); |
|
|
ctx.moveTo(point0[0], point0[1]); |
|
|
param = calculateCircleAbove(point0[0], point0[1], point1[0], point1[1], 5 * unitPx); |
|
|
param = calculateCircleAbove(point0[0], point0[1], point1[0], point1[1], 5 * unitPx); |
|
|
console.log(param); |
|
|
|
|
|
ctx.arc(param.center.x, param.center.y, 5 * unitPx, param.anglesForCenter.startAngle, param.anglesForCenter.endAngle); |
|
|
|
|
|
|
|
|
// console.log(param);
|
|
|
|
|
|
ctx.arc(param.center.x, param.center.y, 5 * unitPx, param.angles.startAngle, param.angles.endAngle); |
|
|
|
|
|
|
|
|
point0 = pointsLeft[2]; |
|
|
point0 = pointsLeft[2]; |
|
|
point1 = pointsLeft[3]; |
|
|
point1 = pointsLeft[3]; |
|
@ -152,43 +152,42 @@ export default function StandardLayer(props: { |
|
|
point1 = pointsLeft[4]; |
|
|
point1 = pointsLeft[4]; |
|
|
ctx.moveTo(point0[0], point0[1]); |
|
|
ctx.moveTo(point0[0], point0[1]); |
|
|
param = calculateCircleBelow(point0[0], point0[1], point1[0], point1[1], 13 * unitPx); |
|
|
param = calculateCircleBelow(point0[0], point0[1], point1[0], point1[1], 13 * unitPx); |
|
|
console.log(param); |
|
|
|
|
|
|
|
|
// console.log(param);
|
|
|
ctx.arc( |
|
|
ctx.arc( |
|
|
param.center.x, |
|
|
param.center.x, |
|
|
param.center.y, |
|
|
param.center.y, |
|
|
13 * unitPx, |
|
|
13 * unitPx, |
|
|
param.anglesForCenter.startAngle, |
|
|
|
|
|
param.anglesForCenter.endAngle |
|
|
|
|
|
|
|
|
param.angles.startAngle, |
|
|
|
|
|
param.angles.endAngle |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
point0 = pointsLeft[4]; |
|
|
point0 = pointsLeft[4]; |
|
|
point1 = pointsLeft[5]; |
|
|
point1 = pointsLeft[5]; |
|
|
ctx.moveTo(point0[0], point0[1]); |
|
|
ctx.moveTo(point0[0], point0[1]); |
|
|
param = calculateCircleBelow(point0[0], point0[1], point1[0], point1[1], 80 * unitPx); |
|
|
param = calculateCircleBelow(point0[0], point0[1], point1[0], point1[1], 80 * unitPx); |
|
|
console.log(param); |
|
|
|
|
|
|
|
|
// console.log(param);
|
|
|
ctx.arc( |
|
|
ctx.arc( |
|
|
param.center.x, |
|
|
param.center.x, |
|
|
param.center.y, |
|
|
param.center.y, |
|
|
80 * unitPx, |
|
|
80 * unitPx, |
|
|
param.anglesForCenter.startAngle, |
|
|
|
|
|
param.anglesForCenter.endAngle |
|
|
|
|
|
|
|
|
param.angles.startAngle, |
|
|
|
|
|
param.angles.endAngle |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
point0 = pointsLeft[5]; |
|
|
point0 = pointsLeft[5]; |
|
|
point1 = pointsLeft[6]; |
|
|
point1 = pointsLeft[6]; |
|
|
ctx.moveTo(point0[0], point0[1]); |
|
|
ctx.moveTo(point0[0], point0[1]); |
|
|
param = calculateCircleBelow(point0[0], point0[1], point1[0], point1[1], 300 * unitPx); |
|
|
param = calculateCircleBelow(point0[0], point0[1], point1[0], point1[1], 300 * unitPx); |
|
|
console.log(param); |
|
|
|
|
|
|
|
|
// console.log(param);
|
|
|
ctx.arc( |
|
|
ctx.arc( |
|
|
param.center.x, |
|
|
param.center.x, |
|
|
param.center.y, |
|
|
param.center.y, |
|
|
300 * unitPx, |
|
|
300 * unitPx, |
|
|
param.anglesForCenter.startAngle, |
|
|
|
|
|
param.anglesForCenter.endAngle |
|
|
|
|
|
|
|
|
param.angles.startAngle, |
|
|
|
|
|
param.angles.endAngle |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
ctx.stroke(); |
|
|
ctx.stroke(); |
|
|
// ctx.fillRect(100, 100, 150, 100); // 绘制一个矩形
|
|
|
|
|
|
}, |
|
|
}, |
|
|
[pointsLeft, pointsRight, unitPx, xEndPx, xStartPx, xStepPx, yEndPx, yStartPx, yStepPx] |
|
|
[pointsLeft, pointsRight, unitPx, xEndPx, xStartPx, xStepPx, yEndPx, yStartPx, yStepPx] |
|
|
); |
|
|
); |
|
|