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

void SPItem::setCenter ( Geom::Point  object_centre  )  [inherited]

Sets the transform_center_x and transform_center_y properties to retain the rotation centre

Definition at line 296 of file sp-item.cpp.

References SPItem::getBounds(), sp_document_ensure_up_to_date(), and sp_item_i2d_affine().

Referenced by sp_selection_apply_affine().

                                         {
    // for getBounds() to work
    sp_document_ensure_up_to_date( this->document );

    Geom::OptRect bbox = getBounds(sp_item_i2d_affine(this));
    if (bbox) {
        transform_center_x = object_centre[Geom::X] - bbox->midpoint()[Geom::X];
        if (fabs(transform_center_x) < 1e-5) // rounding error
            transform_center_x = 0;
        transform_center_y = object_centre[Geom::Y] - bbox->midpoint()[Geom::Y];
        if (fabs(transform_center_y) < 1e-5) // rounding error
            transform_center_y = 0;
    }
}


Generated by  Doxygen 1.6.0   Back to index