Commit 4eb0a8e
Fix image rotation
Changed files (3)
modifiedlibbirdfont/BackgroundImage.valamodifiedlibbirdfont/BackgroundTool.valamodifiedlibbirdfont/MenuTab.vala
Diff
@@ -318,7 +318,7 @@ public class BackgroundImage { length = -length; } - img_rotation = (y < bcy) ? acos (a / length) + PI : -acos (a / length) + PI;+ img_rotation = (y > bcy) ? acos (a / length) + PI : -acos (a / length) + PI; } public void set_img_scale (double xs, double ys) {@@ -453,22 +453,22 @@ public class BackgroundImage { bool is_over_rotate (double nx, double ny) { double x, y, d; - x = img_middle_x;- y = img_middle_y;+ x = Glyph.reverse_path_coordinate_x (img_middle_x);+ y = Glyph.reverse_path_coordinate_y (img_middle_y); x += cos (img_rotation) * 75; y += sin (img_rotation) * 75; - d = sqrt (pow (x - nx, 2) + pow (y - ny, 2));+ d = Path.distance (x, nx, y, ny); - return d < 10;+ return d < 15 * MainWindow.units; } bool is_over_resize (double nx, double ny) { double x, y, size; bool inx, iny; - size = 12;+ size = 12 * MainWindow.units; x = img_middle_x - (img_scale_x * get_img ().get_width () / 2); y = img_middle_y - (img_scale_y * get_img ().get_height () / 2);@@ -114,6 +114,7 @@ public class BackgroundTool : Tool { BackgroundImage? background_image = g.get_background_image (); BackgroundImage bg = (!) background_image; double xscale, yscale, dx, dy, xc, yc;+ double coordinate_x, coordinate_y; if (background_image == null) { return;@@ -131,7 +132,9 @@ public class BackgroundTool : Tool { dy *= PenTool.precision; if (bg.selected_handle == 2) {- bg.set_img_rotation_from_coordinate (x, y);+ coordinate_x = Glyph.path_coordinate_x (x);+ coordinate_y = Glyph.path_coordinate_y (y);+ bg.set_img_rotation_from_coordinate (coordinate_x, coordinate_y); } if (bg.selected_handle == 1) {@@ -54,6 +54,7 @@ public class MenuTab : FontDisplay { idle.set_callback (() => { set_suppress_event (false); TabBar.stop_wheel ();+ GlyphCanvas.redraw (); return false; }); idle.attach (null);