The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Create path for new points when SVG objects are selected

These changes was commited to the Birdfont repository Fri, 24 Jun 2016 14:37:26 +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>
Fri, 24 Jun 2016 14:37:26 +0000 (16:37 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Fri, 24 Jun 2016 14:37:26 +0000 (16:37 +0200)
commit 2e19bcb3866cac1284b3f13e0adfb7c8917c7694
tree 47b4c0a2a34ccbbbdd9010928b8a4babf28b23b8
parent f75b2b6cf33e041aa358c51d4346e0678f3a2e76
Create path for new points when SVG objects are selected

libbirdfont/Glyph.vala
libbirdfont/PenTool.vala
--- a/libbirdfont/Glyph.vala +++ b/libbirdfont/Glyph.vala @@ -306,6 +306,16 @@ PenTool.active_path = path.get_path (); } } + } + + public bool has_active_path_objects () { + foreach (SvgBird.Object object in active_paths) { + if (object is PathObject) { + return true; + } + } + + return false; } public bool active_paths_contains (SvgBird.Object object) {
--- a/libbirdfont/PenTool.vala +++ b/libbirdfont/PenTool.vala @@ -1836,7 +1836,9 @@ Glyph g = MainWindow.get_current_glyph (); PathObject path; - if (g.active_paths.size == 0) { + print ("Insert\n"); + + if (!g.has_active_path_objects ()) { np = new Path (); g.add_path (np); np.stroke = stroke ? StrokeTool.stroke_width : 0; @@ -1864,8 +1866,12 @@ if (DrawingTools.pen_tool.is_selected ()) { np.stroke = PenTool.path_stroke_width; } + + path = new PathObject.for_path (np); + g.add_active_object (null, path); PenTool.active_path = np; + PenTool.selected_path = np; } g.clear_active_paths ();