mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Expicitly mark is selection extent was found or not
This commit is contained in:
parent
9f4609aec2
commit
0c233efa27
@ -703,7 +703,7 @@ class CreateAnnotation:
|
|||||||
self.state = WAITING_FOR_CLICK
|
self.state = WAITING_FOR_CLICK
|
||||||
self.show()
|
self.show()
|
||||||
self.hide_handles()
|
self.hide_handles()
|
||||||
if msg.extents and msg.extents.start.x is not None:
|
if msg.extents and not msg.extents.start.is_empty:
|
||||||
self.place_handles(msg.extents)
|
self.place_handles(msg.extents)
|
||||||
self.in_flow_mode = msg.in_flow_mode
|
self.in_flow_mode = msg.in_flow_mode
|
||||||
self.send_message('set-highlight-style', style=self.current_highlight_style)
|
self.send_message('set-highlight-style', style=self.current_highlight_style)
|
||||||
|
@ -46,8 +46,8 @@ def word_at_point(x, y):
|
|||||||
|
|
||||||
def empty_range_extents():
|
def empty_range_extents():
|
||||||
return {
|
return {
|
||||||
'start': {'x': 0, 'y': 0, 'height': 0, 'onscreen': False},
|
'start': {'x': 0, 'y': 0, 'height': 0, 'onscreen': False, 'is_empty': True},
|
||||||
'end': {'x': 0, 'y': 0, 'height': 0, 'onscreen': False}
|
'end': {'x': 0, 'y': 0, 'height': 0, 'onscreen': False, 'is_empty': True}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -78,6 +78,8 @@ def range_extents(start, end, in_flow_mode):
|
|||||||
|
|
||||||
for_boundary(start, ans.start)
|
for_boundary(start, ans.start)
|
||||||
for_boundary(end, ans.end)
|
for_boundary(end, ans.end)
|
||||||
|
ans.start.is_empty = ans.start.height > 0
|
||||||
|
ans.end.is_empty = ans.end.height > 0
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
|
|
||||||
@ -112,6 +114,7 @@ def selection_extents_at_point(x, y, in_flow_mode):
|
|||||||
ans.start.x = x
|
ans.start.x = x
|
||||||
ans.end.x = x + ans.start.height * 3
|
ans.end.x = x + ans.start.height * 3
|
||||||
ans.start.onscreen = ans.end.onscreen = True
|
ans.start.onscreen = ans.end.onscreen = True
|
||||||
|
ans.start.is_empty = ans.end.is_empty = False
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user