easyeda 0.0.264 → 0.0.266
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.js +21 -6
- package/dist/browser/index.js.map +1 -1
- package/dist/index.js +21 -6
- package/dist/index.js.map +1 -1
- package/dist/main.cjs +22 -12
- package/dist/main.cjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5407,6 +5407,10 @@ var handleCutout = (solidRegion, index) => {
|
|
|
5407
5407
|
}))
|
|
5408
5408
|
});
|
|
5409
5409
|
};
|
|
5410
|
+
var LEAD_SHAPE_LAYER = 100;
|
|
5411
|
+
var isPcbSolidRegionCutout = (shape) => {
|
|
5412
|
+
return shape.fillStyle === "cutout" && shape.layermask !== LEAD_SHAPE_LAYER;
|
|
5413
|
+
};
|
|
5410
5414
|
var getCadPositionZMmFromMetadata = (easyEdaJson) => {
|
|
5411
5415
|
const svgNode = easyEdaJson.packageDetail.dataStr.shape.find(
|
|
5412
5416
|
(shape) => shape.type === "SVGNODE" && shape.svgData.attrs?.uuid
|
|
@@ -5564,7 +5568,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
|
|
|
5564
5568
|
} else if (pad.shape === "ELLIPSE") {
|
|
5565
5569
|
soupShape = "rect";
|
|
5566
5570
|
} else if (pad.shape === "OVAL") {
|
|
5567
|
-
soupShape = "
|
|
5571
|
+
soupShape = "pill";
|
|
5568
5572
|
} else if (pad.shape === "POLYGON") {
|
|
5569
5573
|
soupShape = "polygon";
|
|
5570
5574
|
}
|
|
@@ -5584,12 +5588,17 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
|
|
|
5584
5588
|
x: mil2mm(pad.center.x),
|
|
5585
5589
|
y: mil2mm(pad.center.y)
|
|
5586
5590
|
},
|
|
5587
|
-
...soupShape === "rect" ? rectSize : soupShape === "
|
|
5591
|
+
...soupShape === "rect" ? rectSize : soupShape === "pill" ? {
|
|
5592
|
+
...rectSize,
|
|
5593
|
+
radius: Math.min(rectSize.width, rectSize.height) / 2
|
|
5594
|
+
} : soupShape === "polygon" && pad.points ? {
|
|
5588
5595
|
points: pad.points.map((p) => ({
|
|
5589
5596
|
x: milx10(p.x),
|
|
5590
5597
|
y: milx10(p.y)
|
|
5591
5598
|
}))
|
|
5592
|
-
} : {
|
|
5599
|
+
} : {
|
|
5600
|
+
radius: Math.min(mil2mm(pad.width), mil2mm(pad.height)) / 2
|
|
5601
|
+
},
|
|
5593
5602
|
layer: "top",
|
|
5594
5603
|
port_hints: [`pin${pinNumber}`],
|
|
5595
5604
|
pcb_component_id: "pcb_component_1",
|
|
@@ -5608,7 +5617,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
|
|
|
5608
5617
|
circuitElements.push(handleVia(v, index));
|
|
5609
5618
|
});
|
|
5610
5619
|
easyEdaJson.packageDetail.dataStr.shape.filter(
|
|
5611
|
-
(shape) => shape.type === "SOLIDREGION" && shape
|
|
5620
|
+
(shape) => shape.type === "SOLIDREGION" && isPcbSolidRegionCutout(shape)
|
|
5612
5621
|
).forEach((sr, index) => {
|
|
5613
5622
|
circuitElements.push(handleCutout(sr, index));
|
|
5614
5623
|
});
|
|
@@ -5660,7 +5669,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
|
|
|
5660
5669
|
circuitElements.push(
|
|
5661
5670
|
pcb_silkscreen_text.parse({
|
|
5662
5671
|
type: "pcb_silkscreen_text",
|
|
5663
|
-
pcb_silkscreen_text_id:
|
|
5672
|
+
pcb_silkscreen_text_id: "pcb_silkscreen_text_designator_fallback",
|
|
5664
5673
|
pcb_component_id: "pcb_component_1",
|
|
5665
5674
|
text: "{NAME}",
|
|
5666
5675
|
anchor_position: {
|
|
@@ -6905,8 +6914,14 @@ var generateFootprintTsx = (circuitJson, options = {}) => {
|
|
|
6905
6914
|
`<smtpad portHints={${JSON.stringify(mapPortHints(smtPad.port_hints, options.portHintsMap))}} pcbX="${mmStr(smtPad.x)}" pcbY="${mmStr(smtPad.y)}" radius="${mmStr(smtPad.radius)}" shape="circle" />`
|
|
6906
6915
|
);
|
|
6907
6916
|
} else if (smtPad.shape === "rect") {
|
|
6917
|
+
const cornerRadius = smtPad.corner_radius ?? smtPad.rect_border_radius ?? void 0;
|
|
6918
|
+
const cornerRadiusAttr = cornerRadius !== void 0 ? ` cornerRadius="${mmStr(cornerRadius)}"` : "";
|
|
6919
|
+
elementStrings.push(
|
|
6920
|
+
`<smtpad portHints={${JSON.stringify(smtPad.port_hints)}} pcbX="${mmStr(smtPad.x)}" pcbY="${mmStr(smtPad.y)}" width="${mmStr(smtPad.width)}" height="${mmStr(smtPad.height)}"${cornerRadiusAttr} shape="rect" />`
|
|
6921
|
+
);
|
|
6922
|
+
} else if (smtPad.shape === "pill") {
|
|
6908
6923
|
elementStrings.push(
|
|
6909
|
-
`<smtpad portHints={${JSON.stringify(
|
|
6924
|
+
`<smtpad portHints={${JSON.stringify(smtPad.port_hints)}} pcbX="${mmStr(smtPad.x)}" pcbY="${mmStr(smtPad.y)}" width="${mmStr(smtPad.width)}" height="${mmStr(smtPad.height)}" radius="${mmStr(smtPad.radius)}" shape="pill" />`
|
|
6910
6925
|
);
|
|
6911
6926
|
} else if (smtPad.shape === "polygon") {
|
|
6912
6927
|
const pointsStr = smtPad.points.map((p) => `{x: "${mmStr(p.x)}", y: "${mmStr(p.y)}"}`).join(", ");
|