Commit f7e5a15
Make it possible to mix tied and symmetrical handles with straight lines
Changed files (5)
modifiedlibbirdfont/DrawingTools.valamodifiedlibbirdfont/EditPoint.valamodifiedlibbirdfont/ForesightTool.valamodifiedlibbirdfont/PenTool.valamodifiedlibbirdfont/TrackTool.vala
Diff
@@ -1113,7 +1113,7 @@ public class DrawingTools : ToolCollection { } void show_point_tool_modifiers () {- draw_tool_modifiers.set_headline (t_("Control Point Tools"));+ draw_tool_modifiers.set_headline (t_("Control Points")); tie_handles.set_tool_visibility (true); reflect_handle.set_tool_visibility (true);@@ -206,6 +206,11 @@ public class EditPoint : GLib.Object { if (next == null || get_next ().next != null) { return; }++ if (unlikely (reflective_point || tie_handles)) {+ warning ("Points on lines can't have tied handles.");+ return;+ } px = get_next ().get_next ().x; py = get_next ().get_next ().y;@@ -195,7 +195,7 @@ public class ForesightTool : Tool { return; } last = PenTool.selected_points.get (PenTool.selected_points.size - 1);- last.point.convert_to_curve ();+ //last.point.convert_to_curve (); } PenTool.move_selected_handle = true;@@ -1494,7 +1494,9 @@ public class PenTool : Tool { static void set_default_handle_positions_on_path (Path path) { foreach (EditPoint e in path.points) {- e.recalculate_linear_handles ();+ if (!e.tie_handles && !e.reflective_point) {+ e.recalculate_linear_handles ();+ } } } @@ -128,6 +128,9 @@ public class TrackTool : Tool { if (button == 1 && draw_freehand) { add_endpoint_and_merge (x, y); }+ + set_tie ();+ BirdFont.get_current_font ().touch (); }); @@ -170,6 +173,21 @@ public class TrackTool : Tool { p.key_press_action (p, keyval); }); }+ + void set_tie () {+ Glyph glyph = MainWindow.get_current_glyph ();+ Path p = glyph.path_list.get (glyph.path_list.size - 1);+ + foreach (EditPoint ep in p.points) {+ if (ep.get_right_handle ().is_line () || ep.get_left_handle ().is_line ()) {+ ep.set_tie_handle (false);+ }++ if (!ep.get_right_handle ().is_line () || !ep.get_left_handle ().is_line ()) {+ ep.convert_to_curve ();+ }+ }+ } public void set_samples_per_point (double s) { samples_per_point = s;@@ -233,6 +251,7 @@ public class TrackTool : Tool { if (DrawingTools.get_selected_point_type () == PointType.QUADRATIC) { foreach (EditPoint e in p.points) { if (e.tie_handles) {+ e.convert_to_curve (); e.process_tied_handle (); } }@@ -463,7 +482,9 @@ public class TrackTool : Tool { EditPoint average; Path p; Glyph glyph;- Gee.ArrayList<EditPoint> points = new Gee.ArrayList<EditPoint> ();+ Gee.ArrayList<EditPoint> points;+ + points = new Gee.ArrayList<EditPoint> (); if (added_points == 0) { warning ("No points to add.");@@ -515,6 +536,7 @@ public class TrackTool : Tool { if (p.points.size > 2) { PenTool.convert_point_to_line (average.get_prev (), true); average.get_prev ().process_tied_handle ();+ average.get_prev ().set_tie_handle (false); } }