Clone in a terminal:
Commit 4eb0a8e
Johan Mattsson - 2014-07-28T13:51:27+00:00
4eb0a8e22d8cdec123a958d9f6981c876de33ad5johan.mattsson.m@gmail.com

Fix image rotation

Changed files (3)

Diff

diff --git a/libbirdfont/BackgroundImage.vala b/libbirdfont/BackgroundImage.valaindex d5f1bdd..3e39cd7 100644--- a/libbirdfont/BackgroundImage.vala+++ b/libbirdfont/BackgroundImage.vala@@ -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);diff --git a/libbirdfont/BackgroundTool.vala b/libbirdfont/BackgroundTool.valaindex 9f9f2fc..35005c7 100644--- a/libbirdfont/BackgroundTool.vala+++ b/libbirdfont/BackgroundTool.vala@@ -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) {diff --git a/libbirdfont/MenuTab.vala b/libbirdfont/MenuTab.valaindex 3c0a379..d11adc0 100644--- a/libbirdfont/MenuTab.vala+++ b/libbirdfont/MenuTab.vala@@ -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);

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112