<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -159,6 +159,10 @@ module Bio::Graphics
       end      
       @format = fmt
     end
+
+    def pixel_position(pos)
+      (pos - self.lend) / self.rescale_factor
+    end
     
     # Adds a Bio::Graphics::Track container to this panel. A panel contains a
     # logical grouping of features, e.g. (for sequence annotation:) genes,</diff>
      <filename>lib/bio/graphics/panel.rb</filename>
    </modified>
    <modified>
      <diff>@@ -42,36 +42,38 @@ class Bio::Graphics::SubFeature
     @hidden_subfeatures_at_start = false
     @hidden_subfeatures_at_stop = false
 
+    panel = @feature.track.panel
+    
     # Get all pixel ranges for the subfeatures
     @locations.each do |l|
       #   xxxxxx  [          ]
-      if l.to &lt; @feature.track.panel.lend
+      if l.to &lt; panel.lend
         @hidden_subfeatures_at_start = true
         next
       #           [          ]   xxxxx
-      elsif l.from &gt; @feature.track.panel.rend
+      elsif l.from &gt; panel.rend
         @hidden_subfeatures_at_stop = true
         next
       #      xxxx[xxx       ]
-      elsif l.from &lt; @feature.track.panel.lend and l.to &gt; @feature.track.panel.lend
+      elsif l.from &lt; panel.lend and l.to &gt; panel.lend
         start_pixel = 1
-        stop_pixel = ( l.to - @feature.track.panel.lend ).to_f / @feature.track.panel.rescale_factor
+        stop_pixel = panel.pixel_position(l.to)
         @chopped_at_start = true
       #          [      xxxx]xxxx
-      elsif l.from &lt; @feature.track.panel.rend and l.to &gt; @feature.track.panel.rend
-        start_pixel = ( l.from - @feature.track.panel.lend ).to_f / @feature.track.panel.rescale_factor
-        stop_pixel = @feature.track.panel.width
+      elsif l.from &lt; panel.rend and l.to &gt; panel.rend
+        start_pixel = panel.pixel_position(l.from)
+        stop_pixel = panel.width
         @chopped_at_stop = true
       #      xxxx[xxxxxxxxxx]xxxx
-      elsif l.from &lt; @feature.track.panel.lend and l.to &gt; @feature.track.panel.rend
+      elsif l.from &lt; panel.lend and l.to &gt; panel.rend
         start_pixel = 1
-        stop_pixel = @feature.track.panel.width
+        stop_pixel = panel.width
         @chopped_at_start = true
         @chopped_at_stop = true
       #          [   xxxxx  ]
       else
-        start_pixel = ( l.from - @feature.track.panel.lend ).to_f / @feature.track.panel.rescale_factor
-        stop_pixel = ( l.to - @feature.track.panel.lend ).to_f / @feature.track.panel.rescale_factor
+        start_pixel = panel.pixel_position(l.from)
+        stop_pixel = panel.pixel_position(l.to)
       end
 
       @pixel_range_collection.push(Range.new(start_pixel, stop_pixel))</diff>
      <filename>lib/bio/graphics/subfeature.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b08f5639be09a25b7eae9ca322ce654c7fe87c29</id>
    </parent>
  </parents>
  <author>
    <name>Charles Comstock</name>
    <email>dgtized@gmail.com</email>
  </author>
  <url>http://github.com/jandot/bio-graphics/commit/9c67fa2ddb58dd9fc298b2ca9185752149a2e6dd</url>
  <id>9c67fa2ddb58dd9fc298b2ca9185752149a2e6dd</id>
  <committed-date>2008-08-21T05:46:55-07:00</committed-date>
  <authored-date>2008-07-22T14:55:44-07:00</authored-date>
  <message>added Panel.pixel_position for determining pixel offsets from a panel</message>
  <tree>db4f5bbc06b5d6f3e15a79ab21cc99a34ad68575</tree>
  <committer>
    <name>Jan Aerts</name>
    <email>jan.aerts@gmail.com</email>
  </committer>
</commit>
