Updated Files
libbirdfont/CircleTool.vala |
libbirdfont/RectangleTool.vala |
libbirdfont/ResizeTool.vala |
libbirdfont/SettingsDisplay.vala |
libbirdfont/StrokeTool.vala |
--- a/libbirdfont/CircleTool.vala
+++ b/libbirdfont/CircleTool.vala
@@ -55,16 +55,19 @@
double dy = last_y - y;
double p = PenTool.precision;
double ratio, diameter, radius, cx, cy, nx, ny;
+ double xmin, xmax, ymin;
if (move_circle) {
circle.move (Glyph.ivz () * -dx * p, Glyph.ivz () * dy * p);
+ circle.reset_stroke ();
}
if (resize_circle) {
- circle.update_region_boundaries ();
- diameter = circle.xmax - circle.xmin;
- cx = circle.xmin + diameter / 2;
- cy = circle.ymin + diameter / 2;
+ get_boundaries (out xmin, out xmax, out ymin);
+
+ diameter = xmax - xmin;
+ cx = xmin + diameter / 2;
+ cy = ymin + diameter / 2;
radius = Path.distance_pixels (press_x, press_y, x, y);
ratio = 2 * radius / diameter;
@@ -73,20 +76,42 @@
circle.resize (ratio);
}
- diameter = circle.xmax - circle.xmin;
- nx = circle.xmin + diameter / 2;
- ny = circle.ymin + diameter / 2;
+ get_boundaries (out xmin, out xmax, out ymin);
+
+ diameter = xmax - xmin;
+ nx = xmin + diameter / 2;
+ ny = ymin + diameter / 2;
- circle.update_region_boundaries ();
circle.move (cx - nx, cy - ny);
last_radius = radius;
+ circle.reset_stroke ();
+ circle.update_region_boundaries ();
}
last_x = x;
last_y = y;
GlyphCanvas.redraw ();
+ }
+
+ void get_boundaries (out double xmin, out double xmax, out double ymin) {
+ xmin = Glyph.CANVAS_MAX;
+ xmax = Glyph.CANVAS_MIN;
+ ymin = Glyph.CANVAS_MAX;
+ foreach (EditPoint p in circle.points) {
+ if (p.x < xmin) {
+ xmin = p.x;
+ }
+
+ if (p.x > xmax) {
+ xmax = p.x;
+ }
+
+ if (p.y < ymin) {
+ ymin = p.y;
+ }
+ }
}
void press (int button, double x, double y) {
@@ -118,6 +143,10 @@
path.init_point_type ();
path.close ();
path.recalculate_linear_handles ();
+
+ if (StrokeTool.add_stroke) {
+ path.stroke = StrokeTool.stroke_width;
+ }
for (int i = 0; i < 3; i++) {
foreach (EditPoint ep in path.points) {
--- a/libbirdfont/RectangleTool.vala
+++ b/libbirdfont/RectangleTool.vala
@@ -70,6 +70,10 @@
rectangle.add (x2, y2);
rectangle.add (x1, y2);
+ if (StrokeTool.add_stroke) {
+ rectangle.stroke = StrokeTool.stroke_width;
+ }
+
rectangle.init_point_type ();
rectangle.close ();
@@ -78,6 +82,9 @@
foreach (EditPoint e in rectangle.points) {
e.recalculate_linear_handles ();
}
+
+ rectangle.reset_stroke ();
+ rectangle.update_region_boundaries ();
GlyphCanvas.redraw ();
}
--- a/libbirdfont/ResizeTool.vala
+++ b/libbirdfont/ResizeTool.vala
@@ -109,6 +109,8 @@
});
move_action.connect ((self, x, y) => {
+ Glyph glyph;
+
if (resize_path && can_resize (x, y)) {
resize (x, y);
}
@@ -118,6 +120,12 @@
}
if (move_paths || rotate_path || resize_path) {
+ glyph = MainWindow.get_current_glyph ();
+
+ foreach (Path selected_path in glyph.active_paths) {
+ selected_path.reset_stroke ();
+ }
+
update_selection_box ();
GlyphCanvas.redraw ();
}
@@ -150,7 +158,7 @@
});
key_press_action.connect ((self, keyval) => {
- DrawingTools.move_tool.key_press (keyval);
+ DrawingTools.move_tool.key_down (keyval);
});
}
--- a/libbirdfont/SettingsDisplay.vala
+++ b/libbirdfont/SettingsDisplay.vala
@@ -102,7 +102,7 @@
public override void key_release (uint keyval) {
SettingsItem old_key_binding;
- if (!KeyBindings.is_modifier_key (keyval)) {
+ if (!is_modifier_key (keyval)) {
if (update_key_bindings) {
if (keyval == Key.BACK_SPACE) {
update_key_bindings = false;
--- a/libbirdfont/StrokeTool.vala
+++ b/libbirdfont/StrokeTool.vala
@@ -1811,8 +1811,7 @@
add_corner (side2, previous_inside, start, p2.copy (), thickness);
}
} else {
- print (@"l.angle + r.angle $(l.angle) + $(r.angle) $(fabs (l.angle + r.angle % (2 * PI) - PI) )\n");
-
+ // FIXME: DELETE
//previous.flags |= EditPoint.CURVE;
//previous_inside.flags |= EditPoint.CURVE;
}