@@ -524,7 +524,9 @@ def dip_svg(component, pins)
524524 fill : "none" , stroke : @colors [ :dip_notch ] , stroke_width : 0.8 )
525525 pins . each do |pin , hole |
526526 display = display_hole ( hole )
527- out << text ( px ( display . x ) , py ( display . y ) + ( display . y > 4 ? 4 : -2 ) , pin . number , "font-size" => 3.5 , "text-anchor" => "middle" )
527+ number = text ( px ( display . x ) , py ( display . y ) + ( display . y > 4 ? 4 : -2 ) , pin . number ,
528+ "font-size" => 3.5 , "text-anchor" => "middle" )
529+ out << %(<g data-dip-pin="#{ escape ( component . ref ) } .#{ escape ( pin . name ) } "><title>Pin #{ escape ( pin . number ) } : #{ escape ( pin . name ) } </title>#{ number } </g>)
528530 end
529531 out . join
530532 end
@@ -1005,6 +1007,11 @@ def legend_svg
10051007 out << text ( x + 15 , y , net . name , "font-size" => 5.5 )
10061008 y += 9
10071009 end
1010+ dip_pin_map_lines . each do |pin_line |
1011+ out << text ( x , y , pin_line , "font-size" => 5.5 )
1012+ y += 7
1013+ end
1014+ y += 2 unless dip_pin_map_lines . empty?
10081015 end
10091016 @annotations . each_with_index do |item , index |
10101017 message = read ( item , "message" ) || read ( item , "rule" )
@@ -1045,6 +1052,13 @@ def legend_nets
10451052 @nets . select { |net | visible_net? ( net ) && !( net . members . length == 1 && net . holes . empty? ) }
10461053 end
10471054
1055+ def dip_pin_map_lines
1056+ @visible_components . select { |component | component . part . data . dig ( "render" , "shape" ) == "dip" } . flat_map do |component |
1057+ names = component . pins . values . sort_by { |pin | pin . number . to_i } . map { |pin | "#{ pin . number } #{ pin . name } " }
1058+ annotation_lines ( "#{ component . ref } pins: #{ names . join ( ' · ' ) } " )
1059+ end
1060+ end
1061+
10481062 def annotations_svg
10491063 badge_counts = Hash . new ( 0 )
10501064 @annotations . each_with_index . map do |item , index |
@@ -1247,7 +1261,7 @@ def view_box(mode)
12471261 def legend_height
12481262 return 0 unless @legend_enabled || !@annotations . empty?
12491263
1250- 20 + ( @legend_enabled ? legend_nets . length * 9 : 0 ) +
1264+ 20 + ( @legend_enabled ? legend_nets . length * 9 + dip_pin_map_lines . length * 7 + ( dip_pin_map_lines . empty? ? 0 : 2 ) : 0 ) +
12511265 @annotations . each_with_index . sum { |item , index | annotation_lines ( "#{ index + 1 } . #{ read ( item , "message" ) || read ( item , "rule" ) } " ) . length * 7 + 2 }
12521266 end
12531267
0 commit comments