anchor.diff:    displayName : 'Histogram'
     mixins: [PageTransition] #implements animation logic when moving results <==> crafting
   
  -  getOpinionsInCurrentFocus : (ev, from_mouse_over) -> 
  -    all_opinions = fetch('/page/' + @proposal.slug).opinions || []
  +  getOpinionsInCurrentFocus : -> 
  +    # Filter to all opinions within selection area.
  +    # The opinion center is used to calculate which opinions are selected.
  +    # We'll show opinions within +/- filter_width of mouse_opinion_value.
  +    all_opinions = fetch('/page/' + @proposal.slug).opinions || []    
  +    selected_opinions = (o.key for o in all_opinions when o.stance <= @local.mouse_opinion_value + @filter_width && o.stance >= @local.mouse_opinion_value - @filter_width)
  +    selected_opinions
  +
  +  selectOpinions : (ev) ->
  +    ev.stopPropagation()
  +    hist = fetch 'histogram'
  +
  +    if @root.proposal_mode == 'crafting'
  +      togglePage('results', 'click_histogram')
  +
       # If the user has clicked on an avatar, we'll just filter to their opinion
  -    if ev.target.className.indexOf('avatar') != -1 && !from_mouse_over
  +    click_select_a_user = ev.type == 'click' && ev.target.className.indexOf('avatar') != -1 && !@local.dragging
  +    if click_select_a_user
         user_key = "/user/#{ev.target.getAttribute('id').substring(7, ev.target.getAttribute('id').length)}"
  +      all_opinions = fetch('/page/' + @proposal.slug).opinions || []
         selected_opinions = (o.key for o in all_opinions when o.user == user_key)
       else
  -      # Otherwise, we'll filter to a region of opinions
  -      # The opinion center is used to calculate which opinions are selected.
  -      # We'll show opinions within +/- filter_width of mouse_opinion_value.
  -      selected_opinions = (o.key for o in all_opinions when o.stance < @local.mouse_opinion_value + @filter_width && o.stance > @local.mouse_opinion_value - @filter_width)
  -
  -    selected_opinions
  -
  -  selectOpinions : (ev, via_drag) ->
  -    ev.stopPropagation()
  -    hist = fetch 'histogram'
  -
  -    if @root.proposal_mode == 'crafting'
  -      togglePage('results', 'click_histogram')
  -
  -    selected_opinions = @getOpinionsInCurrentFocus(ev, via_drag)
  +      selected_opinions = @getOpinionsInCurrentFocus()
   
       # Deselect if we've reclicked on same selection
  -    if !via_drag && 
  +    if !@local.dragging && 
           !@local.last_selection_via_drag && 
           (JSON.stringify(hist.selected_opinions) == JSON.stringify(selected_opinions) || 
             selected_opinions.length == 0)
  
positive.code:               avatar_style = selected_avatar_style
              else
                avatar_style = unselected_avatar_style
            else 
              avatar_style = regular_avatar_style
  
  
            Avatar 
              key: user
              user: user
              hide_face: @root.proposal_mode == 'crafting'
              hide_name: @root.proposal_mode == 'crafting' || @local.dragging
              style: avatar_style
  
  
negative.code:         position: 'relative'
  
        if @local.mousing_over_histogram && @root.proposal_mode == 'results'
          left = ((@local.mouse_opinion_value + 1)/2 - @filter_width/2) * BODY_WIDTH
          base_width = @filter_width * BODY_WIDTH
          DIV 
            style:
              height: HISTOGRAM_HEIGHT + segment_selection_margin
              position: 'absolute'
              width: Math.min(Math.min(base_width, base_width + left), BODY_WIDTH - left)
              backgroundColor: "rgb(248,248,248)"
              cursor: 'pointer'
              left: Math.max 0, left
              borderTop: "5px solid #{considerit_yellow}"
              top: 0
              pointerEvents: 'none'
  