diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2016-10-09 01:19:42 +0000 |
|---|---|---|
| committer | jabiertxof <info@marker.es> | 2016-10-09 01:19:42 +0000 |
| commit | 7f008cb2f657420416aef950a1576e1162c89fa4 (patch) | |
| tree | 6dad8fdecdf2af6f291b6b2dc76670d404dd5845 /src/viewbox.cpp | |
| parent | Update to trunk (diff) | |
| download | inkscape-7f008cb2f657420416aef950a1576e1162c89fa4.tar.gz inkscape-7f008cb2f657420416aef950a1576e1162c89fa4.zip | |
Added widget to to rotate
(bzr r15142.1.7)
Diffstat (limited to 'src/viewbox.cpp')
| -rw-r--r-- | src/viewbox.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/viewbox.cpp b/src/viewbox.cpp index dbbd462c8..d4e64a4da 100644 --- a/src/viewbox.cpp +++ b/src/viewbox.cpp @@ -251,13 +251,12 @@ void SPViewBox::apply_viewbox(const Geom::Rect& in, double scale_none) { vbt[4] = x - scale_x * this->viewBox.left(); vbt[5] = y - scale_y * this->viewBox.top(); /* Append viewbox and turn transformation */ + Geom::Point rot_center = Geom::Point(); + Geom::Point p = this->viewBox.midpoint(); + Geom::Affine rotcenter = Geom::identity(); + SPDesktop * desktop = SP_ACTIVE_DESKTOP; if (this->angle > 0.0 || this->angle < 0.0 ) { //!0 - Geom::Point r0 = this->viewBox.min(); - Geom::Point r1 = this->viewBox.max(); - Geom::Point p = (r0 + r1) / 2; - SPDesktop * desktop = SP_ACTIVE_DESKTOP; SPCanvasItem *vw_rot = NULL; - Geom::Point rot_center = Geom::Point(); if (desktop) { if (this->page_border_rotated) { desktop->remove_temporary_canvasitem(this->page_border_rotated); @@ -284,20 +283,15 @@ void SPViewBox::apply_viewbox(const Geom::Rect& in, double scale_none) { rot *= Geom::Translate(p).inverse() * Geom::Rotate(Geom::rad_from_deg(-angle)) * Geom::Translate(p); sp_canvas_item_affine_absolute(vw_rot, rot * vbt); this->page_border_rotated = desktop->add_temporary_canvasitem(vw_rot, 0); - Geom::Affine rotcenter = Geom::identity(); rotcenter *= Geom::Translate(p * vbt).inverse() * Geom::Rotate(Geom::rad_from_deg(this->angle - this->previous_angle)) * Geom::Translate(p * vbt); - rot_center = rot_center * rotcenter; } rotation = Geom::Translate(p).inverse() * Geom::Rotate(Geom::rad_from_deg(angle)) * Geom::Translate(p); this->c2p = rotation * vbt * this->c2p; - rot_center = desktop->dt2doc(rot_center); - if (desktop && this->rotated) { - desktop->zoom_relative(rot_center[Geom::X], rot_center[Geom::Y], 1.0); - this->rotated = false; - } } else { - SPDesktop * desktop = SP_ACTIVE_DESKTOP; if (desktop) { + Geom::Rect view = desktop->get_display_area(); + rot_center = desktop->doc2dt(view.midpoint()); + rotcenter *= Geom::Translate(p * vbt).inverse() * Geom::Rotate(Geom::rad_from_deg(this->angle - this->previous_angle)) * Geom::Translate(p * vbt); if (this->page_border_rotated) { desktop->remove_temporary_canvasitem(this->page_border_rotated); this->page_border_rotated = NULL; @@ -305,6 +299,11 @@ void SPViewBox::apply_viewbox(const Geom::Rect& in, double scale_none) { } this->c2p = vbt * this->c2p; } + if (desktop && this->rotated) { + rot_center = desktop->dt2doc(rot_center * rotcenter); + desktop->zoom_relative(rot_center[Geom::X], rot_center[Geom::Y], 1.0); + this->rotated = false; + } } |
