easyeda 0.0.305 → 0.0.306

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/main.cjs CHANGED
@@ -3528,7 +3528,7 @@ var import_promises = __toESM(require("fs/promises"), 1);
3528
3528
  var package_default = {
3529
3529
  name: "easyeda",
3530
3530
  type: "module",
3531
- version: "0.0.304",
3531
+ version: "0.0.305",
3532
3532
  files: [
3533
3533
  "dist"
3534
3534
  ],
@@ -9702,6 +9702,40 @@ var handleSilkscreenCircle = (circle, index) => {
9702
9702
  stroke_width: mil10ToMm(circle.width)
9703
9703
  });
9704
9704
  };
9705
+ var handleRect = (rect, index) => {
9706
+ const width = milx10(rect.width);
9707
+ const height = milx10(rect.height);
9708
+ const center = {
9709
+ x: milx10(rect.x) + width / 2,
9710
+ y: milx10(rect.y) + height / 2
9711
+ };
9712
+ const layer = getSideFromLayer(rect.layer);
9713
+ if (isCourtyardLayer(rect.layer)) {
9714
+ return pcb_courtyard_rect.parse({
9715
+ type: "pcb_courtyard_rect",
9716
+ pcb_courtyard_rect_id: `pcb_courtyard_rect_${index + 1}`,
9717
+ pcb_component_id: "pcb_component_1",
9718
+ center,
9719
+ width,
9720
+ height,
9721
+ layer,
9722
+ ccw_rotation: rect.rotation
9723
+ });
9724
+ }
9725
+ return pcb_silkscreen_rect.parse({
9726
+ type: "pcb_silkscreen_rect",
9727
+ pcb_silkscreen_rect_id: `pcb_silkscreen_rect_${index + 1}`,
9728
+ pcb_component_id: "pcb_component_1",
9729
+ center,
9730
+ width,
9731
+ height,
9732
+ layer,
9733
+ stroke_width: mil2mm(rect.lineWidth),
9734
+ is_filled: rect.fillStyle !== "none",
9735
+ has_stroke: rect.lineWidth > 0,
9736
+ ccw_rotation: rect.rotation
9737
+ });
9738
+ };
9705
9739
  var handleHole = (hole, index) => {
9706
9740
  return pcb_hole.parse({
9707
9741
  type: "pcb_hole",
@@ -9977,6 +10011,8 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
9977
10011
  if (isSilkscreenLayer(shape.layer)) {
9978
10012
  circuitElements.push(handleSilkscreenCircle(shape, index));
9979
10013
  }
10014
+ } else if (shape.type === "RECT") {
10015
+ circuitElements.push(handleRect(shape, index));
9980
10016
  } else if (shape.type === "ARC") {
9981
10017
  if (!isCourtyardLayer(shape.layer)) {
9982
10018
  circuitElements.push(handleSilkscreenArc(shape, index));
@@ -10034,7 +10070,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
10034
10070
  );
10035
10071
  }
10036
10072
  const pcbElements = circuitElements.filter(
10037
- (e) => e.type === "pcb_smtpad" || e.type === "pcb_plated_hole" || e.type === "pcb_hole" || e.type === "pcb_via" || e.type === "pcb_courtyard_outline" || e.type === "pcb_silkscreen_path" || e.type === "pcb_silkscreen_text"
10073
+ (e) => e.type === "pcb_smtpad" || e.type === "pcb_plated_hole" || e.type === "pcb_hole" || e.type === "pcb_via" || e.type === "pcb_courtyard_outline" || e.type === "pcb_courtyard_rect" || e.type === "pcb_silkscreen_path" || e.type === "pcb_silkscreen_rect" || e.type === "pcb_silkscreen_text"
10038
10074
  );
10039
10075
  if (pcbElements.length > 0) {
10040
10076
  const bounds = findBoundsAndCenter(pcbElements);