easyeda 0.0.379 → 0.0.381

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/index.js CHANGED
@@ -14448,22 +14448,15 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
14448
14448
  const centerY = midY - h * Math.cos(angle) * centerDirection;
14449
14449
  const startAngle = Math.atan2(startY - centerY, startX - centerX);
14450
14450
  let endAngle = Math.atan2(endY - centerY, endX - centerX);
14451
- if (sweepFlag && endAngle > startAngle) {
14452
- endAngle -= 2 * Math.PI;
14453
- } else if (!sweepFlag && endAngle < startAngle) {
14451
+ if (sweepFlag && endAngle < startAngle) {
14454
14452
  endAngle += 2 * Math.PI;
14453
+ } else if (!sweepFlag && endAngle > startAngle) {
14454
+ endAngle -= 2 * Math.PI;
14455
14455
  }
14456
- if (!largeArcFlag && Math.abs(endAngle - startAngle) > Math.PI || largeArcFlag && Math.abs(endAngle - startAngle) < Math.PI) {
14457
- if (endAngle > startAngle) {
14458
- endAngle -= 2 * Math.PI;
14459
- } else {
14460
- endAngle += 2 * Math.PI;
14461
- }
14462
- }
14463
- const numPoints = Math.max(
14464
- 2,
14465
- Math.ceil(Math.abs(endAngle - startAngle) * radius)
14466
- );
14456
+ const arcAngle = Math.abs(endAngle - startAngle);
14457
+ const minNumPoints = Math.max(2, Math.ceil(arcAngle * radius));
14458
+ const isSemicircle = Math.abs(arcAngle - Math.PI) < 1e-6;
14459
+ const numPoints = isSemicircle ? minNumPoints + minNumPoints % 2 : minNumPoints;
14467
14460
  const path = [];
14468
14461
  for (let i = 0; i <= numPoints; i++) {
14469
14462
  const t = i / numPoints;
@@ -17445,9 +17438,11 @@ var generateFootprintTsx = (circuitJson, options = {}) => {
17445
17438
  elementStrings.push(
17446
17439
  `<hole pcbX="${mmStr(hole.x)}" pcbY="${mmStr(hole.y)}" diameter="${mmStr(hole.hole_diameter)}" />`
17447
17440
  );
17448
- } else if (hole.hole_shape === "oval") {
17441
+ } else if (hole.hole_shape === "oval" || hole.hole_shape === "rect" || hole.hole_shape === "pill" || hole.hole_shape === "rotated_pill") {
17442
+ const shape = hole.hole_shape === "rotated_pill" ? "pill" : hole.hole_shape;
17443
+ const rotationAttr = hole.hole_shape === "rotated_pill" ? getRotationAttr(hole.ccw_rotation) : "";
17449
17444
  elementStrings.push(
17450
- `<hole pcbX="${mmStr(hole.x)}" pcbY="${mmStr(hole.y)}" width="${mmStr(hole.hole_width)}" height="${mmStr(hole.hole_height)}" shape="oval" />`
17445
+ `<hole pcbX="${mmStr(hole.x)}" pcbY="${mmStr(hole.y)}" width="${mmStr(hole.hole_width)}" height="${mmStr(hole.hole_height)}" shape="${shape}"${rotationAttr} />`
17451
17446
  );
17452
17447
  }
17453
17448
  }