Permalink
Browse files

part.c modified to simplify code

  • Loading branch information...
1 parent c440c49 commit 7b138000b2f8b385d49fc95c577fb25dc2a2670e Marc Lorber committed May 1, 2012
Showing with 7 additions and 7 deletions.
  1. +7 −7 src/model/part.c
View
@@ -559,11 +559,11 @@ part_rotate (ItemData *data, int angle, SheetPos *center)
priv->pins[i].offset.y = y;
}
+ // Rotate the bounding box.
item_data_get_relative_bbox (ITEM_DATA (part), &b1, &b2);
- part_center_before.x = b1.x + (b2.x - b1.x) / 2;
- part_center_before.y = b1.y + (b2.y - b1.y) / 2;
+ part_center_before.x = (b1.x + b2.x) / 2;
+ part_center_before.y = (b1.y + b2.y) / 2;
- // Rotate the bounding box.
x = b1.x;
y = b1.y;
cairo_matrix_transform_point (&affine, &x, &y);
@@ -581,8 +581,8 @@ part_rotate (ItemData *data, int angle, SheetPos *center)
if (center) {
SheetPos part_pos;
- part_center_after.x = b1.x + (b2.x - b1.x) / 2;
- part_center_after.y = b1.y + (b2.y - b1.y) / 2;
+ part_center_after.x = (b1.x + b2.x) / 2;
+ part_center_after.y = (b1.y + b2.y) / 2;
dx = part_center_before.x - part_center_after.x;
dy = part_center_before.y - part_center_after.y;
@@ -711,8 +711,8 @@ gboolean emit_flipped_signal_when_handler_connected (gpointer data)
if (center) {
item_data_get_relative_bbox (ITEM_DATA (part), &b1, &b2);
- part_center_before.x = b1.x + (b2.x - b1.x) / 2;
- part_center_before.y = b1.y + (b2.y - b1.y) / 2;
+ part_center_before.x = (b1.x + b2.x) / 2;
+ part_center_before.y = (b1.y + b2.y) / 2;
}
// Flip the bounding box.

0 comments on commit 7b13800

Please sign in to comment.