[dia] [transform] Improve handling of pure translation and scaling
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] [transform] Improve handling of pure translation and scaling
- Date: Fri, 8 Oct 2010 18:55:10 +0000 (UTC)
commit 097b1df7fd9230789a9a8f4d58e2d1a9788166a8
Author: Hans Breuer <hans breuer org>
Date: Fri Oct 8 20:49:05 2010 +0200
[transform] Improve handling of pure translation and scaling
Use dia_matrix_is_identity() to drop identity matrix when passed
in to group_create_with_matrix(). The scaling in move_handle() had
issues on rotated groups. Scaling is now relative to top-left corner,
not only if it matches object position.
lib/group.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/lib/group.c b/lib/group.c
index b62ec4c..4b32994 100644
--- a/lib/group.c
+++ b/lib/group.c
@@ -206,7 +206,7 @@ group_move_handle(Group *group, Handle *handle, Point *to, ConnectionPoint *cp,
/* only flies, when the top left handle is the position */
gboolean also_move = ( group->resize_handles[0].pos.x == pos.x
&& group->resize_handles[0].pos.y == pos.y);
- Point top_left = group->resize_handles[0].pos;
+ Point top_left = { bb->left, bb->top };
Point delta;
/* before and after width and height */
real w0, h0, w1, h1;
@@ -259,8 +259,8 @@ group_move_handle(Group *group, Handle *handle, Point *to, ConnectionPoint *cp,
group->matrix->xx = 1.0;
group->matrix->yy = 1.0;
}
- group->matrix->xx *= (w1 / w0);
- group->matrix->yy *= (h1 / h0);
+
+ cairo_matrix_scale ((cairo_matrix_t *)group->matrix, w1 / w0, h1 / h0);
group_update_data(group);
@@ -471,6 +471,11 @@ group_create_with_matrix(GList *objects, DiaMatrix *matrix)
matrix->x0 = matrix->y0 = 0; /* offset used internally */
object_list_move_delta(group->objects, &delta);
}
+ if (dia_matrix_is_identity (matrix)) {
+ /* just drop it as it has no effect */
+ g_free (matrix);
+ matrix = NULL;
+ }
group->matrix = matrix;
group_update_data(group);
return &group->object;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]