Changeset 2485 for trunk/gui


Ignore:
Timestamp:
Sep 6, 2011, 4:52:31 PM (13 years ago)
Author:
ldelgass
Message:

Fix requested legend height - leave 2 pixels between bottom of bar and vmin
label, use the correct font to get lineheight. Also fix off by one error in
computing value for legend mouseover (imgY is [0,height-1] to give t parameter
in [0,1] range).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/vtkviewer.tcl

    r2484 r2485  
    12831283    #puts stderr "RequestLegend _first=$_first"
    12841284    puts stderr "RequestLegend width=$_width height=$_height"
    1285     set lineht [font metrics $itk_option(-font) -linespace]
     1285    set font "Arial 8"
     1286    set lineht [font metrics $font -linespace]
    12861287    set c $itk_component(legend)
    12871288    set w 15
    1288     set h [expr {$_height - 2 * $lineht}]
     1289    set h [expr {$_height - 2 * ($lineht + 2)}]
    12891290    if { $h < 1} {
    12901291        return
     
    19151916
    19161917    # Compute the value of the point
    1917     set t [expr 1.0 - (double($imgY) / double($imgHeight))]
     1918    set t [expr 1.0 - (double($imgY) / double($imgHeight-1))]
    19181919    #puts stderr "t=$t x=$x y=$y"
    19191920    set value [expr $t * ($_limits(vmax) - $_limits(vmin)) + $_limits(vmin)]
Note: See TracChangeset for help on using the changeset viewer.