[dia] svg: finally fix offset coming from group transform
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] svg: finally fix offset coming from group transform
- Date: Sun, 21 Jul 2013 14:21:17 +0000 (UTC)
commit 76416b89514a26801123951ce87e197c9d62c3b3
Author: Hans Breuer <hans breuer org>
Date: Sun Jul 21 15:49:59 2013 +0200
svg: finally fix offset coming from group transform
Test files:
h0us3s_Signs_Hazard_Warning.svg for group_transform()
Map_of_USA_with_state_names.svg for group_create_with_matrix()
lib/group.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/lib/group.c b/lib/group.c
index 260dd04..547fa92 100644
--- a/lib/group.c
+++ b/lib/group.c
@@ -501,6 +501,10 @@ group_create_with_matrix(GList *objects, DiaMatrix *matrix)
Group *group = (Group *)group_create(objects);
if (matrix->x0 != 0 || matrix->y0 != 0) {
Point delta = {matrix->x0, matrix->y0};
+ const Point *pos = &group->object.position;
+ /* the resulting offset is what we want to shift to */
+ delta.x += (matrix->xx * pos->x - pos->x);
+ delta.y += (matrix->yy * pos->y - pos->y);
matrix->x0 = matrix->y0 = 0; /* offset used internally */
object_list_move_delta(group->objects, &delta);
}
@@ -893,6 +897,10 @@ group_transform (Group *group, const DiaMatrix *m)
/* don't keep the offset in the matrix*/
if (group->matrix->x0 != 0 || group->matrix->y0 != 0) {
Point delta = {group->matrix->x0, group->matrix->y0};
+ const Point *pos = &group->object.position;
+ /* the resulting offset is what we want to shift to */
+ delta.x += (m->xx * pos->x - pos->x);
+ delta.y += (m->yy * pos->y - pos->y);
group->matrix->x0 = group->matrix->y0 = 0; /* offset used internally */
object_list_move_delta(group->objects, &delta);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]