summaryrefslogtreecommitdiffstats
path: root/src/box3d.cpp
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2008-01-15 19:59:14 +0000
committercilix42 <cilix42@users.sourceforge.net>2008-01-15 19:59:14 +0000
commit0c28093a93343e3aca1126307fa312b1a7b1160f (patch)
treeb23ffa2fb675392d968546b85c9d1a9dae4a6a9c /src/box3d.cpp
parentRegisteredWidget has been renamed to RegisteredWdg. This is a deprecated clas... (diff)
downloadinkscape-0c28093a93343e3aca1126307fa312b1a7b1160f.tar.gz
inkscape-0c28093a93343e3aca1126307fa312b1a7b1160f.zip
Fix wrong offset when Ctrl+dragging 3D boxes by their center
(bzr r4497)
Diffstat (limited to 'src/box3d.cpp')
-rw-r--r--src/box3d.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/box3d.cpp b/src/box3d.cpp
index 3c40a4800..f28dc8f26 100644
--- a/src/box3d.cpp
+++ b/src/box3d.cpp
@@ -53,8 +53,6 @@ static NR::Matrix box3d_set_transform(SPItem *item, NR::Matrix const &xform);
static void box3d_ref_changed(SPObject *old_ref, SPObject *ref, SPBox3D *box);
static void box3d_ref_modified(SPObject *href, guint flags, SPBox3D *box);
-//static void box3d_ref_changed(SPObject *old_ref, SPObject *ref, Persp3D *persp);
-//static void box3d_ref_modified(SPObject *href, guint flags, Persp3D *persp);
static SPGroupClass *parent_class;
@@ -616,6 +614,9 @@ box3d_set_corner (SPBox3D *box, const guint id, NR::Point const &new_pos, const
void box3d_set_center (SPBox3D *box, NR::Point const &new_pos, NR::Point const &old_pos, const Box3D::Axis movement, bool constrained) {
g_return_if_fail ((movement != Box3D::NONE) && (movement != Box3D::XYZ));
+ box->orig_corner0.normalize();
+ box->orig_corner7.normalize();
+
Persp3D *persp = box3d_get_perspective(box);
if (!(movement & Box3D::Z)) {
double coord = (box->orig_corner0[Proj::Z] + box->orig_corner7[Proj::Z]) / 2;
@@ -625,6 +626,7 @@ void box3d_set_center (SPBox3D *box, NR::Point const &new_pos, NR::Point const &
Proj::Pt3 pt_proj (persp->tmat.preimage (new_pos, coord, Proj::Z));
if (constrained) {
Proj::Pt3 old_pos_proj (persp->tmat.preimage (old_pos, coord, Proj::Z));
+ old_pos_proj.normalize();
pt_proj = box3d_snap (box, -1, pt_proj, old_pos_proj);
}
// normalizing pt_proj is essential because we want to mingle affine coordinates