From a3cbcb1b0be1fdc5cfea4225b9df375ad89b96ef Mon Sep 17 00:00:00 2001 From: Thea Flowers Date: Sat, 28 Oct 2023 21:52:03 -0400 Subject: [PATCH] Copy schematic sheet pin's position during painting to avoid repeated modifications. Fixes #19. --- src/kicad/common.ts | 8 ++++++++ src/viewers/schematic/painter.ts | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/kicad/common.ts b/src/kicad/common.ts index d888f5e7..89842a11 100644 --- a/src/kicad/common.ts +++ b/src/kicad/common.ts @@ -88,6 +88,14 @@ export class At { this.unlocked = parsed.unlocked ?? this.unlocked; } } + + copy() { + const at = new At(); + at.position = this.position.copy(); + at.rotation = this.rotation; + at.unlocked = this.unlocked; + return at; + } } export const PaperSize = { diff --git a/src/viewers/schematic/painter.ts b/src/viewers/schematic/painter.ts index c3d2be62..47672a1e 100644 --- a/src/viewers/schematic/painter.ts +++ b/src/viewers/schematic/painter.ts @@ -551,7 +551,7 @@ class SchematicSheetPainter extends SchematicItemPainter { if (layer.name == LayerNames.label) { for (const pin of ss.pins) { const label = new schematic_items.HierarchicalLabel(); - label.at = pin.at; + label.at = pin.at.copy(); label.effects = pin.effects; label.text = pin.name; label.shape = pin.shape;