[libchamplain] Use view height for computing y delta in the keyboard mapping demo
- From: Jiří Techet <jiritechet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libchamplain] Use view height for computing y delta in the keyboard mapping demo
- Date: Sun, 19 Oct 2014 19:41:40 +0000 (UTC)
commit b470dc9d12f6fe301d21f4d9504d27ca1301b246
Author: Jiří Techet <techet gmail com>
Date: Sun Oct 19 21:41:16 2014 +0200
Use view height for computing y delta in the keyboard mapping demo
demos/keyboard-mapping.py | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/demos/keyboard-mapping.py b/demos/keyboard-mapping.py
index 85444c1..7b7663d 100755
--- a/demos/keyboard-mapping.py
+++ b/demos/keyboard-mapping.py
@@ -25,15 +25,16 @@ class KeyboardMapping:
window.show_all()
def on_key_press(self, widget, ev):
- delta = self.widget.get_allocation().width / 4
+ deltax = self.widget.get_allocation().width / 4
+ deltay = self.widget.get_allocation().height / 4
if ev.keyval == Gdk.KEY_Left:
- self.scroll(-delta, 0)
+ self.scroll(-deltax, 0)
elif ev.keyval == Gdk.KEY_Right:
- self.scroll(delta, 0)
+ self.scroll(deltax, 0)
elif ev.keyval == Gdk.KEY_Up:
- self.scroll(0, -delta)
+ self.scroll(0, -deltay)
elif ev.keyval == Gdk.KEY_Down:
- self.scroll(0, delta)
+ self.scroll(0, deltay)
elif ev.keyval == Gdk.KEY_plus or ev.keyval == Gdk.KEY_KP_Add:
self.view.zoom_in()
elif ev.keyval == Gdk.KEY_minus or ev.keyval == Gdk.KEY_KP_Subtract:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]