From 20a8f520ff6adc6609fff97ccb3b6a1ea42b65ab Mon Sep 17 00:00:00 2001 From: cilix42 Date: Tue, 11 Sep 2007 12:25:12 +0000 Subject: [PATCH] Use angle step from prefs for rotation of PLs; Alt+parentheses rotate PLs by (constant) small amount --- src/box3d-context.cpp | 13 +++++++------ src/perspective3d.cpp | 5 +++-- src/perspective3d.h | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp index 818a87c6c..cb6dd1d0b 100644 --- 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 db4f564c7..3c7529c16 100644 --- a/src/perspective3d.cpp +++ b/src/perspective3d.cpp @@ -204,12 +204,13 @@ Perspective3D::set_infinite_direction (Box3D::Axis axis, NR::Point const dir) } 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 a431e1f99..caf503e0d 100644 --- a/src/perspective3d.h +++ b/src/perspective3d.h @@ -36,7 +36,7 @@ public: 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; -- 2.30.2