easyeda 0.0.280 → 0.0.282
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 +13 -15
- package/dist/browser/index.js.map +1 -1
- package/dist/index.js +13 -15
- package/dist/index.js.map +1 -1
- package/dist/main.cjs +14 -16
- package/dist/main.cjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -11673,10 +11673,11 @@ var isSwitchCategoryComponent = (betterEasy) => {
|
|
|
11673
11673
|
|
|
11674
11674
|
// lib/websafe/convert-to-typescript-component/generate-symbol-tsx.ts
|
|
11675
11675
|
var round = (value) => Number(value.toFixed(6));
|
|
11676
|
-
var
|
|
11676
|
+
var EASYEDA_SCHEMATIC_UNIT_TO_TSCIRCUIT_UNIT = 0.02;
|
|
11677
|
+
var toSchematicUnits = (value) => round(value * EASYEDA_SCHEMATIC_UNIT_TO_TSCIRCUIT_UNIT);
|
|
11677
11678
|
var getPointTransformer = (origin) => (point2) => ({
|
|
11678
|
-
x:
|
|
11679
|
-
y:
|
|
11679
|
+
x: toSchematicUnits(point2.x - origin.x),
|
|
11680
|
+
y: toSchematicUnits(origin.y - point2.y)
|
|
11680
11681
|
});
|
|
11681
11682
|
var formatNumber = (value) => String(round(value));
|
|
11682
11683
|
var SVG_PATH_COMMAND_PARAMETER_COUNTS = {
|
|
@@ -11781,8 +11782,8 @@ var transformSvgPath = (pathData, origin) => {
|
|
|
11781
11782
|
output.push(
|
|
11782
11783
|
[
|
|
11783
11784
|
"A",
|
|
11784
|
-
formatNumber(
|
|
11785
|
-
formatNumber(
|
|
11785
|
+
formatNumber(toSchematicUnits(Math.abs(values[0]))),
|
|
11786
|
+
formatNumber(toSchematicUnits(Math.abs(values[1]))),
|
|
11786
11787
|
formatNumber(-values[2]),
|
|
11787
11788
|
String(values[3]),
|
|
11788
11789
|
String(values[4] === 0 ? 1 : 0),
|
|
@@ -11806,15 +11807,12 @@ var getPinDirection = (rotation2) => {
|
|
|
11806
11807
|
var getPinStemLength = (path) => {
|
|
11807
11808
|
const segment = path.match(/[hHvV]\s*(-?(?:\d*\.\d+|\d+\.?))/);
|
|
11808
11809
|
if (!segment) return void 0;
|
|
11809
|
-
return
|
|
11810
|
+
return toSchematicUnits(Math.abs(Number(segment[1])));
|
|
11810
11811
|
};
|
|
11811
|
-
var
|
|
11812
|
+
var getTextFontSize = (fontSize) => {
|
|
11812
11813
|
const numericFontSize = Number.parseFloat(fontSize);
|
|
11813
|
-
if (!Number.isFinite(numericFontSize)) return
|
|
11814
|
-
|
|
11815
|
-
return round(numericFontSize * 25.4 / 72);
|
|
11816
|
-
}
|
|
11817
|
-
return toMillimeters(numericFontSize);
|
|
11814
|
+
if (!Number.isFinite(numericFontSize)) return 0.2;
|
|
11815
|
+
return toSchematicUnits(numericFontSize);
|
|
11818
11816
|
};
|
|
11819
11817
|
var getTextAnchor = (alignment) => {
|
|
11820
11818
|
if (alignment === "L") return "left";
|
|
@@ -11892,11 +11890,11 @@ var generateShapeTsx = ({
|
|
|
11892
11890
|
x: shape.position.x + shape.width / 2,
|
|
11893
11891
|
y: shape.position.y + shape.height / 2
|
|
11894
11892
|
});
|
|
11895
|
-
return `<schematicrect schX={${center.x}} schY={${center.y}} width={${
|
|
11893
|
+
return `<schematicrect schX={${center.x}} schY={${center.y}} width={${toSchematicUnits(shape.width)}} height={${toSchematicUnits(shape.height)}} color=${JSON.stringify(shape.color)}${shape.fillColor && shape.fillColor !== "none" ? ` isFilled fillColor=${JSON.stringify(shape.fillColor)}` : ""} />`;
|
|
11896
11894
|
}
|
|
11897
11895
|
if (shape.type === "ELLIPSE") {
|
|
11898
11896
|
const center = transformPoint(shape.center);
|
|
11899
|
-
return `<schematiccircle center={{ x: ${center.x}, y: ${center.y} }} radius={${
|
|
11897
|
+
return `<schematiccircle center={{ x: ${center.x}, y: ${center.y} }} radius={${toSchematicUnits(Math.max(shape.radiusX, shape.radiusY))}} color=${JSON.stringify(shape.color)}${shape.fillColor && shape.fillColor !== "none" ? ` isFilled fillColor=${JSON.stringify(shape.fillColor)}` : ""} />`;
|
|
11900
11898
|
}
|
|
11901
11899
|
if (shape.type === "POLYLINE" || shape.type === "POLYGON") {
|
|
11902
11900
|
const isPolygon = shape.type === "POLYGON";
|
|
@@ -11917,7 +11915,7 @@ var generateShapeTsx = ({
|
|
|
11917
11915
|
if (shape.type === "TEXT") {
|
|
11918
11916
|
if (shape.visibility !== "1") return void 0;
|
|
11919
11917
|
const position2 = transformPoint({ x: shape.x, y: shape.y });
|
|
11920
|
-
return `<schematictext schX={${position2.x}} schY={${position2.y}} text=${JSON.stringify(shape.content)} fontSize={${
|
|
11918
|
+
return `<schematictext schX={${position2.x}} schY={${position2.y}} text=${JSON.stringify(shape.content)} fontSize={${getTextFontSize(shape.fontSize)}} anchor=${JSON.stringify(getTextAnchor(shape.alignment))} color=${JSON.stringify(shape.fontColor)} schRotation={${round(-shape.rotation)}} />`;
|
|
11921
11919
|
}
|
|
11922
11920
|
if (shape.type === "PIN" && portMetadata) {
|
|
11923
11921
|
const position2 = transformPoint({ x: shape.x, y: shape.y });
|