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

void sp_selection_rotate_screen ( Inkscape::Selection selection,
gdouble  angle 
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())

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

    if ( !bbox || !center ) {

    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);

                           ( (angle > 0)
                             ? "selector:rotate:ccw"
                             : "selector:rotate:cw" ),
                           _("Rotate by pixels"));

Here is the call graph for this function:

Generated by  Doxygen 1.6.0   Back to index