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.413 by root, Mon Jul 23 15:30:45 2007 UTC vs.
Revision 1.414 by root, Mon Jul 23 17:54:14 2007 UTC

953 $self->{view_x} = $x; 953 $self->{view_x} = $x;
954 $self->{view_y} = $y; 954 $self->{view_y} = $y;
955 955
956 $self->emit (changed => $x, $y); 956 $self->emit (changed => $x, $y);
957 $self->update; 957 $self->update;
958 }
959}
960
961sub set_center {
962 my ($self, $x, $y) = @_;
963
964 $self->set_offset ($x - $self->{w} * .5, $y - $self->{h} * .5);
965}
966
967sub make_visible {
968 my ($self, $x, $y, $border) = @_;
969
970 if ( $x < $self->{view_x} + $self->{w} * $border
971 || $x > $self->{view_x} + $self->{w} * (1 - $border)
972 || $y < $self->{view_y} + $self->{h} * $border
973 || $y > $self->{view_y} + $self->{h} * (1 - $border)
974 ) {
975 $self->set_center ($x, $y);
958 } 976 }
959} 977}
960 978
961# hmm, this does not work for topleft of $self... but we should not ask for that 979# hmm, this does not work for topleft of $self... but we should not ask for that
962sub coord2local { 980sub coord2local {
1074sub add { 1092sub add {
1075 my ($self, $widget) = @_; 1093 my ($self, $widget) = @_;
1076 1094
1077 $self->{vp}->add ($self->{child} = $widget); 1095 $self->{vp}->add ($self->{child} = $widget);
1078} 1096}
1097
1098sub set_offset { shift->{vp}->set_offset (@_) }
1099sub set_center { shift->{vp}->set_center (@_) }
1100sub make_visible { shift->{vp}->make_visible (@_) }
1079 1101
1080sub update_slider { 1102sub update_slider {
1081 my ($self) = @_; 1103 my ($self) = @_;
1082 1104
1083 my $child = ($self->{vp} or return)->child; 1105 my $child = ($self->{vp} or return)->child;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines