easyeda 0.0.128 → 0.0.130
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/dist/browser/index.d.ts +102 -0
- package/dist/browser/index.js +42 -5
- package/dist/browser/index.js.map +1 -1
- package/dist/{chunk-YCCBLZAH.js → chunk-SMM32IOL.js} +43 -6
- package/dist/{chunk-YCCBLZAH.js.map → chunk-SMM32IOL.js.map} +1 -1
- package/dist/cli/main.js +3 -3
- package/dist/cli/main.js.map +1 -1
- package/dist/lib/index.d.ts +830 -641
- package/dist/lib/index.js +1 -1
- package/package.json +2 -2
|
@@ -1517,13 +1517,13 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
|
|
|
1517
1517
|
}
|
|
1518
1518
|
const h = Math.sqrt(radius * radius - distance2 * distance2 / 4);
|
|
1519
1519
|
const angle = Math.atan2(dy, dx);
|
|
1520
|
-
const centerX = midX + h * Math.sin(angle) * (sweepFlag ? 1 :
|
|
1521
|
-
const centerY = midY - h * Math.cos(angle) * (sweepFlag ? 1 :
|
|
1520
|
+
const centerX = midX + h * Math.sin(angle) * (sweepFlag ? -1 : 1);
|
|
1521
|
+
const centerY = midY - h * Math.cos(angle) * (sweepFlag ? -1 : 1);
|
|
1522
1522
|
const startAngle = Math.atan2(startY - centerY, startX - centerX);
|
|
1523
1523
|
let endAngle = Math.atan2(endY - centerY, endX - centerX);
|
|
1524
|
-
if (
|
|
1524
|
+
if (sweepFlag && endAngle > startAngle) {
|
|
1525
1525
|
endAngle -= 2 * Math.PI;
|
|
1526
|
-
} else if (sweepFlag && endAngle < startAngle) {
|
|
1526
|
+
} else if (!sweepFlag && endAngle < startAngle) {
|
|
1527
1527
|
endAngle += 2 * Math.PI;
|
|
1528
1528
|
}
|
|
1529
1529
|
if (!largeArcFlag && Math.abs(endAngle - startAngle) > Math.PI || largeArcFlag && Math.abs(endAngle - startAngle) < Math.PI) {
|
|
@@ -2527,6 +2527,7 @@ var ShapeItemSchema = z75.object({
|
|
|
2527
2527
|
radiusX: Number(radiusX),
|
|
2528
2528
|
radiusY: Number(radiusY),
|
|
2529
2529
|
largeArc: largeArcFlag === "1",
|
|
2530
|
+
// sweepFlag=1 means clockwise (CW), sweepFlag=0 means counter-clockwise (CCW)
|
|
2530
2531
|
sweepDirection: sweepFlag === "1" ? "CW" : "CCW"
|
|
2531
2532
|
});
|
|
2532
2533
|
}
|
|
@@ -2659,6 +2660,40 @@ var parseEllipse = (str) => {
|
|
|
2659
2660
|
};
|
|
2660
2661
|
};
|
|
2661
2662
|
var EllipseShapeSchema = z76.string().startsWith("E~").transform(parseEllipse).pipe(EllipseShapeOutputSchema);
|
|
2663
|
+
var ArcShapeOutputSchema = z76.object({
|
|
2664
|
+
type: z76.literal("ARC"),
|
|
2665
|
+
start: PointSchema2,
|
|
2666
|
+
end: PointSchema2,
|
|
2667
|
+
radius: z76.number(),
|
|
2668
|
+
sweepFlag: z76.boolean(),
|
|
2669
|
+
color: z76.string(),
|
|
2670
|
+
lineWidth: z76.number(),
|
|
2671
|
+
id: z76.string()
|
|
2672
|
+
});
|
|
2673
|
+
var parseArc = (str) => {
|
|
2674
|
+
const [, pathData, color, lineWidth, , , id] = str.split("~");
|
|
2675
|
+
const parts = pathData.split(" ");
|
|
2676
|
+
const x1 = Number(parts[1]) || 0;
|
|
2677
|
+
const y1 = Number(parts[2]) || 0;
|
|
2678
|
+
const radius = Number(parts[4]) || 0;
|
|
2679
|
+
const sweepFlag = parts[7] === "1";
|
|
2680
|
+
const x2 = Number(parts[8]) || 0;
|
|
2681
|
+
const y2 = Number(parts[9]) || 0;
|
|
2682
|
+
const parsedLineWidth = Number(lineWidth);
|
|
2683
|
+
const finalLineWidth = isNaN(parsedLineWidth) ? 1 : parsedLineWidth;
|
|
2684
|
+
return {
|
|
2685
|
+
type: "ARC",
|
|
2686
|
+
start: { x: x1, y: y1 },
|
|
2687
|
+
end: { x: x2, y: y2 },
|
|
2688
|
+
radius,
|
|
2689
|
+
sweepFlag,
|
|
2690
|
+
color: color || "#880000",
|
|
2691
|
+
// Default color
|
|
2692
|
+
lineWidth: finalLineWidth,
|
|
2693
|
+
id: id || "gge1"
|
|
2694
|
+
};
|
|
2695
|
+
};
|
|
2696
|
+
var ArcShapeSchema = z76.string().startsWith("A~").transform(parseArc).pipe(ArcShapeOutputSchema);
|
|
2662
2697
|
var PinShapeOutputSchema = z76.object({
|
|
2663
2698
|
type: z76.literal("PIN"),
|
|
2664
2699
|
visibility: z76.enum(["show", "hide"]),
|
|
@@ -2833,6 +2868,7 @@ var SingleLetterShapeSchema = z76.string().transform((x) => {
|
|
|
2833
2868
|
if (x.startsWith("PG~")) return PolygonShapeSchema.parse(x);
|
|
2834
2869
|
if (x.startsWith("PT~")) return PathShapeSchema.parse(x);
|
|
2835
2870
|
if (x.startsWith("T~")) return TextShapeSchema.parse(x);
|
|
2871
|
+
if (x.startsWith("A~")) return ArcShapeSchema.parse(x);
|
|
2836
2872
|
throw new Error(`Invalid shape type: ${x}`);
|
|
2837
2873
|
}).pipe(
|
|
2838
2874
|
z76.union([
|
|
@@ -2842,7 +2878,8 @@ var SingleLetterShapeSchema = z76.string().transform((x) => {
|
|
|
2842
2878
|
PolylineShapeOutputSchema,
|
|
2843
2879
|
PolygonShapeOutputSchema,
|
|
2844
2880
|
PathShapeOutputSchema,
|
|
2845
|
-
TextShapeOutputSchema
|
|
2881
|
+
TextShapeOutputSchema,
|
|
2882
|
+
ArcShapeOutputSchema
|
|
2846
2883
|
])
|
|
2847
2884
|
);
|
|
2848
2885
|
|
|
@@ -3244,4 +3281,4 @@ export {
|
|
|
3244
3281
|
convertRawEasyToTsx,
|
|
3245
3282
|
convertEasyEdaJsonToVariousFormats
|
|
3246
3283
|
};
|
|
3247
|
-
//# sourceMappingURL=chunk-
|
|
3284
|
+
//# sourceMappingURL=chunk-SMM32IOL.js.map
|