mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Tapping in the top quarter of the page now shows the chrome
This commit is contained in:
parent
5eaccd6619
commit
5fc6b6db39
@ -94,7 +94,7 @@ class IframeBoss:
|
|||||||
self.do_layout = flow_layout
|
self.do_layout = flow_layout
|
||||||
self.handle_wheel = flow_onwheel
|
self.handle_wheel = flow_onwheel
|
||||||
self.handle_keydown = flow_onkeydown
|
self.handle_keydown = flow_onkeydown
|
||||||
self.handle_gesture = flow_handle_gesture
|
self._handle_gesture = flow_handle_gesture
|
||||||
self.to_scroll_fraction = flow_to_scroll_fraction
|
self.to_scroll_fraction = flow_to_scroll_fraction
|
||||||
self.jump_to_cfi = scroll_to_cfi
|
self.jump_to_cfi = scroll_to_cfi
|
||||||
else:
|
else:
|
||||||
@ -103,13 +103,19 @@ class IframeBoss:
|
|||||||
self.handle_keydown = paged_onkeydown
|
self.handle_keydown = paged_onkeydown
|
||||||
self.to_scroll_fraction = paged_scroll_to_fraction
|
self.to_scroll_fraction = paged_scroll_to_fraction
|
||||||
self.jump_to_cfi = paged_jump_to_cfi
|
self.jump_to_cfi = paged_jump_to_cfi
|
||||||
self.handle_gesture = paged_handle_gesture
|
self._handle_gesture = paged_handle_gesture
|
||||||
apply_settings(data.settings)
|
apply_settings(data.settings)
|
||||||
set_current_spine_item({'name':data.name, 'is_first':index is 0, 'is_last':index is spine.length - 1, 'initial_position':data.initial_position})
|
set_current_spine_item({'name':data.name, 'is_first':index is 0, 'is_last':index is spine.length - 1, 'initial_position':data.initial_position})
|
||||||
self.last_cfi = None
|
self.last_cfi = None
|
||||||
root_data, self.mathjax = finalize_resources(self.book, data.name, data.resource_data)
|
root_data, self.mathjax = finalize_resources(self.book, data.name, data.resource_data)
|
||||||
unserialize_html(root_data, self.content_loaded)
|
unserialize_html(root_data, self.content_loaded)
|
||||||
|
|
||||||
|
def handle_gesture(self, gesture):
|
||||||
|
if gesture.type is 'show-chrome':
|
||||||
|
self.send_message('show_chrome')
|
||||||
|
else:
|
||||||
|
self._handle_gesture(gesture)
|
||||||
|
|
||||||
def on_scroll_to_anchor(self, data):
|
def on_scroll_to_anchor(self, data):
|
||||||
frag = data.frag
|
frag = data.frag
|
||||||
if frag:
|
if frag:
|
||||||
|
@ -204,10 +204,13 @@ class TouchHandler:
|
|||||||
elem.dispatchEvent(fake_click)
|
elem.dispatchEvent(fake_click)
|
||||||
return
|
return
|
||||||
if not tap_on_link(gesture):
|
if not tap_on_link(gesture):
|
||||||
# TODO: Convert the tap gesture into
|
if gesture.viewport_y < window.innerHeight / 4:
|
||||||
# semantic gestures based on position of tap (next page/previous
|
gesture.type = 'show-chrome'
|
||||||
# page/show ui) as these are common to both paged and flow mode.
|
else:
|
||||||
pass
|
# TODO: Convert the tap gesture into
|
||||||
|
# semantic gestures based on position of tap (next page/previous
|
||||||
|
# page/show ui) as these are common to both paged and flow mode.
|
||||||
|
pass
|
||||||
get_boss().handle_gesture(gesture)
|
get_boss().handle_gesture(gesture)
|
||||||
|
|
||||||
touch_handler = TouchHandler()
|
touch_handler = TouchHandler()
|
||||||
|
@ -66,6 +66,7 @@ class View:
|
|||||||
'scroll_to_anchor': self.on_scroll_to_anchor,
|
'scroll_to_anchor': self.on_scroll_to_anchor,
|
||||||
'update_cfi': self.on_update_cfi,
|
'update_cfi': self.on_update_cfi,
|
||||||
'content_loaded': self.on_content_loaded,
|
'content_loaded': self.on_content_loaded,
|
||||||
|
'show_chrome': self.show_chrome,
|
||||||
}
|
}
|
||||||
self.currently_showing = {}
|
self.currently_showing = {}
|
||||||
document.getElementById('book-top-margin').addEventListener('click', self.top_margin_clicked)
|
document.getElementById('book-top-margin').addEventListener('click', self.top_margin_clicked)
|
||||||
@ -77,7 +78,10 @@ class View:
|
|||||||
def top_margin_clicked(self, event):
|
def top_margin_clicked(self, event):
|
||||||
if event.button is 0:
|
if event.button is 0:
|
||||||
event.preventDefault(), event.stopPropagation()
|
event.preventDefault(), event.stopPropagation()
|
||||||
self.overlay.show()
|
self.show_chrome()
|
||||||
|
|
||||||
|
def show_chrome(self):
|
||||||
|
self.overlay.show()
|
||||||
|
|
||||||
def set_margins(self, no_margins):
|
def set_margins(self, no_margins):
|
||||||
sd = get_session_data()
|
sd = get_session_data()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user