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

void sp_nodepath_selected_align ( Inkscape::NodePath::Path nodepath,
Geom::Dim2  axis 
)

Align selected nodes on the specified axis.

Definition at line 1905 of file nodepath.cpp.

References Inkscape::NodePath::Node::pos, Inkscape::NodePath::Path::selected, sp_node_moveto(), and sp_nodepath_update_repr().

{
    if ( !nodepath || !nodepath->selected ) { // no nodepath, or no nodes selected
        return;
    }

    if ( !nodepath->selected->next ) { // only one node selected
        return;
    }
   Inkscape::NodePath::Node *pNode = reinterpret_cast<Inkscape::NodePath::Node *>(nodepath->selected->data);
    Geom::Point dest(pNode->pos);
    for (GList *l = nodepath->selected; l != NULL; l = l->next) {
        pNode = reinterpret_cast<Inkscape::NodePath::Node *>(l->data);
        if (pNode) {
            dest[axis] = pNode->pos[axis];
            sp_node_moveto(pNode, dest);
        }
    }

    sp_nodepath_update_repr(nodepath, _("Align nodes"));
}


Generated by  Doxygen 1.6.0   Back to index