Logo Search packages:      
Sourcecode: inkscape version File versions  Download package

void sp_selection_rotate_screen ( Inkscape::Selection selection,
gdouble  angle 
)
Parameters:
anglethe angle in "angular pixels", i.e. how many visible pixels must move the outermost point of the rotated object

Definition at line 1602 of file selection-chemistry.cpp.

References Geom::atan2(), Inkscape::Selection::bounds(), Inkscape::Selection::center(), Inkscape::Selection::desktop(), and Inkscape::Selection::isEmpty().

{
    if (selection->isEmpty())
        return;

    Geom::OptRect const bbox(selection->bounds());
    boost::optional<Geom::Point> center = selection->center();

    if ( !bbox || !center ) {
        return;
    }

    gdouble const zoom = selection->desktop()->current_zoom();
    gdouble const zmove = angle / zoom;
    gdouble const r = Geom::L2(cornerFarthestFrom(*bbox, *center) - *center);

    gdouble const zangle = 180 * atan2(zmove, r) / M_PI;

    sp_selection_rotate_relative(selection, *center, zangle);

    sp_document_maybe_done(sp_desktop_document(selection->desktop()),
                           ( (angle > 0)
                             ? "selector:rotate:ccw"
                             : "selector:rotate:cw" ),
                           SP_VERB_CONTEXT_SELECT,
                           _("Rotate by pixels"));
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index