Clone in a terminal:
Commit 7b1841f
Johan Mattsson - 2015-05-03T17:47:06+00:00
7b1841f882a8a72ecad4010a9b45de4f932f5a44johan.mattsson.m@gmail.com

Fix point selection in Beziér tool

Changed files (2)

Diff

diff --git a/libbirdfont/ForesightTool.vala b/libbirdfont/ForesightTool.valaindex e5ce872..d1b7e75 100644--- a/libbirdfont/ForesightTool.vala+++ b/libbirdfont/ForesightTool.vala@@ -72,7 +72,7 @@ public class ForesightTool : Tool { 			bool one_point = false; 			 			MainWindow.set_cursor (NativeWindow.HIDDEN);-			+				 			if (b == 2) { 				stop_drawing (); 				return;@@ -87,7 +87,7 @@ public class ForesightTool : Tool { 			if (previous_point > 0) { 				previous_point = 0; 				state = MOVE_POINT;-			} else {	+			} else { 				if (state == MOVE_POINT) {			 					state = MOVE_HANDLES; 					@@ -135,20 +135,22 @@ public class ForesightTool : Tool { 							state = NONE; 						} 					}-				}-				-				if (state == NONE) {-					state = MOVE_POINT;-					add_new_point (x, y);-					-					PenTool.last_point_x = Glyph.path_coordinate_x (x);-					PenTool.last_point_y = Glyph.path_coordinate_y (y);-					-					move_action (this, x, y);-					state = MOVE_FIRST_HANDLE;-					release_action(this, b, x, y); 				}  			}+			+			if (state == NONE) {+				state = MOVE_POINT;+				PenTool.active_path = get_active_path ();+				+				add_new_point (x, y);+				+				PenTool.last_point_x = Glyph.path_coordinate_x (x);+				PenTool.last_point_y = Glyph.path_coordinate_y (y);+				+				move_action (this, x, y);+				state = MOVE_FIRST_HANDLE;+				release_action(this, b, x, y);+			} 		});  		release_action.connect ((self, b, x, y) => {@@ -156,7 +158,7 @@ public class ForesightTool : Tool { 			PointSelection last; 			 			if (state == MOVE_HANDLES || state == MOVE_FIRST_HANDLE) {-				if (state != MOVE_FIRST_HANDLE) { // FIXME:+				if (state != MOVE_FIRST_HANDLE) { 					last = add_new_point (x, y);	 				} 				@@ -324,23 +326,23 @@ public class ForesightTool : Tool { 	public void stop_drawing () { 		PenTool p = (PenTool) PointTool.pen (); 		+		p.release_action (p, 1, 0, 0);+		 		if (state != NONE) {-			p.release_action (p, 1, 0, 0);-			 			if (get_active_path ().is_open () && state != NONE) { 				get_active_path ().delete_last_point (); 			}-			-			p.press_action (p, 2, 0, 0);-			p.release_action (p, 2, 0, 0);-			current_path.hide_end_handle = true;-			-			MainWindow.set_cursor (NativeWindow.VISIBLE);-			MainWindow.get_current_glyph ().clear_active_paths ();-				-			state = NONE;-			MainWindow.set_cursor (NativeWindow.VISIBLE); 		}+	+		p.press_action (p, 2, 0, 0);+		p.release_action (p, 2, 0, 0);+		current_path.hide_end_handle = true;+		+		MainWindow.set_cursor (NativeWindow.VISIBLE);+		MainWindow.get_current_glyph ().clear_active_paths ();+			+		state = NONE;+		MainWindow.set_cursor (NativeWindow.VISIBLE); 	} 	 	public Path get_active_path () {diff --git a/libbirdfont/PenTool.vala b/libbirdfont/PenTool.valaindex f3c0683..d2c8e0e 100644--- a/libbirdfont/PenTool.vala+++ b/libbirdfont/PenTool.vala@@ -143,7 +143,12 @@ public class PenTool : Tool { 		double_click_action.connect ((self, b, x, y) => { 			last_point_x = Glyph.path_coordinate_x (x); 			last_point_y = Glyph.path_coordinate_y (y);-			press (b, x, y, true);+			+			if (!move_selected_handle && !move_selected) {+				press (b, x, y, true);+			} else {+				warning ("double click suppressed");+			} 		});  		release_action.connect ((self, b, ix, iy) => {@@ -839,11 +844,13 @@ public class PenTool : Tool { 	public void add_point_event (int x, int y) { 		Glyph? g = MainWindow.get_current_glyph (); 		Glyph glyph = (!) g;+		PointSelection ps; 		 		return_if_fail (g != null); 		 		remove_all_selected_points ();-		new_point_action (x, y);+		ps = new_point_action (x, y);+		active_path = ps.path; 		glyph.store_undo_state (); 	} 		

Contact

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