The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Fix point selection in Beziér tool

These changes was commited to the Birdfont repository Sun, 03 May 2015 17:36:49 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
author Johan Mattsson <johan.mattsson.m@gmail.com>
Sun, 03 May 2015 17:36:49 +0000 (19:36 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Sun, 03 May 2015 17:47:06 +0000 (19:47 +0200)
commit 7b1841f882a8a72ecad4010a9b45de4f932f5a44
tree 4773b4a3b0c408b0917efcd51b60e3907f63b4d4
parent 4d2ee8dded54bd96144170f2c80cc1ca211d45bc
Fix point selection in Beziér tool

libbirdfont/ForesightTool.vala
libbirdfont/PenTool.vala
--- a/libbirdfont/ForesightTool.vala +++ b/libbirdfont/ForesightTool.vala @@ -72,7 +72,7 @@ bool one_point = false; MainWindow.set_cursor (NativeWindow.HIDDEN); - + if (b == 2) { stop_drawing (); return; @@ -87,7 +87,7 @@ if (previous_point > 0) { previous_point = 0; state = MOVE_POINT; - } else { + } else { if (state == MOVE_POINT) { state = MOVE_HANDLES; @@ -135,19 +135,21 @@ 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); } }); @@ -156,7 +158,7 @@ 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); } @@ -323,24 +325,24 @@ 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 (); - 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); - } + state = NONE; + MainWindow.set_cursor (NativeWindow.VISIBLE); } public Path get_active_path () {
--- a/libbirdfont/PenTool.vala +++ b/libbirdfont/PenTool.vala @@ -143,7 +143,12 @@ 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 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 (); }