Commits

Martin Vejnár committed ce781bd

Fixed pin text spacing.

Comments (0)

Files changed (1)

             wire.x1, wire.y1, wire.x2, wire.y2 = p2[0] + pin.x, p2[1] + pin.y, p3[0] + pin.x, p3[1] + pin.y
             self.print_wire(wire)
 
+        shorten_wire = 0
         if (pin.function & pin.PIN_FUNCTION_FLAG_DOT) != 0 and pin.length >= 1:
             circle = Circle()
             circle.x, circle.y = _get_target(pin.x, pin.y, len-9906, pin.angle)
             circle.width = 1524/2
             circle.radius = 9906
             self.print_circle(circle)
-            len -= 9906*2
+            shorten_wire = 9906*2
 
         if pin.length >= 1:
             wire = Wire()
             wire.x1 = pin.x
             wire.y1 = pin.y
 
-            wire.x2, wire.y2 = _get_target(pin.x, pin.y, len, pin.angle)
+            wire.x2, wire.y2 = _get_target(pin.x, pin.y, len - shorten_wire, pin.angle)
 
             self.update_bb(wire.x1 - wire.width, wire.y1 - wire.width)
             self.update_bb(wire.x2 + wire.width, wire.y2 + wire.width)
 
         if pin.visible & pin.PIN_VISIBLE_FLAG_PIN:
             factor = 0.7
+            text_distance = 2540*15
             layer = self.root.layer_map[95]
             color = self.color_map[layer.color]
 
+            x, y = _get_target(pin.x, pin.y, len, pin.angle)
+
             if pin.angle == 0 or pin.angle == 1:
                 self.out.append("""<text x="%d" y="%d" fill="%s" font-size="%d">%s</text>""" % (
-                    wire.x2 + 2540 * 10 * factor, -wire.y2 + 7620 * factor, color, 2*15240 * factor, pin.name))
+                    x + text_distance * factor, -y + 7620 * factor, color, 2*15240 * factor, pin.name))
             elif pin.angle == 2 or pin.angle == 3:
                 self.out.append("""<text text-anchor="end" x="%d" y="%d" fill="%s" font-size="%d">%s</text>""" % (
-                    wire.x2 - 2540 * 10 * factor, -wire.y2 + 7620 * factor, color, 2*15240 * factor, pin.name))
+                    x - text_distance * factor, -y + 7620 * factor, color, 2*15240 * factor, pin.name))
 
 
     def print_text(self, text):