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.446 by root, Sun Dec 16 00:21:58 2007 UTC vs.
Revision 1.452 by root, Wed Dec 26 20:09:38 2007 UTC

16our $TOOLTIP; 16our $TOOLTIP;
17our $BUTTON_STATE; 17our $BUTTON_STATE;
18 18
19our %WIDGET; # all widgets, weak-referenced 19our %WIDGET; # all widgets, weak-referenced
20 20
21our $TOOLTIP_WATCHER = EV::timer_ns 0, 1/60, sub { 21our $TOOLTIP_WATCHER = EV::timer_ns 0, 0.03, sub {
22 $_[0]->stop; 22 $_[0]->stop;
23 23
24 if (!$GRAB) { 24 if (!$GRAB) {
25 for (my $widget = $HOVER; $widget; $widget = $widget->{parent}) { 25 for (my $widget = $HOVER; $widget; $widget = $widget->{parent}) {
26 if (length $widget->{tooltip}) { 26 if (length $widget->{tooltip}) {
338sub hide { 338sub hide {
339 my ($self) = @_; 339 my ($self) = @_;
340 340
341 $self->set_invisible; 341 $self->set_invisible;
342 342
343 # extra $parent copy for 5.8.8+ bug workaround
344 # (otherwise $_[0] in remove gets freed
345 if (my $parent = $self->{parent}) {
343 $self->{parent}->remove ($self) 346 $parent->remove ($self);
344 if $self->{parent}; 347 }
345} 348}
346 349
347sub move_abs { 350sub move_abs {
348 my ($self, $x, $y, $z) = @_; 351 my ($self, $x, $y, $z) = @_;
349 352
3673 ); 3676 );
3674 3677
3675 if ($self->{anim} && $self->{animspeed}) { 3678 if ($self->{anim} && $self->{animspeed}) {
3676 CFPlus::weaken (my $widget = $self); 3679 CFPlus::weaken (my $widget = $self);
3677 3680
3678 $widget->{animspeed} = List::Util::max 0.05, $widget->{animspeed}; 3681 $self->{animspeed} = List::Util::max 0.05, $self->{animspeed};
3679 $widget->{anim_start} = $self->{animspeed} * int EV::now / $self->{animspeed}; 3682 $self->{timer} = EV::periodic_ns 0, $self->{animspeed}, undef, sub {
3680 $self->{timer} = EV::timer_ns 0, 0, sub {
3681 return unless $::CONN; 3683 return unless $::CONN;
3682 3684
3683 my $w = $widget 3685 my $w = $widget
3684 or return; 3686 or return;
3685 3687
3702 my ($self) = @_; 3704 my ($self) = @_;
3703 3705
3704 return unless $self->{timer}; 3706 return unless $self->{timer};
3705 3707
3706 if ($self->{visible}) { 3708 if ($self->{visible}) {
3707 $self->{timer}->set (
3708 $self->{anim_start}
3709 + $self->{animspeed}
3710 * int 1.5 + (EV::now - $self->{anim_start}) / $self->{animspeed}
3711 );
3712 $self->{timer}->start; 3709 $self->{timer}->start;
3713 } else { 3710 } else {
3714 $self->{timer}->stop; 3711 $self->{timer}->stop;
3715 } 3712 }
3716} 3713}
4369} 4366}
4370 4367
4371sub update { 4368sub update {
4372 my ($self) = @_; 4369 my ($self) = @_;
4373 4370
4374 $::WANT_REFRESH->start; 4371 $::WANT_REFRESH = 1;
4375} 4372}
4376 4373
4377sub add { 4374sub add {
4378 my ($self, @children) = @_; 4375 my ($self, @children) = @_;
4379 4376

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines