[evince/wip/highlight: 11/16] libview: checking if point is inside annotation
- From: Jose Aliste <jaliste src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/wip/highlight: 11/16] libview: checking if point is inside annotation
- Date: Thu, 25 Sep 2014 15:22:30 +0000 (UTC)
commit d36bc85ab1bb9c2ddcfbc1dc3a3cb5eae14f0de6
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 72245ed..dc87f0d 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -3075,6 +3075,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;
@@ -3084,8 +3086,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]