summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bffd665)
raw | patch | inline | side by side (parent: bffd665)
author | cilix42 <cilix42@users.sourceforge.net> | |
Tue, 10 Jul 2007 13:19:35 +0000 (13:19 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Tue, 10 Jul 2007 13:19:35 +0000 (13:19 +0000) |
src/box3d-face.cpp | patch | blob | history | |
src/object-edit.cpp | patch | blob | history |
diff --git a/src/box3d-face.cpp b/src/box3d-face.cpp
index f45f4a6ed237ebbe73b8c044f8783eb84e472590..4f85fbf6e3308c02b5243a19ad93cb59fe2813ca 100644 (file)
--- a/src/box3d-face.cpp
+++ b/src/box3d-face.cpp
void Box3DFace::set_curve()
{
- SPDocument *doc = SP_OBJECT_DOCUMENT(this->parent_box3d);
- gdouble height = sp_document_height(doc);
-
if (this->path == NULL) {
g_warning("this->path is NULL! \n");
return;
}
+ NR::Matrix const i2d (sp_item_i2d_affine (SP_ITEM (this->parent_box3d)));
SPCurve *curve = sp_curve_new();
- sp_curve_moveto(curve, (*corners[0])[NR::X], height - (*corners[0])[NR::Y]);
- sp_curve_lineto(curve, (*corners[1])[NR::X], height - (*corners[1])[NR::Y]);
- sp_curve_lineto(curve, (*corners[2])[NR::X], height - (*corners[2])[NR::Y]);
- sp_curve_lineto(curve, (*corners[3])[NR::X], height - (*corners[3])[NR::Y]);
+ sp_curve_moveto(curve, (*corners[0]) * i2d);
+ sp_curve_lineto(curve, (*corners[1]) * i2d);
+ sp_curve_lineto(curve, (*corners[2]) * i2d);
+ sp_curve_lineto(curve, (*corners[3]) * i2d);
sp_curve_closepath(curve);
sp_shape_set_curve(SP_SHAPE(this->path), curve, true);
sp_curve_unref(curve);
gchar * Box3DFace::svg_repr_string()
{
- SPDocument *doc = SP_OBJECT_DOCUMENT(this->parent_box3d);
- gdouble height = sp_document_height(doc);
-
+ NR::Matrix const i2d (sp_item_i2d_affine (SP_ITEM (this->parent_box3d)));
GString *pstring = g_string_new("");
g_string_sprintf (pstring, "M %f,%f L %f,%f L %f,%f L %f,%f z",
- (*corners[0])[NR::X], height - (*corners[0])[NR::Y],
- (*corners[1])[NR::X], height - (*corners[1])[NR::Y],
- (*corners[2])[NR::X], height - (*corners[2])[NR::Y],
- (*corners[3])[NR::X], height - (*corners[3])[NR::Y]);
+ ((*corners[0]) * i2d)[NR::X], ((*corners[0]) * i2d)[NR::Y],
+ ((*corners[1]) * i2d)[NR::X], ((*corners[1]) * i2d)[NR::Y],
+ ((*corners[2]) * i2d)[NR::X], ((*corners[2]) * i2d)[NR::Y],
+ ((*corners[3]) * i2d)[NR::X], ((*corners[3]) * i2d)[NR::Y]);
return pstring->str;
}
diff --git a/src/object-edit.cpp b/src/object-edit.cpp
index 28886173c972a93ee3e57b54a59134d913a56abd..487caa09c503923bce9a949f5abdb701814e46cf 100644 (file)
--- a/src/object-edit.cpp
+++ b/src/object-edit.cpp
@@ -539,13 +539,12 @@ static void sp_3dbox_knot_set(SPItem *item, guint knot_id, Box3D::Axis direction
SPDocument *doc = SP_OBJECT_DOCUMENT(box);
gdouble height = sp_document_height(doc);
- if (direction == Box3D::Z) {
- sp_3dbox_move_corner_in_Z_direction (box, knot_id, NR::Point (new_pos[NR::X], height - new_pos[NR::Y]),
- !(state & GDK_SHIFT_MASK));
- } else {
- sp_3dbox_move_corner_in_XY_plane (box, knot_id, NR::Point (new_pos[NR::X], height - new_pos[NR::Y]),
- (state & GDK_SHIFT_MASK) ? direction : Box3D::XY);
- }
+ NR::Matrix const i2d (sp_item_i2d_affine (item));
+ if (direction == Box3D::Z) {
+ sp_3dbox_move_corner_in_Z_direction (box, knot_id, new_pos * i2d, !(state & GDK_SHIFT_MASK));
+ } else {
+ sp_3dbox_move_corner_in_XY_plane (box, knot_id, new_pos * i2d, (state & GDK_SHIFT_MASK) ? direction : Box3D::XY);
+ }
sp_3dbox_update_curves (box);
}
g_assert(item != NULL);
SP3DBox *box = SP_3DBOX(item);
- // FIXME: Why must the coordinates be flipped vertically???
- SPDocument *doc = SP_OBJECT_DOCUMENT(box);
- gdouble height = sp_document_height(doc);
-
- return NR::Point(sp_3dbox_get_corner(box, knot_id)[NR::X], height - sp_3dbox_get_corner(box, knot_id)[NR::Y]);
+ NR::Matrix const i2d (sp_item_i2d_affine (item));
+ return sp_3dbox_get_corner(box, knot_id) * i2d;
}
static void sp_3dbox_knot1_set(SPItem *item, NR::Point const &new_pos, NR::Point const &origin, guint state)