Commit a56ee07
Tie axis coordinates to 0, 45, 90 ... degrees
Changed files (2)
Diff
@@ -826,21 +826,31 @@ public class PenTool : Tool { } else { coordinate_x = Glyph.path_coordinate_x (x); coordinate_y = Glyph.path_coordinate_y (y);- delta_coordinate_x = coordinate_x - last_point_x;- delta_coordinate_y = coordinate_y - last_point_y; - selected_handle.move_delta_coordinate (delta_coordinate_x, delta_coordinate_y);+ selected_handle.x = coordinate_x;+ selected_handle.y = coordinate_y; if (on_axis) {- double horizontal, vertical;-- horizontal = Path.distance (selected_handle.parent.x, selected_handle.x, selected_handle.y, selected_handle.y);- vertical = Path.distance (selected_handle.x, selected_handle.x, selected_handle.parent.y, selected_handle.y);-- if (horizontal < vertical) {- selected_handle.move_to_coordinate (selected_handle.parent.x, selected_handle.y);- } else {- selected_handle.move_to_coordinate (selected_handle.x, selected_handle.parent.y);- } + double length = fabs (Path.distance (selected_handle.parent.x, coordinate_x,+ selected_handle.parent.y, coordinate_y));+ + double min = double.MAX;+ double circle_edge;+ double circle_x;+ double circle_y;+ + for (double circle_angle = 0; circle_angle < 2 * PI; circle_angle += PI / 4) {+ circle_x = selected_handle.parent.x + cos (circle_angle) * length;+ circle_y = selected_handle.parent.y + sin (circle_angle) * length;+ + circle_edge = fabs (Path.distance (coordinate_x, circle_x, + coordinate_y, circle_y));+ + if (circle_edge < min) {+ selected_handle.x = circle_x;+ selected_handle.y = circle_y;+ min = circle_edge;+ }+ } } } @@ -134,7 +134,6 @@ public class FallbackFont : GLib.Object { idle.set_callback (() => { font_config = config;- print("Fontconfog loaded."); return false; }); idle.attach (null);