The Birdfont Source Code


All Repositories / birdfont.git / commitdiff – RSS feed

Fix zoom tool on Windows

These changes was commited to the Birdfont repository Mon, 13 Jun 2016 14:56:47 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
[Mon, 13 Jun 2016 14:56:47 +0000]

Updated Files

libbirdfont/Glyph.vala
libbirdfont/ZoomTool.vala
--- a/libbirdfont/Glyph.vala +++ b/libbirdfont/Glyph.vala @@ -1077,19 +1077,9 @@ } public void show_zoom_area (int sx, int sy, int nx, int ny) { - double x, y, w, h; - set_zoom_area (sx, sy, nx, ny); - zoom_area_is_visible = true; - - x = Math.fmin (zoom_x1, zoom_x2) - 50; - y = Math.fmin (zoom_y1, zoom_y2) - 50; - - w = Math.fabs (zoom_x1 - zoom_x2) + 100; - h = Math.fabs (zoom_y1 - zoom_y2) + 100; - - redraw_area ((int)x, (int)y, (int)w, (int)h); + GlyphCanvas.redraw (); } public void set_zoom_area (int sx, int sy, int nx, int ny) {
--- a/libbirdfont/ZoomTool.vala +++ b/libbirdfont/ZoomTool.vala @@ -36,17 +36,18 @@ }); press_action.connect((self, b, x, y) => { - if (b == 1 && KeyBindings.modifier != CTRL) { + if (b == 1 && !KeyBindings.has_ctrl () && !KeyBindings.has_shift ()) { zoom_area_begin_x = x; zoom_area_begin_y = y; + Glyph g = MainWindow.get_current_glyph (); + g.zoom_area_is_visible = true; } }); move_action.connect((self, x, y) => { - Glyph g; + Glyph g = MainWindow.get_current_glyph (); - if (zoom_area_begin_x > 0) { - g = MainWindow.get_current_glyph (); + if (g.zoom_area_is_visible) { g.show_zoom_area (zoom_area_begin_x, zoom_area_begin_y, x, y); } }); @@ -54,7 +55,7 @@ release_action.connect((self, b, x, y) => { Glyph g; - if (b == 1 && KeyBindings.modifier != CTRL) { + if (b == 1 && !KeyBindings.has_ctrl () && !KeyBindings.has_shift ()) { store_current_view (); g = MainWindow.get_current_glyph (); @@ -65,6 +66,7 @@ g.set_zoom_from_area (); } + g.zoom_area_is_visible = false; zoom_area_begin_x = -1; zoom_area_begin_y = -1; }