The Birdfont Source Code
Fix object selection and flicker less in freehand tool
These changes was commited to the Birdfont repository Fri, 01 May 2015 12:26:01 +0000.
Contributing
Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
Fix object selection and flicker less in freehand tool
--- a/libbirdfont/MainWindow.vala
+++ b/libbirdfont/MainWindow.vala
@@ -129,10 +129,15 @@
Tool t = tools.get_current_tool ();
if (! (t is MoveTool || t is ResizeTool)) {
- Toolbox.select_tool_by_name ("move");
+ get_toolbox ().select_tool (DrawingTools.move_tool);
}
- DrawingTools.move_tool.select_all_paths ();
+ IdleSource idle = new IdleSource ();
+ idle.set_callback (() => {
+ DrawingTools.move_tool.select_all_paths ();
+ return false;
+ });
+ idle.attach (null);
}
public static DrawingTools get_drawing_tools () {
--- a/libbirdfont/MoveTool.vala
+++ b/libbirdfont/MoveTool.vala
@@ -80,6 +80,11 @@
// delete selected paths
if (keyval == Key.DEL || keyval == Key.BACK_SPACE) {
+
+ if (g.active_paths.size > 0) {
+ g.store_undo_state ();
+ }
+
foreach (Path p in g.active_paths) {
g.path_list.remove (p);
g.update_view ();
--- a/libbirdfont/StrokeTool.vala
+++ b/libbirdfont/StrokeTool.vala
@@ -1717,12 +1717,17 @@
p1 = path.points.get (i % path.points.size);
p2 = path.points.get ((i + 1) % path.points.size);
p3 = path.points.get ((i + 2) % path.points.size);
-
+
tolerance = 0.13 / sqrt (stroke_width);
step_increment = 1.1;
step_size = 0.039 / stroke_width;
corner1 = new EditPoint ();
+
+ if (p1.type == PointType.HIDDEN
+ || p2.type == PointType.HIDDEN) {
+ continue;
+ }
step = 0;
while (step < 1 - 2 * step_size) {
@@ -1776,7 +1781,7 @@
l = p2.get_left_handle ();
r = p2.get_right_handle ();
- if (fabs (l.angle + r.angle - PI) % 2 * PI > 0.0001) {
+ if (fabs (l.angle + r.angle - PI) % 2 * PI > 0.01) {
if (!path.is_open () || i < size - 1) {
get_segment (thickness, 0, 0.00001, p2, p3, out start);
add_corner (side1, previous, start, p2.copy (), thickness);
--- a/libbirdfont/TrackTool.vala
+++ b/libbirdfont/TrackTool.vala
@@ -511,6 +511,7 @@
px = Glyph.reverse_path_coordinate_x (nx);
py = Glyph.reverse_path_coordinate_y (ny);
average = PenTool.add_new_edit_point (px, py).point;
+ average.type = PointType.HIDDEN; //FIXME:
// tie handles for all points except for the end points
average.set_tie_handle (p.points.size > 1);
@@ -525,6 +526,7 @@
PenTool.convert_point_to_line (average.get_prev (), true);
average.get_prev ().process_tied_handle ();
average.get_prev ().set_tie_handle (false);
+ average.get_prev ().type = PointType.CUBIC; //FIXME:
}
}