Changeset 5245


Ignore:
Timestamp:
Apr 15, 2015, 11:06:07 AM (5 years ago)
Author:
mmh
Message:

if there is no space to place a bolloon to the right, put it above

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/uq/gui/scripts/balloon.tcl

    r5222 r5245  
    179179            if {$px < 0} { set pw [expr {$pw+$px}]; set px 0 }
    180180        }
    181         right {
    182             set sx $x
    183             set sy [expr {$y-$sh/2}]
    184             set px [expr {$x+$sw-3}]
    185             set py [expr {$y-$ph/2}]
    186 
    187             # make sure that the panel doesn't go off-screen
    188             if {$py < 0} { set py 0 }
    189             if {$py+$ph > $screenh} { set py [expr {$screenh-$ph}] }
    190             if {$px+$pw > $screenw} { set pw [expr {$screenw-$px}] }
    191         }
     181        right -
    192182        above {
    193             set sx [expr {$x-$sw/2}]
    194             set sy [expr {$y-$sh+3}]
    195             set px [expr {$x-$pw/2}]
    196             set py [expr {$sy-$ph+3}]
    197 
    198             # make sure that the panel doesn't go off-screen
    199             if {$px < 0} { set px 0 }
    200             if {$px+$pw > $screenw} { set px [expr {$screenw-$pw}] }
    201             if {$py < 0} { set ph [expr {$ph+$py}]; set py 0 }
     183            if {$placement == "right"} {
     184                set sx $x
     185                set sy [expr {$y-$sh/2}]
     186                set px [expr {$x+$sw-3}]
     187                set py [expr {$y-$ph/2}]
     188
     189                # make sure that the panel doesn't go off-screen
     190                if {$py < 0} { set py 0 }
     191                if {$py+$ph > $screenh} { set py [expr {$screenh-$ph}] }
     192                if {$px+$pw > $screenw} { set placement above }
     193            }
     194            if {$placement == "above"} {
     195                set sx [expr {$x-$sw/2}]
     196                set sy [expr {$y-$sh+3}]
     197                set px [expr {$x-$pw/2}]
     198                set py [expr {$sy-$ph+3}]
     199
     200                # make sure that the panel doesn't go off-screen
     201                if {$px < 0} { set px 0 }
     202                if {$px+$pw > $screenw} { set px [expr {$screenw-$pw}] }
     203                if {$py < 0} { set ph [expr {$ph+$py}]; set py 0 }
     204            }
    202205        }
    203206        below {
Note: See TracChangeset for help on using the changeset viewer.