summaryrefslogtreecommitdiffstats
path: root/src/box3d.cpp
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2007-12-26 11:19:54 +0000
committercilix42 <cilix42@users.sourceforge.net>2007-12-26 11:19:54 +0000
commitc3707d1f929ff303572094636ec5f9edf4431f3e (patch)
treeed04a22de2074382126ffb503688517e0b1cda6b /src/box3d.cpp
parentmore on cairo ps/pdf options (diff)
downloadinkscape-c3707d1f929ff303572094636ec5f9edf4431f3e.tar.gz
inkscape-c3707d1f929ff303572094636ec5f9edf4431f3e.zip
Don't show boxes as everted (i.e., always show the same sides) during initial drag, regardless of the mouse pointer position.
(bzr r4306)
Diffstat (limited to 'src/box3d.cpp')
-rw-r--r--src/box3d.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/box3d.cpp b/src/box3d.cpp
index 4044b5647..0f9f8defe 100644
--- a/src/box3d.cpp
+++ b/src/box3d.cpp
@@ -1362,6 +1362,41 @@ box3d_relabel_corners(SPBox3D *box) {
box3d_swap_coords(box, Proj::Z, true);
}
+static void
+box3d_check_for_swapped_coords(SPBox3D *box, Proj::Axis axis, bool smaller) {
+ box->orig_corner0.normalize();
+ box->orig_corner7.normalize();
+
+ if ((box->orig_corner0[axis] < box->orig_corner7[axis]) != smaller) {
+ box->swapped = (Box3D::Axis) (box->swapped | Proj::toAffine(axis));
+ } else {
+ box->swapped = (Box3D::Axis) (box->swapped & ~Proj::toAffine(axis));
+ }
+}
+
+static void
+box3d_exchange_coords(SPBox3D *box) {
+ box->orig_corner0.normalize();
+ box->orig_corner7.normalize();
+
+ for (int i = 0; i < 3; ++i) {
+ if (box->swapped & Box3D::axes[i]) {
+ double tmp = box->orig_corner0[i];
+ box->orig_corner0[i] = box->orig_corner7[i];
+ box->orig_corner7[i] = tmp;
+ }
+ }
+}
+
+void
+box3d_check_for_swapped_coords(SPBox3D *box) {
+ box3d_check_for_swapped_coords(box, Proj::X, false);
+ box3d_check_for_swapped_coords(box, Proj::Y, false);
+ box3d_check_for_swapped_coords(box, Proj::Z, true);
+
+ box3d_exchange_coords(box);
+}
+
void
box3d_add_to_selection(SPBox3D *box) {
Persp3D *persp = box3d_get_perspective(box);