… | |
… | |
448 | |
448 | |
449 | # translate global coordinates to local coordinate system |
449 | # translate global coordinates to local coordinate system |
450 | sub coord2local { |
450 | sub coord2local { |
451 | my ($self, $x, $y) = @_; |
451 | my ($self, $x, $y) = @_; |
452 | |
452 | |
453 | Carp::confess unless $self->{parent};#d# |
453 | return (undef, undef) unless $self->{parent}; |
454 | |
454 | |
455 | $self->{parent}->coord2local ($x - $self->{x}, $y - $self->{y}) |
455 | $self->{parent}->coord2local ($x - $self->{x}, $y - $self->{y}) |
456 | } |
456 | } |
457 | |
457 | |
458 | # translate local coordinates to global coordinate system |
458 | # translate local coordinates to global coordinate system |
459 | sub coord2global { |
459 | sub coord2global { |
460 | my ($self, $x, $y) = @_; |
460 | my ($self, $x, $y) = @_; |
461 | |
461 | |
462 | Carp::confess unless $self->{parent};#d# |
462 | return (undef, undef) unless $self->{parent}; |
463 | |
463 | |
464 | $self->{parent}->coord2global ($x + $self->{x}, $y + $self->{y}) |
464 | $self->{parent}->coord2global ($x + $self->{x}, $y + $self->{y}) |
465 | } |
465 | } |
466 | |
466 | |
467 | sub invoke_focus_in { |
467 | sub invoke_focus_in { |