[evince/wip/highlight: 140/145] libview: checking if point is inside annotation
- From: Giselle Reis <gisellemnr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/wip/highlight: 140/145] libview: checking if point is inside annotation
- Date: Tue, 14 Apr 2015 01:03:50 +0000 (UTC)
commit 0c819b899647ef7bd08576d4f98119d494c30efe
Author: Giselle Reis <gisellemnr src gnome org>
Date: Tue Aug 19 19:23:31 2014 +0200
libview: checking if point is inside annotation
Added a step to check if a point is inside an
annotation. In case it is foud to be inside the
bounding box, view asks the document if it is
actually inside the annotations, since the
quadrilaterals might not comprise the whole are of
the bounding box. Only then it become selectable.
libview/ev-view.c | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/libview/ev-view.c b/libview/ev-view.c
index f280a05..77e9900 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -3085,6 +3085,8 @@ get_annotation_mapping_at_location (EvView *view,
{
gint x_new = 0, y_new = 0;
EvMappingList *annotations_mapping;
+ GArray *annotation_mapping_array;
+ guint i;
if (!EV_IS_DOCUMENT_ANNOTATIONS (view->document))
return NULL;
@@ -3094,8 +3096,23 @@ get_annotation_mapping_at_location (EvView *view,
annotations_mapping = ev_page_cache_get_annot_mapping (view->page_cache, *page);
- if (annotations_mapping)
- return ev_mapping_list_get (annotations_mapping, x_new, y_new);
+ if (annotations_mapping) {
+ annotation_mapping_array = ev_mapping_list_get_all (annotations_mapping, x_new, y_new);
+
+ if (annotation_mapping_array) {
+ for (i = 0; i < annotation_mapping_array->len; i++) {
+ EvMapping *mapping;
+ EvAnnotation *annot;
+
+ mapping = &g_array_index (annotation_mapping_array, EvMapping, i);
+ annot = EV_ANNOTATION (mapping->data);
+
+ if (ev_document_annotations_is_xy_in_annotation (EV_DOCUMENT_ANNOTATIONS
(view->document), annot, x_new, y_new))
+ return mapping;
+ }
+ g_array_unref (annotation_mapping_array);
+ }
+ }
return NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]