[evince/gpoo/fix-hover-for-highlight-annotations: 81/81] libview: checking if point is inside annotation
- From: Germán Poo-Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/gpoo/fix-hover-for-highlight-annotations: 81/81] libview: checking if point is inside annotation
- Date: Tue, 19 May 2020 21:54:57 +0000 (UTC)
commit b1bb54a6e7eb4d947df407530f06ab3d2665e505
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.
https://bugzilla.gnome.org/show_bug.cgi?id=769133
Fixes #696
libview/ev-view.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/libview/ev-view.c b/libview/ev-view.c
index 33a7af2a..052474bc 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -3326,6 +3326,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;
@@ -3335,8 +3337,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]