Skip to content

Commit

Permalink
[Tufte/Helper/Canvas.pm] refactor remove methods and add some pods.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hongwen Qiu committed Aug 26, 2010
1 parent 566f18c commit c8ff6bb
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion lib/Tufte/Helper/Canvas.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ multi method index($id, @components=@!components) {
}

multi method remove($id, @components is rw =@!components) {
@components.splice($.index($id, @components), 1);
@components.delete($.index($id, @components));
}

# Converts percentage values into actual pixel values based on the known render size.
#
# Returns a hash consisting of x, y, width, and height elements.
multi method bounds_for(@canvas_size, @position, @size) {
return unless @position && @size;
return {
Expand All @@ -30,4 +33,16 @@ multi method bounds_for(@canvas_size, @position, @size) {
}
}

=begin pod
=head1 NAME
Tufte::Helper::Canvas - Provides common methods for canvas objects.
=head1 DESCRIPTION
Provides common methods for canvas objects. Primarily used for providing spacial-type calculations where necessary.
=end pod

# vim: ft=perl6 sw=4 ts=4 expandtab

0 comments on commit c8ff6bb

Please sign in to comment.