summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2007-09-11 18:52:42 +0000
committercilix42 <cilix42@users.sourceforge.net>2007-09-11 18:52:42 +0000
commit5cd4a51fc2b0ad30c4baf94d77c8322eb5295bea (patch)
tree75d791104b5108841a443c165c5fc5cf0b3af3aa /src
parentUpdate shortcuts for 3D box tool (diff)
downloadinkscape-5cd4a51fc2b0ad30c4baf94d77c8322eb5295bea.tar.gz
inkscape-5cd4a51fc2b0ad30c4baf94d77c8322eb5295bea.zip
Compute farthest-from-center point correctly in Alt+rotation
(bzr r3723)
Diffstat (limited to 'src')
-rw-r--r--src/libnr/nr-rect.cpp12
-rw-r--r--src/libnr/nr-rect.h2
-rw-r--r--src/selection-chemistry.cpp2
3 files changed, 15 insertions, 1 deletions
diff --git a/src/libnr/nr-rect.cpp b/src/libnr/nr-rect.cpp
index 72bced37b..f3036eff1 100644
--- a/src/libnr/nr-rect.cpp
+++ b/src/libnr/nr-rect.cpp
@@ -266,6 +266,18 @@ Point Rect::midpoint() const {
return ( _min + _max ) / 2;
}
+Point Rect::cornerFarthestFrom(Point const &p) const {
+ Point m = midpoint();
+ unsigned i = 0;
+ if (p[X] < m[X]) {
+ i = 1;
+ }
+ if (p[Y] < m[Y]) {
+ i = 3 - i;
+ }
+ return corner(i);
+}
+
/** returns a vector from topleft to bottom right. */
Point Rect::dimensions() const {
return _max - _min;
diff --git a/src/libnr/nr-rect.h b/src/libnr/nr-rect.h
index 46aff13f4..439538e29 100644
--- a/src/libnr/nr-rect.h
+++ b/src/libnr/nr-rect.h
@@ -53,6 +53,8 @@ public:
/** returns the midpoint of this rect. */
Point midpoint() const;
+ Point cornerFarthestFrom(Point const &p) const;
+
/** True iff either width or height is less than \a epsilon. */
bool isEmpty(double epsilon=1e-6) const {
return isEmpty<X>(epsilon) || isEmpty<Y>(epsilon);
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index a8cb4d4fe..251aa6dc0 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -1759,7 +1759,7 @@ sp_selection_rotate_screen(Inkscape::Selection *selection, gdouble angle)
gdouble const zoom = selection->desktop()->current_zoom();
gdouble const zmove = angle / zoom;
- gdouble const r = NR::L2(bbox->max() - *center);
+ gdouble const r = NR::L2(bbox->cornerFarthestFrom(*center) - *center);
gdouble const zangle = 180 * atan2(zmove, r) / M_PI;