summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a5c383e)
raw | patch | inline | side by side (parent: a5c383e)
author | cilix42 <cilix42@users.sourceforge.net> | |
Tue, 11 Sep 2007 12:25:12 +0000 (12:25 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Tue, 11 Sep 2007 12:25:12 +0000 (12:25 +0000) |
src/box3d-context.cpp | patch | blob | history | |
src/perspective3d.cpp | patch | blob | history | |
src/perspective3d.h | patch | blob | history |
diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp
index 818a87c6c6d0a32ae56c85c10d32c9b65b6bad76..cb6dd1d0b4fa4c57db2a0d3642af6d7165a95431 100644 (file)
--- a/src/box3d-context.cpp
+++ b/src/box3d-context.cpp
@@ -295,6 +295,7 @@ static gint sp_3dbox_context_root_handler(SPEventContext *event_context, GdkEven
SPDesktop *desktop = event_context->desktop;
Inkscape::Selection *selection = sp_desktop_selection (desktop);
+ int const snaps = prefs_get_int_attribute("options.rotationsnapsperpi", "value", 12);
SP3DBoxContext *bc = SP_3DBOX_CONTEXT(event_context);
@@ -452,32 +453,32 @@ static gint sp_3dbox_context_root_handler(SPEventContext *event_context, GdkEven
break;
case GDK_bracketright:
- inkscape_active_document()->current_perspective->rotate (Box3D::X, -10);
+ inkscape_active_document()->current_perspective->rotate (Box3D::X, -180/snaps, MOD__ALT);
ret = true;
break;
case GDK_bracketleft:
- inkscape_active_document()->current_perspective->rotate (Box3D::X, 10);
+ inkscape_active_document()->current_perspective->rotate (Box3D::X, 180/snaps, MOD__ALT);
ret = true;
break;
case GDK_parenright:
- inkscape_active_document()->current_perspective->rotate (Box3D::Y, -10);
+ inkscape_active_document()->current_perspective->rotate (Box3D::Y, -180/snaps, MOD__ALT);
ret = true;
break;
case GDK_parenleft:
- inkscape_active_document()->current_perspective->rotate (Box3D::Y, 10);
+ inkscape_active_document()->current_perspective->rotate (Box3D::Y, 180/snaps, MOD__ALT);
ret = true;
break;
case GDK_braceright:
- inkscape_active_document()->current_perspective->rotate (Box3D::Z, -10);
+ inkscape_active_document()->current_perspective->rotate (Box3D::Z, -180/snaps, MOD__ALT);
ret = true;
break;
case GDK_braceleft:
- inkscape_active_document()->current_perspective->rotate (Box3D::Z, 10);
+ inkscape_active_document()->current_perspective->rotate (Box3D::Z, 180/snaps, MOD__ALT);
ret = true;
break;
diff --git a/src/perspective3d.cpp b/src/perspective3d.cpp
index db4f564c7ec8a1d2c92ab8336fde798de0134054..3c7529c16aff11d884f2d7d057b738d68068d0ef 100644 (file)
--- a/src/perspective3d.cpp
+++ b/src/perspective3d.cpp
}
void
-Perspective3D::rotate (Box3D::Axis const axis, double const angle)
+Perspective3D::rotate (Box3D::Axis const axis, double const angle, bool const alt_pressed)
{
Box3D::VanishingPoint *vp = get_vanishing_point (axis);
if (!vp->is_finite()) {
+ double add_value = angle;
double a = NR::atan2 (vp->v_dir) * 180/M_PI;
- a += angle;
+ a += alt_pressed ? 0.5 * ((angle > 0 ) - (angle < 0)) : angle; // the r.h.s. yields +/-0.5 or angle
a *= M_PI/180;
this->set_infinite_direction (axis, NR::Point (cos (a), sin (a)));
}
diff --git a/src/perspective3d.h b/src/perspective3d.h
index a431e1f99846344588cd0afd1e7022a8f26c03ba..caf503e0daf45d5d609a0b131d83bd9fda4f5606 100644 (file)
--- a/src/perspective3d.h
+++ b/src/perspective3d.h
void set_vanishing_point (Box3D::Axis const dir, VanishingPoint const &pt);
void set_vanishing_point (Box3D::Axis const dir, gdouble pt_x, gdouble pt_y, gdouble dir_x, gdouble dir_y, VPState st);
void set_infinite_direction (Box3D::Axis axis, NR::Point const dir);
- void rotate (Box3D::Axis const dir, double const angle);
+ void rotate (Box3D::Axis const dir, double const angle, bool const alt_pressed = false);
void add_box (SP3DBox *box);
void remove_box (const SP3DBox *box);
bool has_box (const SP3DBox *box) const;