Commit ad96b82
Fix key bingings for zoom and move in edit view alt+scroll - zoom space+click - move
Changed files (4)
modifiedbirdfont/GtkWindow.valamodifiedlibbirdfont/Glyph.valamodifiedlibbirdfont/KeyBindings.valamodifiedlibbirdfont/PenTool.vala
Diff
@@ -853,8 +853,6 @@ public class GlyphCanvasArea : DrawingArea { }); button_press_event.connect ((t, e)=> {- set_modifier ((int) e.state);- if (e.type == EventType.BUTTON_PRESS) { TabContent.button_press (e.button, e.x, e.y); } else if (e.type == EventType.2BUTTON_PRESS) {@@ -865,7 +863,6 @@ public class GlyphCanvasArea : DrawingArea { }); button_release_event.connect ((t, e)=> {- set_modifier ((int) e.state); TabContent.button_release ((int) e.button, e.x, e.y); return true; });@@ -876,8 +873,6 @@ public class GlyphCanvasArea : DrawingArea { }); scroll_event.connect ((t, e)=> {- set_modifier ((int) e.state);- if (e.direction == Gdk.ScrollDirection.UP) { TabContent.scroll_wheel_up (e.x, e.y); } else if (e.direction == Gdk.ScrollDirection.DOWN) {@@ -890,20 +885,6 @@ public class GlyphCanvasArea : DrawingArea { can_focus = true; }-- static void set_modifier (int k) {- KeyBindings.set_modifier (NONE);-- if (has_flag (k, ModifierType.SHIFT_MASK)) {- KeyBindings.set_modifier (SHIFT);- } else if (has_flag (k, ModifierType.CONTROL_MASK)) {- KeyBindings.set_modifier (CTRL);- } else if (has_flag (k, ModifierType.CONTROL_MASK | ModifierType.SHIFT_MASK)) {- KeyBindings.set_modifier (SHIFT | CTRL);- } else if (has_flag (k, ModifierType.MOD5_MASK)) {- KeyBindings.set_modifier (LOGO);- }- } } public class DescriptionForm : GLib.Object {@@ -63,6 +63,7 @@ public class Glyph : FontDisplay { bool view_is_moving = false; public double move_offset_x = 0; public double move_offset_y = 0;+ bool move_canvas = false; public WidgetAllocation allocation = new WidgetAllocation (); @@ -332,9 +333,9 @@ public class Glyph : FontDisplay { } public override void scroll_wheel_up (double x, double y) {- if (KeyBindings.has_ctrl ()) {+ if (KeyBindings.has_alt ()) { zoom_in_at_point (x, y);- } else if (KeyBindings.has_alt ()) { + } else if (KeyBindings.has_ctrl ()) { view_offset_x -= 10 / view_zoom; } else { view_offset_y -= 10 / view_zoom;@@ -344,9 +345,9 @@ public class Glyph : FontDisplay { } public override void scroll_wheel_down (double x, double y) {- if (KeyBindings.has_ctrl ()) {+ if (KeyBindings.has_alt ()) { zoom_out_at_point (x, y);- } else if (KeyBindings.has_alt ()) { + } else if (KeyBindings.has_ctrl ()) { view_offset_x += 10 / view_zoom; } else { view_offset_y += 10 / view_zoom;@@ -644,12 +645,20 @@ public class Glyph : FontDisplay { Tool t; t = MainWindow.get_toolbox ().get_current_tool (); t.key_release_action (t, keyval);++ if (keyval == (uint)' ') {+ move_canvas = false;+ } } public override void key_press (uint keyval) { Tool t = MainWindow.get_toolbox ().get_current_tool (); t.key_press_action (t, keyval); + if (keyval == (uint)' ') {+ move_canvas = true;+ }+ switch (keyval) { case Key.NUM_PLUS: zoom_in ();@@ -789,7 +798,7 @@ public class Glyph : FontDisplay { return; } - if (KeyBindings.has_ctrl () || DrawingTools.move_canvas.is_selected ()) {+ if (move_canvas || DrawingTools.move_canvas.is_selected ()) { view_is_moving = true; move_offset_x = view_offset_x; move_offset_y = view_offset_y;@@ -114,7 +114,7 @@ public class KeyBindings { } public static uint get_mod_from_key (uint keyval) {- uint mod = 0;+ uint mod = NONE; mod |= (keyval == Key.CTRL_RIGHT || keyval == Key.CTRL_LEFT) ? CTRL : 0; mod |= (keyval == Key.SHIFT_RIGHT || keyval == Key.SHIFT_LEFT) ? SHIFT : 0; mod |= (keyval == Key.ALT_LEFT || keyval == Key.ALT_GR) ? ALT : 0;@@ -163,7 +163,6 @@ public class PenTool : Tool { y = Glyph.path_coordinate_y (iy); if (has_join_icon ()) {- print ("merge in pen_tool\n"); join_paths (x, y); }