lib/rsyntaxtree/graph.rb
# Calculate the width of the element. If the element is
# a node, the calculation will be performed recursively
# for all child elements.

Calculate the width of the element. If the element is
a node, the calculation will be performed recursively
for all child elements.
Calculate the width of the element . If the element is a node the calculation will be performed recursively for all child elements .
def calc_element_width(e)
    w = 0
    children = @e_list.get_children(e.id)
    if(children.length == 0)
      w = img_get_txt_width(e.content, @font, @font_size) + @font_size
    else
      children.each do |child|
        child_e = @e_list.get_id(child)
        w += calc_element_width(child_e)
      end
      tw = img_get_txt_width(e.content, @font, @font_size) + @font_size
      if(tw > w)
        fix_child_size(e.id, w, tw)
        w = tw
      end
    end
    @e_list.set_element_width(e.id, w)
    return w
  end
def calc_element_width ( e ) w = 0 children = @e_list . get_children ( e . id ) if ( children . length == 0 ) w = img_get_txt_width ( e . content , @font , @font_size ) + @font_size else children . each do | child | child_e = @e_list . get_id ( child ) w += calc_element_width ( child_e ) end tw = img_get_txt_width ( e . content , @font , @font_size ) + @font_size if ( tw > w ) fix_child_size ( e . id , w , tw ) w = tw end end @e_list . set_element_width ( e . id , w ) return w end
Calculate the width of the element.
Calculate the width of the element .
e
<not_specific>