Renard-Curie

 view release on metacpan or  search on metacpan

lib/Renard/Curie/Component/JacquardCanvas/Role/MouseSelection.pm  view on Meta::CPAN

	my $end_pages = $selections->{end}{pointer}{pages};
	if( @$start_pages && @$end_pages ) {
		my @sorted = sort {$a <=> $b} ( $start_pages->[0] , $end_pages->[0] );
		my @pgs = ( $sorted[0] .. $sorted[1] );
		my @bboxes;
		for my $page_number (@pgs) {
			my ($page, $view) = $self->_get_page_view_for_page_number($page_number);
			next unless $view;

			my @extents = $page->get_extents_from_selection(
				$selections->{start},
				$selections->{end}
			);

			if( @extents ) {
				@extents = sort {$a <=> $b} @extents;
				$text .=  $page->_textual_page->substr( $extents[0], $extents[1]-$extents[0] )->str;
			}
		}
	}

	$text;
}

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Renard::Curie::Component::JacquardCanvas::Role::MouseSelection - Role for selecting text

=head1 VERSION

version 0.005

=head1 METHODS

=head2 mark_selection_start

Mark start of selection.

=head2 mark_selection_end

Mark end of selection.

=head2 clear_selection

Clear selection data.

=head1 CALLBACKS

=head2 cb_on_text_selected

Callback for C<text-selected> signal.

Currently sets the primary clipboard to the text of the selection.

=head1 AUTHOR

Project Renard

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by Project Renard.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut



( run in 1.676 second using v1.01-cache-2.11-cpan-5e09290becf )