The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Update resize center when objects are moved

These changes was commited to the Birdfont repository Tue, 28 Jun 2016 12:23:14 +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>
Tue, 28 Jun 2016 12:23:14 +0000 (14:23 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Tue, 28 Jun 2016 12:23:14 +0000 (14:23 +0200)
commit 3fd033e06500994d27fb4566f1b34ef8c7db66a9
tree 6de726bfa0f521e3e6395af4286c476c1d585104
parent 4c0e4afdd9fca81d8fc07d14952ff393132a3620
Update resize center when objects are moved

libbirdfont/EmbeddedSvg.vala
libbirdfont/ResizeTool.vala
--- a/libbirdfont/EmbeddedSvg.vala +++ b/libbirdfont/EmbeddedSvg.vala @@ -87,19 +87,20 @@ svg.append ("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"); svg.append ("""<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">"""); svg.append ("\n"); - - svg.append ("<g"); string transforms = transforms.get_xml (); if (transforms != "") { + svg.append ("<g"); svg.append (@" transform=\"$(transforms)\""); + svg.append (">\n"); } - - svg.append (">\n"); svg.append (remove_xml_header (svg_data)); - svg.append ("</g>\n"); + + if (transforms != "") { + svg.append ("</g>\n"); + } svg.append ("</svg>\n");
--- a/libbirdfont/ResizeTool.vala +++ b/libbirdfont/ResizeTool.vala @@ -64,23 +64,8 @@ horizontal_handle.load_font ("icons.bf"); Theme.text_color (horizontal_handle, "Highlighted 1"); - DrawingTools.move_tool.selection_changed.connect (() => { - Glyph glyph = MainWindow.get_current_glyph (); - SvgBird.Object path; - - if (glyph.active_paths.size > 0) { - path = glyph.active_paths.get (glyph.active_paths.size - 1); - - if (path is PathObject) { - last_rotate = ((PathObject) path).get_path ().rotation; - } else { - last_rotate = path.transforms.total_rotation; - } - } - - rotation = last_rotate; - update_resized_boundaries (); - }); + DrawingTools.move_tool.selection_changed.connect (update_position); + DrawingTools.move_tool.objects_moved.connect (update_position); select_action.connect((self) => { }); @@ -227,6 +212,25 @@ key_press_action.connect ((self, keyval) => { DrawingTools.move_tool.key_down (keyval); }); + } + + public void update_position () { + Glyph glyph = MainWindow.get_current_glyph (); + SvgBird.Object path; + + if (glyph.active_paths.size > 0) { + path = glyph.active_paths.get (glyph.active_paths.size - 1); + + if (path is PathObject) { + last_rotate = ((PathObject) path).get_path ().rotation; + } else { + last_rotate = path.transforms.total_rotation; + } + } + + rotation = last_rotate; + update_selection_box (); + update_resized_boundaries (); } public static void get_resize_handle_position (out double px, out double py) {