The Birdfont Source Code


All Repositories / birdfont.git / commitdiff – RSS feed

Fix zero length handles

These changes was commited to the Birdfont repository Sun, 01 Nov 2015 16:13:35 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
[Sun, 01 Nov 2015 16:13:35 +0000]

Updated Files

libbirdfont/BezierTool.vala
--- a/libbirdfont/BezierTool.vala +++ b/libbirdfont/BezierTool.vala @@ -244,7 +244,6 @@ public void release (int b, int x, int y) { double px, py; Glyph g; - EditPoint first, last; if (!button_down) { warning ("Discarding event."); @@ -295,24 +294,30 @@ current_path.force_direction (Direction.COUNTER_CLOCKWISE); } else { current_path.force_direction (Direction.CLOCKWISE); - } - - first = current_path.get_first_point (); - if (first.get_right_handle ().length == 0) { - first.convert_to_line (); - } - - last = current_path.get_last_point (); - if (last.get_left_handle ().length == 0) { - last.convert_to_line (); } current_path.reset_stroke (); state = NONE; } + + convert_zero_length_handles_to_lines (); } + void convert_zero_length_handles_to_lines () { + EditPoint first, last; + + first = current_path.get_first_point (); + if (first.get_right_handle ().length == 0) { + first.convert_to_line (); + } + + last = current_path.get_last_point (); + if (last.get_left_handle ().length == 0) { + last.convert_to_line (); + } + } + public void move (int x, int y) { double px, py;