Clone in a terminal:
Commit 660bf24
Johan Mattsson - 2014-07-11T21:59:34+00:00
660bf249fadf4294fdd684a67c26a4500b678fafjohan.mattsson.m@gmail.com

Center new images

Changed files (2)

Diff

diff --git a/libbirdfont/BackgroundImage.vala b/libbirdfont/BackgroundImage.valaindex e728113..23ae99a 100644--- a/libbirdfont/BackgroundImage.vala+++ b/libbirdfont/BackgroundImage.vala@@ -63,7 +63,17 @@ public class BackgroundImage { 			return size; 		} 	}-		++	public double img_middle_x {+		get { return img_x + (size_margin * img_scale_x) / 2; }+		set { img_x = value - (size_margin * img_scale_x) / 2; }+	}+	+	public double img_middle_y {+		get { return img_y + (size_margin * img_scale_y) / 2; }+		set { img_y = value - img_y + (size_margin * img_scale_y) / 2; }+	}+				 	public BackgroundImage (string file_name) { 		path = file_name; 	}@@ -841,6 +851,10 @@ public class BackgroundImage { 	 	public void center_in_glyph () { 		Glyph g = MainWindow.get_current_glyph ();+		Font f = BirdFont.get_current_font ();+		+		img_middle_x = g.left_limit + (g.right_limit - g.left_limit) / 2;+		img_middle_y = f.bottom_position + (f.top_position - f.bottom_position) / 2; 	} } 	diff --git a/libbirdfont/BackgroundTool.vala b/libbirdfont/BackgroundTool.valaindex be6dc2a..05ede58 100644--- a/libbirdfont/BackgroundTool.vala+++ b/libbirdfont/BackgroundTool.vala@@ -155,8 +155,10 @@ public class BackgroundTool : Tool { 		idle.set_callback (() => { 			TabBar tb = MainWindow.get_tab_bar (); 			Glyph g = MainWindow.get_current_glyph ();+			 			g.set_background_image (imported_background); 			imported_background.center_in_glyph ();			+			 			tb.select_tab_name (g.get_name ());  			Toolbox.select_tool_by_name ("zoom_background_image");

Contact

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