From 065d186a92a1e87120e32d6b6894f985eb5d1b2a Mon Sep 17 00:00:00 2001 From: Slavi Karaslavov Date: Sat, 27 Jul 2024 17:18:53 +0300 Subject: [PATCH 1/4] add schWidth property --- .../builder/component-builder/BugBuilder.ts | 69 +++++++++---------- .../bug-with-width-resizing.test.tsx | 48 +++++++++++++ 2 files changed, 81 insertions(+), 36 deletions(-) create mode 100644 tests/bug-builder/bug-with-width-resizing.test.tsx diff --git a/src/lib/builder/component-builder/BugBuilder.ts b/src/lib/builder/component-builder/BugBuilder.ts index 2e2df37f..ad7c7701 100644 --- a/src/lib/builder/component-builder/BugBuilder.ts +++ b/src/lib/builder/component-builder/BugBuilder.ts @@ -28,14 +28,13 @@ export interface BugBuilder extends BaseComponentBuilder { properties: Except< SourceSimpleBugInput, "type" | "source_component_id" | "ftype" | "name" - > & { name?: string } + > & { name?: string, schWidth?: number } ): BugBuilder } export class BugBuilderClass extends ComponentBuilderClass - implements BugBuilder -{ + implements BugBuilder { builder_type = "bug_builder" as const constructor(project_builder: ProjectBuilder) { @@ -55,6 +54,19 @@ export class BugBuilderClass return this } + private adjustPortPositions(portArrangement: any, schWidth: number, originalWidth: number) { + const scaleFactor = schWidth / originalWidth + const adjustedArrangement = { ...portArrangement } + + for (const side in adjustedArrangement) { + if (side === 'left' || side === 'right') { + adjustedArrangement[side] = adjustedArrangement[side].map((y: number) => y * scaleFactor) + } + } + + return adjustedArrangement + } + async build(bc): Promise { const elements: Type.AnyElement[] = [] const { project_builder } = this @@ -73,23 +85,10 @@ export class BugBuilderClass } elements.push(source_component) - let port_arrangement: PortArrangement = - this.schematic_properties?.port_arrangement - - /** This can be used as a fallback if pinLabels or a port arrangement aren't explicitly given */ - const footprintPinLabels = this.footprint.getFootprintPinLabels() - const footprintPinCount = Object.entries(footprintPinLabels).length + const port_arrangement = this.schematic_properties?.port_arrangement if (!port_arrangement) { - if (footprintPinCount === 0) { - throw new Error( - "port_arrangement/schPortArrangement is required when building a without a footprint (footprint has no pins)" - ) - } - port_arrangement = { - left_size: Math.floor(footprintPinCount / 2 + 0.500001), - right_size: Math.floor(footprintPinCount / 2), - } + throw new Error("port_arrangement is required when building a ") } const pin_spacing = @@ -101,13 +100,18 @@ export class BugBuilderClass const port_arrangement_size = getPortArrangementSize( extended_port_arrangement ) + + const schWidth = this.source_properties.schWidth || port_arrangement_size.width - pin_spacing + const originalWidth = port_arrangement_size.width - pin_spacing + const adjustedPortArrangement = this.adjustPortPositions(port_arrangement, schWidth, originalWidth) + const schematic_component: Soup.SchematicComponent = { type: "schematic_component", source_component_id, schematic_component_id, rotation: this.schematic_rotation ?? 0, size: { - width: port_arrangement_size.width - pin_spacing, + width: schWidth, height: port_arrangement_size.height - pin_spacing, }, center: this.schematic_position || { x: 0, y: 0 }, @@ -122,22 +126,19 @@ export class BugBuilderClass const textElements: SchematicText[] = [] // add ports based on port arrangement and give appropriate labels - let { port_labels } = this.schematic_properties + const { port_labels } = this.schematic_properties + const { total_ports } = port_arrangement_size if (!port_labels) { - if (footprintPinCount === 0) { - throw new Error( - "port_labels/pinLabels is required when building a without a footprint (footprint has no pins)" - ) - } - - port_labels = footprintPinLabels - debug("inferring port_labels from footprint pin labels") + throw new Error("port_labels is required when building a ") } - const port_indices = getPortIndices(port_arrangement) + const port_indices = getPortIndices(adjustedPortArrangement) for (const pn of port_indices) { - const portPosition = getPortPosition(extended_port_arrangement, pn) + const portPosition = getPortPosition({ + ...adjustedPortArrangement, + pin_spacing: this.schematic_properties.pin_spacing, + }, pn) this.ports.addPort({ name: port_labels[pn], pin_number: pn, @@ -155,9 +156,7 @@ export class BugBuilderClass schematic_component_id, text: port_labels[pn], anchor: is_left ? "left" : "right", - rotation: 0, - position: { x: portPosition.x + (is_left ? 0.8 : -0.8) * pin_spacing, y: portPosition.y, @@ -173,7 +172,6 @@ export class BugBuilderClass text: port_labels[pn], anchor: "right", rotation: Math.PI / 2, - position: { x: portPosition.x, y: portPosition.y - 0.4, @@ -189,7 +187,6 @@ export class BugBuilderClass text: port_labels[pn], anchor: "left", rotation: Math.PI / 2, - position: { x: portPosition.x, y: portPosition.y + 0.4, @@ -221,7 +218,7 @@ export class BugBuilderClass const footprint_elements = await this.footprint.build(bc) for (const fe of footprint_elements) { - ;(fe as any).pcb_component_id = pcb_component_id + ; (fe as any).pcb_component_id = pcb_component_id } this._computeSizeOfPcbElement(pcb_component, footprint_elements as any) @@ -248,4 +245,4 @@ export const createBugBuilder = ( project_builder: ProjectBuilder ): BugBuilder => { return new BugBuilderClass(project_builder) -} +} \ No newline at end of file diff --git a/tests/bug-builder/bug-with-width-resizing.test.tsx b/tests/bug-builder/bug-with-width-resizing.test.tsx new file mode 100644 index 00000000..276e0dd9 --- /dev/null +++ b/tests/bug-builder/bug-with-width-resizing.test.tsx @@ -0,0 +1,48 @@ +import test from "ava" +import { getTestFixture } from "../fixtures/get-test-fixture" + +test("bug with width resizing", async (t) => { + const { logSoup, pb } = await getTestFixture(t) + + const soup = await pb + .add("board", (board) => + board + .setProps({ + pcbX: 0, + pcbY: 0, + width: 10, + height: 10, + }) + .add("bug", (bug) => + bug.setProps({ + schPinLabels: { + 1: "P1", + 2: "P2", + 3: "P3", + 4: "P4", + 5: "P5", + 6: "P6", + 7: "P7", + 8: "P8", + }, + schPortArrangement: { + leftSize: 4, + rightSize: 4, + }, + pcbRotation: "90deg", + cadModel: { + objUrl: + "https://modelcdn.tscircuit.com/easyeda_models/download?pn=C128415&uuid=dc694c23844346e9981bdbac7bb76421", + }, + footprint: "soic8_w7.2mm", + pcbX: 3, + pcbY: 3, + schWidth: 1, + }) + ) + ) + .build() + + await logSoup(soup) + t.pass() +}) \ No newline at end of file From 25e1c7982d36501d81982831b7cb7d6cc67a8851 Mon Sep 17 00:00:00 2001 From: tscircuitbot Date: Sat, 27 Jul 2024 14:20:58 +0000 Subject: [PATCH 2/4] formatbot: Automatically format code --- .../builder/component-builder/BugBuilder.ts | 42 +++++++++++++------ .../bug-with-width-resizing.test.tsx | 2 +- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/src/lib/builder/component-builder/BugBuilder.ts b/src/lib/builder/component-builder/BugBuilder.ts index ad7c7701..3f0b302b 100644 --- a/src/lib/builder/component-builder/BugBuilder.ts +++ b/src/lib/builder/component-builder/BugBuilder.ts @@ -28,13 +28,14 @@ export interface BugBuilder extends BaseComponentBuilder { properties: Except< SourceSimpleBugInput, "type" | "source_component_id" | "ftype" | "name" - > & { name?: string, schWidth?: number } + > & { name?: string; schWidth?: number } ): BugBuilder } export class BugBuilderClass extends ComponentBuilderClass - implements BugBuilder { + implements BugBuilder +{ builder_type = "bug_builder" as const constructor(project_builder: ProjectBuilder) { @@ -54,13 +55,19 @@ export class BugBuilderClass return this } - private adjustPortPositions(portArrangement: any, schWidth: number, originalWidth: number) { + private adjustPortPositions( + portArrangement: any, + schWidth: number, + originalWidth: number + ) { const scaleFactor = schWidth / originalWidth const adjustedArrangement = { ...portArrangement } for (const side in adjustedArrangement) { - if (side === 'left' || side === 'right') { - adjustedArrangement[side] = adjustedArrangement[side].map((y: number) => y * scaleFactor) + if (side === "left" || side === "right") { + adjustedArrangement[side] = adjustedArrangement[side].map( + (y: number) => y * scaleFactor + ) } } @@ -101,9 +108,15 @@ export class BugBuilderClass extended_port_arrangement ) - const schWidth = this.source_properties.schWidth || port_arrangement_size.width - pin_spacing + const schWidth = + this.source_properties.schWidth || + port_arrangement_size.width - pin_spacing const originalWidth = port_arrangement_size.width - pin_spacing - const adjustedPortArrangement = this.adjustPortPositions(port_arrangement, schWidth, originalWidth) + const adjustedPortArrangement = this.adjustPortPositions( + port_arrangement, + schWidth, + originalWidth + ) const schematic_component: Soup.SchematicComponent = { type: "schematic_component", @@ -135,10 +148,13 @@ export class BugBuilderClass const port_indices = getPortIndices(adjustedPortArrangement) for (const pn of port_indices) { - const portPosition = getPortPosition({ - ...adjustedPortArrangement, - pin_spacing: this.schematic_properties.pin_spacing, - }, pn) + const portPosition = getPortPosition( + { + ...adjustedPortArrangement, + pin_spacing: this.schematic_properties.pin_spacing, + }, + pn + ) this.ports.addPort({ name: port_labels[pn], pin_number: pn, @@ -218,7 +234,7 @@ export class BugBuilderClass const footprint_elements = await this.footprint.build(bc) for (const fe of footprint_elements) { - ; (fe as any).pcb_component_id = pcb_component_id + ;(fe as any).pcb_component_id = pcb_component_id } this._computeSizeOfPcbElement(pcb_component, footprint_elements as any) @@ -245,4 +261,4 @@ export const createBugBuilder = ( project_builder: ProjectBuilder ): BugBuilder => { return new BugBuilderClass(project_builder) -} \ No newline at end of file +} diff --git a/tests/bug-builder/bug-with-width-resizing.test.tsx b/tests/bug-builder/bug-with-width-resizing.test.tsx index 276e0dd9..f3fbee60 100644 --- a/tests/bug-builder/bug-with-width-resizing.test.tsx +++ b/tests/bug-builder/bug-with-width-resizing.test.tsx @@ -45,4 +45,4 @@ test("bug with width resizing", async (t) => { await logSoup(soup) t.pass() -}) \ No newline at end of file +}) From 2996fa4d34a8c07c97f7d2d2f38469cb67539bfe Mon Sep 17 00:00:00 2001 From: Slavi Karaslavov Date: Mon, 29 Jul 2024 08:57:07 +0300 Subject: [PATCH 3/4] change the location of schWidth --- .../builder/component-builder/BugBuilder.ts | 73 +++++-------------- .../builder/component-builder/remap-prop.ts | 3 +- src/lib/utils/get-port-position.ts | 14 ++-- .../bug-with-width-resizing.test.tsx | 2 +- 4 files changed, 30 insertions(+), 62 deletions(-) diff --git a/src/lib/builder/component-builder/BugBuilder.ts b/src/lib/builder/component-builder/BugBuilder.ts index 3f0b302b..3d97a158 100644 --- a/src/lib/builder/component-builder/BugBuilder.ts +++ b/src/lib/builder/component-builder/BugBuilder.ts @@ -8,15 +8,14 @@ import type { Except } from "type-fest" import getPortPosition, { DEFAULT_PIN_SPACING, getPortArrangementSize, - getPortIndices, - type PortArrangement, + getPortIndices } from "../../utils/get-port-position" import { associatePcbPortsWithPads } from "../footprint-builder/associate-pcb-ports-with-pads" import type { ProjectBuilder } from "../project-builder" import { transformSchematicElements } from "../transform-elements" import { - ComponentBuilderClass, type BaseComponentBuilder, + ComponentBuilderClass, } from "./ComponentBuilder" const debug = Debug("tscircuit:builder:bug-builder") @@ -28,14 +27,13 @@ export interface BugBuilder extends BaseComponentBuilder { properties: Except< SourceSimpleBugInput, "type" | "source_component_id" | "ftype" | "name" - > & { name?: string; schWidth?: number } + > & { name?: string, schWidth?: number } ): BugBuilder } export class BugBuilderClass extends ComponentBuilderClass - implements BugBuilder -{ + implements BugBuilder { builder_type = "bug_builder" as const constructor(project_builder: ProjectBuilder) { @@ -44,7 +42,7 @@ export class BugBuilderClass ...this.source_properties, ftype: "simple_bug", } - this.settable_schematic_properties.push("port_labels", "port_arrangement") + this.settable_schematic_properties.push("port_labels", "port_arrangement", "pin_spacing", "schWidth") } setSourceProperties(props) { @@ -55,23 +53,12 @@ export class BugBuilderClass return this } - private adjustPortPositions( - portArrangement: any, - schWidth: number, - originalWidth: number - ) { - const scaleFactor = schWidth / originalWidth - const adjustedArrangement = { ...portArrangement } - - for (const side in adjustedArrangement) { - if (side === "left" || side === "right") { - adjustedArrangement[side] = adjustedArrangement[side].map( - (y: number) => y * scaleFactor - ) - } + setSchematicProperties(props) { + this.schematic_properties = { + ...this.schematic_properties, + ...props, } - - return adjustedArrangement + return this } async build(bc): Promise { @@ -100,23 +87,14 @@ export class BugBuilderClass const pin_spacing = this.schematic_properties?.pin_spacing ?? DEFAULT_PIN_SPACING + const extended_port_arrangement = { ...port_arrangement, pin_spacing: this.schematic_properties.pin_spacing, + schWidth: this.source_properties.schPortArrangement.schWidth, } - const port_arrangement_size = getPortArrangementSize( - extended_port_arrangement - ) - const schWidth = - this.source_properties.schWidth || - port_arrangement_size.width - pin_spacing - const originalWidth = port_arrangement_size.width - pin_spacing - const adjustedPortArrangement = this.adjustPortPositions( - port_arrangement, - schWidth, - originalWidth - ) + const port_arrangement_size = getPortArrangementSize(extended_port_arrangement) const schematic_component: Soup.SchematicComponent = { type: "schematic_component", @@ -124,8 +102,8 @@ export class BugBuilderClass schematic_component_id, rotation: this.schematic_rotation ?? 0, size: { - width: schWidth, - height: port_arrangement_size.height - pin_spacing, + width: port_arrangement_size.width, + height: port_arrangement_size.height, }, center: this.schematic_position || { x: 0, y: 0 }, ...this.schematic_properties, @@ -146,15 +124,9 @@ export class BugBuilderClass throw new Error("port_labels is required when building a ") } - const port_indices = getPortIndices(adjustedPortArrangement) + const port_indices = getPortIndices(extended_port_arrangement) for (const pn of port_indices) { - const portPosition = getPortPosition( - { - ...adjustedPortArrangement, - pin_spacing: this.schematic_properties.pin_spacing, - }, - pn - ) + const portPosition = getPortPosition(extended_port_arrangement, pn) this.ports.addPort({ name: port_labels[pn], pin_number: pn, @@ -234,7 +206,7 @@ export class BugBuilderClass const footprint_elements = await this.footprint.build(bc) for (const fe of footprint_elements) { - ;(fe as any).pcb_component_id = pcb_component_id + ; (fe as any).pcb_component_id = pcb_component_id } this._computeSizeOfPcbElement(pcb_component, footprint_elements as any) @@ -242,13 +214,6 @@ export class BugBuilderClass associatePcbPortsWithPads(elements) - // TODO use this standard method: - // matchPCBPortsWithFootprintAndMutate({ - // footprint_elements, - // pcb_ports: elements.filter((elm) => elm.type === "pcb_port"), - // source_ports: elements.filter((elm) => elm.type === "source_port"), - // } as any) - elements.push( ...this._getCadElements({ source_component_id, pcb_component }, bc) ) @@ -261,4 +226,4 @@ export const createBugBuilder = ( project_builder: ProjectBuilder ): BugBuilder => { return new BugBuilderClass(project_builder) -} +} \ No newline at end of file diff --git a/src/lib/builder/component-builder/remap-prop.ts b/src/lib/builder/component-builder/remap-prop.ts index fbd88d97..090f4a91 100644 --- a/src/lib/builder/component-builder/remap-prop.ts +++ b/src/lib/builder/component-builder/remap-prop.ts @@ -15,6 +15,7 @@ export const remapProp = (prop: string, val: any): [string, any] => { right_side: val.rightSide, top_side: val.topSide, bottom_side: val.bottomSide, + schWidth: val.schWidth, }), ] case "pcbX": @@ -48,4 +49,4 @@ export const remapProp = (prop: string, val: any): [string, any] => { default: return [prop, val] } -} +} \ No newline at end of file diff --git a/src/lib/utils/get-port-position.ts b/src/lib/utils/get-port-position.ts index 56df8ab9..f60d4cf2 100644 --- a/src/lib/utils/get-port-position.ts +++ b/src/lib/utils/get-port-position.ts @@ -26,6 +26,7 @@ export type PortArrangement = SideSizes | ExplicitPinMappingArrangement export type ExtendedPortArrangement = PortArrangement & { pin_spacing?: number + schWidth?: number } export const hasExplicitPinMapping = ( @@ -69,7 +70,7 @@ export const getNormalToExplicitPinMapping = ( if (!definedOrderNormal) { definedPins.reverse() } - for (let i = 0; i < definedPins.length; i++) { + for (let i = 0;i < definedPins.length;i++) { normal_to_explicit.push(definedPins[i]) } } @@ -82,7 +83,7 @@ export const getExplicitToNormalPinMapping = ( ): number[] => { const normal_to_explicit: number[] = getNormalToExplicitPinMapping(pa) const explicit_to_normal: number[] = [] - for (let i = 0; i < normal_to_explicit.length; i++) { + for (let i = 0;i < normal_to_explicit.length;i++) { explicit_to_normal[normal_to_explicit[i]] = i } return explicit_to_normal @@ -162,18 +163,19 @@ export const getPortArrangementSize = ( const total_ports = top_size + right_size + bottom_size + left_size - const width = Math.max( - // MIN_SIDE_DIST is multiplied by the ratio of pin spacing to create more - // square-like bugs + const calculatedWidth = Math.max( MIN_SIDE_DIST * (pinSpacing / DEFAULT_PIN_SPACING), (top_size + 1) * pinSpacing, (bottom_size + 1) * pinSpacing ) + + const width = port_arrangement.schWidth !== undefined ? port_arrangement.schWidth : calculatedWidth const height = Math.max( MIN_SIDE_DIST, (left_size + 1) * pinSpacing, (right_size + 1) * pinSpacing ) + return { width, height, total_ports } } @@ -257,4 +259,4 @@ export const getPortPosition = ( return { x, y, side } } -export default getPortPosition +export default getPortPosition \ No newline at end of file diff --git a/tests/bug-builder/bug-with-width-resizing.test.tsx b/tests/bug-builder/bug-with-width-resizing.test.tsx index f3fbee60..38e65148 100644 --- a/tests/bug-builder/bug-with-width-resizing.test.tsx +++ b/tests/bug-builder/bug-with-width-resizing.test.tsx @@ -28,6 +28,7 @@ test("bug with width resizing", async (t) => { schPortArrangement: { leftSize: 4, rightSize: 4, + schWidth: 2, }, pcbRotation: "90deg", cadModel: { @@ -37,7 +38,6 @@ test("bug with width resizing", async (t) => { footprint: "soic8_w7.2mm", pcbX: 3, pcbY: 3, - schWidth: 1, }) ) ) From 151485dc0014c4d7d85b1642b9bb79ea24e4c777 Mon Sep 17 00:00:00 2001 From: tscircuitbot Date: Mon, 29 Jul 2024 15:25:03 +0000 Subject: [PATCH 4/4] formatbot: Automatically format code --- package-lock.json | 4 ++-- .../builder/component-builder/BugBuilder.ts | 22 +++++++++++++------ .../builder/component-builder/remap-prop.ts | 2 +- src/lib/utils/get-port-position.ts | 11 ++++++---- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index e841f122..3284422b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@tscircuit/builder", - "version": "1.5.154", + "version": "1.5.155", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@tscircuit/builder", - "version": "1.5.154", + "version": "1.5.155", "license": "MIT", "dependencies": { "@lume/kiwi": "^0.1.0", diff --git a/src/lib/builder/component-builder/BugBuilder.ts b/src/lib/builder/component-builder/BugBuilder.ts index 3d97a158..c6672adc 100644 --- a/src/lib/builder/component-builder/BugBuilder.ts +++ b/src/lib/builder/component-builder/BugBuilder.ts @@ -8,7 +8,7 @@ import type { Except } from "type-fest" import getPortPosition, { DEFAULT_PIN_SPACING, getPortArrangementSize, - getPortIndices + getPortIndices, } from "../../utils/get-port-position" import { associatePcbPortsWithPads } from "../footprint-builder/associate-pcb-ports-with-pads" import type { ProjectBuilder } from "../project-builder" @@ -27,13 +27,14 @@ export interface BugBuilder extends BaseComponentBuilder { properties: Except< SourceSimpleBugInput, "type" | "source_component_id" | "ftype" | "name" - > & { name?: string, schWidth?: number } + > & { name?: string; schWidth?: number } ): BugBuilder } export class BugBuilderClass extends ComponentBuilderClass - implements BugBuilder { + implements BugBuilder +{ builder_type = "bug_builder" as const constructor(project_builder: ProjectBuilder) { @@ -42,7 +43,12 @@ export class BugBuilderClass ...this.source_properties, ftype: "simple_bug", } - this.settable_schematic_properties.push("port_labels", "port_arrangement", "pin_spacing", "schWidth") + this.settable_schematic_properties.push( + "port_labels", + "port_arrangement", + "pin_spacing", + "schWidth" + ) } setSourceProperties(props) { @@ -94,7 +100,9 @@ export class BugBuilderClass schWidth: this.source_properties.schPortArrangement.schWidth, } - const port_arrangement_size = getPortArrangementSize(extended_port_arrangement) + const port_arrangement_size = getPortArrangementSize( + extended_port_arrangement + ) const schematic_component: Soup.SchematicComponent = { type: "schematic_component", @@ -206,7 +214,7 @@ export class BugBuilderClass const footprint_elements = await this.footprint.build(bc) for (const fe of footprint_elements) { - ; (fe as any).pcb_component_id = pcb_component_id + ;(fe as any).pcb_component_id = pcb_component_id } this._computeSizeOfPcbElement(pcb_component, footprint_elements as any) @@ -226,4 +234,4 @@ export const createBugBuilder = ( project_builder: ProjectBuilder ): BugBuilder => { return new BugBuilderClass(project_builder) -} \ No newline at end of file +} diff --git a/src/lib/builder/component-builder/remap-prop.ts b/src/lib/builder/component-builder/remap-prop.ts index 090f4a91..309f5b44 100644 --- a/src/lib/builder/component-builder/remap-prop.ts +++ b/src/lib/builder/component-builder/remap-prop.ts @@ -49,4 +49,4 @@ export const remapProp = (prop: string, val: any): [string, any] => { default: return [prop, val] } -} \ No newline at end of file +} diff --git a/src/lib/utils/get-port-position.ts b/src/lib/utils/get-port-position.ts index f60d4cf2..e464e704 100644 --- a/src/lib/utils/get-port-position.ts +++ b/src/lib/utils/get-port-position.ts @@ -70,7 +70,7 @@ export const getNormalToExplicitPinMapping = ( if (!definedOrderNormal) { definedPins.reverse() } - for (let i = 0;i < definedPins.length;i++) { + for (let i = 0; i < definedPins.length; i++) { normal_to_explicit.push(definedPins[i]) } } @@ -83,7 +83,7 @@ export const getExplicitToNormalPinMapping = ( ): number[] => { const normal_to_explicit: number[] = getNormalToExplicitPinMapping(pa) const explicit_to_normal: number[] = [] - for (let i = 0;i < normal_to_explicit.length;i++) { + for (let i = 0; i < normal_to_explicit.length; i++) { explicit_to_normal[normal_to_explicit[i]] = i } return explicit_to_normal @@ -169,7 +169,10 @@ export const getPortArrangementSize = ( (bottom_size + 1) * pinSpacing ) - const width = port_arrangement.schWidth !== undefined ? port_arrangement.schWidth : calculatedWidth + const width = + port_arrangement.schWidth !== undefined + ? port_arrangement.schWidth + : calculatedWidth const height = Math.max( MIN_SIDE_DIST, (left_size + 1) * pinSpacing, @@ -259,4 +262,4 @@ export const getPortPosition = ( return { x, y, side } } -export default getPortPosition \ No newline at end of file +export default getPortPosition