# File lib/bio/graphics/ruler.rb, line 66
  def draw(panel_drawing)
    ruler_drawing = Cairo::Context.new(panel_drawing)

    # Draw line
    ruler_drawing.move_to(0,10)
    ruler_drawing.line_to(@panel.width, 10)
    ruler_drawing.stroke

    # Draw ticks and vertical grid lines
    self.first_tick_position.step(@panel.display_stop, @minor_tick_distance) do |tick|
      tick_pixel_position = ((tick - @panel.display_start) / @panel.rescale_factor).floor
      ruler_drawing.move_to(tick_pixel_position, @min_pixels_per_tick)
      if tick.modulo(@major_tick_distance) == 0 # major tick
        tick(ruler_drawing,3*@tick_height)
        grid_line(ruler_drawing, tick_pixel_position)        
        tick_number(ruler_drawing,tick_pixel_position,tick)
      else # minor tick
        tick(ruler_drawing,@tick_height)        
        grid_line(ruler_drawing, tick_pixel_position, 0.5)
      end
      ruler_drawing.stroke
    end

    @height = 5*@tick_height + @tick_text_height          
  end