ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/UI.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/UI.pm (file contents):
Revision 1.478 by root, Tue Dec 22 00:35:44 2009 UTC vs.
Revision 1.481 by root, Tue Oct 12 05:11:38 2010 UTC

1package DC::UI; 1package DC::UI;
2 2
3use utf8; 3use common::sense;
4use strict;
5 4
6use List::Util (); 5use List::Util ();
7 6
8use Guard (); 7use Guard ();
9 8
223 222
224############################################################################# 223#############################################################################
225 224
226package DC::UI::Base; 225package DC::UI::Base;
227 226
228use strict; 227use common::sense;
229 228
230use DC::OpenGL; 229use DC::OpenGL;
231 230
232sub new { 231sub new {
233 my $class = shift; 232 my $class = shift;
643 642
644package DC::UI::DrawBG; 643package DC::UI::DrawBG;
645 644
646our @ISA = DC::UI::Base::; 645our @ISA = DC::UI::Base::;
647 646
648use strict; 647use common::sense;
648
649use DC::OpenGL; 649use DC::OpenGL;
650 650
651sub new { 651sub new {
652 my $class = shift; 652 my $class = shift;
653 653
3054 3054
3055############################################################################# 3055#############################################################################
3056 3056
3057package DC::UI::Slider; 3057package DC::UI::Slider;
3058 3058
3059use strict; 3059use common::sense;
3060 3060
3061use DC::OpenGL; 3061use DC::OpenGL;
3062 3062
3063our @ISA = DC::UI::DrawBG::; 3063our @ISA = DC::UI::DrawBG::;
3064 3064
3150 if ($GRAB == $self) { 3150 if ($GRAB == $self) {
3151 my ($x, $w) = $self->{vertical} ? ($y, $self->{h}) : ($x, $self->{w}); 3151 my ($x, $w) = $self->{vertical} ? ($y, $self->{h}) : ($x, $self->{w});
3152 3152
3153 my (undef, $lo, $hi, $page) = @{$self->{range}}; 3153 my (undef, $lo, $hi, $page) = @{$self->{range}};
3154 3154
3155 $x = ($x - $self->{click}[1]) / ($w * $self->{scale}); 3155 $x = ($x - $self->{click}[1]) / ($w * $self->{scale} || 1e999);
3156 3156
3157 $self->set_value ($self->{click}[0] + $x * ($hi - $page - $lo)); 3157 $self->set_value ($self->{click}[0] + $x * ($hi - $page - $lo));
3158 } else { 3158 } else {
3159 return 0; 3159 return 0;
3160 } 3160 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines