Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.0:Ports
lekha
feature-mouse-zoom.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File feature-mouse-zoom.patch of Package lekha
diff --git a/lekha/app.py b/lekha/app.py index 519b63e..c130612 100644 --- a/lekha/app.py +++ b/lekha/app.py @@ -127,18 +127,36 @@ class AppWindow(StandardWindow): main_box.show() def _event_handler(self, obj, src, tp, ev): - if tp == EVAS_CALLBACK_KEY_UP: + if tp == EVAS_CALLBACK_MOUSE_WHEEL: + if ev.direction == 0: + if ( + self.tabs.currentContent and + self.tabs.currentContent.scroll_freeze_get()): + if ev.z == 1: + self.tabs.currentContent.zoom_out() + else: + self.tabs.currentContent.zoom_in() + elif tp == EVAS_CALLBACK_KEY_UP: key = ev.key if key == "plus": - self.tabs.currentContent.zoom_in() + if self.tabs.currentContent: + self.tabs.currentContent.zoom_in() elif key == "minus": - self.tabs.currentContent.zoom_out() + if self.tabs.currentContent: + self.tabs.currentContent.zoom_out() elif key == "Escape": if self.fullscreen: self.fullscreen = False elif key == "F11": self.fullscreen = not self.fullscreen - ev.event_flags |= EVAS_EVENT_FLAG_ON_HOLD + elif key == "Control_L" or key == "Control_R": + self.tabs.currentContent.scroll_thaw() + elif tp == EVAS_CALLBACK_KEY_DOWN: + key = ev.key + if key == "Control_L" or key == "Control_R": + self.tabs.currentContent.scroll_freeze() + + ev.event_flags |= EVAS_EVENT_FLAG_ON_HOLD @staticmethod def _fullscreen_cb(win): @@ -545,6 +563,15 @@ class Document(Table): def _scrolled(self, scr): self.doc_pos = scr.region + def scroll_freeze(self): + self.scr.scroll_freeze_push() + + def scroll_thaw(self): + self.scr.scroll_freeze_pop() + + def scroll_freeze_get(self): + return self.scr.scroll_freeze + class PageSmart(Smart):
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor