Commit e2b5163
Draw zoom box over character
Changed files (2)
Diff
@@ -51,10 +51,10 @@ public class Glyph : FontDisplay { public double motion_y = 0; // Zoom area- double zoom_x1 = 0;- double zoom_y1 = 0;- double zoom_x2 = 0;- double zoom_y2 = 0;+ public double zoom_x1 = 0;+ public double zoom_y1 = 0;+ public double zoom_x2 = 0;+ public double zoom_y2 = 0; public bool zoom_area_is_visible = false; bool view_is_moving = false;@@ -1687,15 +1687,6 @@ public class Glyph : FontDisplay { p.draw_path (cr, this, c); } }- - public void draw_zoom_area(Context cr) {- cr.save ();- cr.set_line_width (2.0);- Theme.color (cr, "Selection Border");- cr.rectangle (Math.fmin (zoom_x1, zoom_x2), Math.fmin (zoom_y1, zoom_y2), Math.fabs (zoom_x1 - zoom_x2), Math.fabs (zoom_y1 - zoom_y2));- cr.stroke ();- cr.restore ();- } public void draw_background_color (Context cr, double opacity) { if (opacity > 0) {@@ -1754,12 +1745,6 @@ public class Glyph : FontDisplay { cmp.restore (); } - if (zoom_area_is_visible) {- cmp.save ();- draw_zoom_area (cmp);- cmp.restore ();- }- if (!is_empty ()) { cmp.save (); cmp.scale (view_zoom, view_zoom);@@ -12,6 +12,8 @@ Lesser General Public License for more details. */ +using Cairo;+ namespace BirdFont { public class ZoomTool : Tool {@@ -67,8 +69,30 @@ public class ZoomTool : Tool { zoom_area_begin_y = -1; } });+ + draw_action.connect ((tool, cairo_context, glyph) => {+ draw_zoom_area (cairo_context);+ }); } + public void draw_zoom_area (Context cr) {+ Glyph g = MainWindow.get_current_glyph ();+ + if (g.zoom_area_is_visible) {+ cr.save ();+ cr.set_line_width (2.0);+ Theme.color (cr, "Selection Border");+ + cr.rectangle (Math.fmin (g.zoom_x1, g.zoom_x2), + Math.fmin (g.zoom_y1, g.zoom_y2), + Math.fabs (g.zoom_x1 - g.zoom_x2),+ Math.fabs (g.zoom_y1 - g.zoom_y2));+ + cr.stroke ();+ cr.restore ();+ }+ }+ public static void zoom_full_background_image () { BackgroundImage bg; Glyph g = MainWindow.get_current_glyph ();