pdf-viewer: fix segmentation error and update char offset.

master
luhuaei 6 years ago
parent 333ed5b23c
commit 396004014e
  1. 16
      app/pdf-viewer/buffer.py

@ -665,7 +665,7 @@ class PdfViewerWidget(QWidget):
return chars_list return chars_list
def get_char_rect_index(self, event): def get_char_rect_index(self, event):
offset = 20 offset = 15
ex, ey, page_index = self.get_event_absolute_position(event) ex, ey, page_index = self.get_event_absolute_position(event)
if ex and ey and page_index: if ex and ey and page_index:
rect = fitz.Rect(ex, ey, ex + offset, ey + offset) rect = fitz.Rect(ex, ey, ex + offset, ey + offset)
@ -753,17 +753,11 @@ class PdfViewerWidget(QWidget):
page = self.document[page_index] page = self.document[page_index]
duplicate_rect = [] duplicate_rect = []
for annot in self.select_area_annot_cache_dict[page_index]: for annot in self.select_area_annot_cache_dict[page_index]:
if annot.parent is None: if annot.parent:
annot.parent = page if annot.rect in line_rect_list:
if annot.rect in line_rect_list: duplicate_rect.append(annot.rect)
duplicate_rect.append(annot.rect) else:
else:
# Double click after on multi page select, will cause EAF core dumped
# don't anything error output.
try:
page.deleteAnnot(annot) page.deleteAnnot(annot)
except:
pass
annot_list = [] annot_list = []
for rect in line_rect_list: for rect in line_rect_list:

Loading…
Cancel
Save