circuit-json-to-kicad 0.0.11 → 0.0.12

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.
Files changed (2) hide show
  1. package/dist/index.js +12 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -432,13 +432,23 @@ var AddLibrarySymbolsStage = class extends ConverterStage {
432
432
  }
433
433
  const scaleMatrix = createScaleMatrix(symbolScale, symbolScale);
434
434
  const scaled = applyToPoint(scaleMatrix, { x: dx, y: dy });
435
+ let isHorizontalPin;
436
+ if (isChip && size) {
437
+ const halfWidth = size.width / 2;
438
+ const halfHeight = size.height / 2;
439
+ const normalizedDx = Math.abs(dx) / halfWidth;
440
+ const normalizedDy = Math.abs(dy) / halfHeight;
441
+ isHorizontalPin = normalizedDx > normalizedDy;
442
+ } else {
443
+ isHorizontalPin = Math.abs(dx) > Math.abs(dy);
444
+ }
435
445
  let x = scaled.x;
436
446
  let y = scaled.y;
437
447
  const chipPinLength = 6;
438
448
  if (isChip && size) {
439
449
  const halfWidth = size.width / 2 * symbolScale;
440
450
  const halfHeight = size.height / 2 * symbolScale;
441
- if (Math.abs(dx) > Math.abs(dy)) {
451
+ if (isHorizontalPin) {
442
452
  x = dx > 0 ? halfWidth : -halfWidth;
443
453
  y = dy * symbolScale;
444
454
  } else {
@@ -447,7 +457,7 @@ var AddLibrarySymbolsStage = class extends ConverterStage {
447
457
  }
448
458
  }
449
459
  let angle = 0;
450
- if (Math.abs(dx) > Math.abs(dy)) {
460
+ if (isHorizontalPin) {
451
461
  if (dx > 0) {
452
462
  if (isChip) {
453
463
  angle = 180;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "circuit-json-to-kicad",
3
3
  "main": "dist/index.js",
4
- "version": "0.0.11",
4
+ "version": "0.0.12",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"