Logo Search packages:      
Sourcecode: inkscape version File versions

void sp_nodepath_selected_align ( Path::Path nodepath,
NR::Dim2  axis 
)

Align selected nodes on the specified axis

Definition at line 944 of file nodepath.cpp.

References Path::Node::pos, and Path::Path::selected.

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

    if ( !nodepath->selected->next ) { // only one node selected
        return;
    }
    Path::Node *pNode = reinterpret_cast<Path::Node *>(nodepath->selected->data);
    NR::Point dest(pNode->pos);
    for (GList *l = nodepath->selected; l != NULL; l = l->next) {
        pNode = reinterpret_cast<Path::Node *>(l->data);
        if (pNode) {
            dest[axis] = pNode->pos[axis];
            sp_node_moveto(pNode, dest);
        }
    }
    if (axis == NR::X) {
        update_repr_keyed(nodepath, "node:move:vertical");
    } else {
        update_repr_keyed(nodepath, "node:move:horizontal");
    }
}


Generated by  Doxygen 1.6.0   Back to index