Logo Search packages:      
Sourcecode: inkscape version File versions

void GrDrag::addDragger ( GrDraggable draggable  ) 

If there already exists a dragger within MERGE_DIST of p, add the draggable to it; otherwise create new dragger and add it to draggers list

Definition at line 896 of file gradient-drag.cpp.

References GrDragger::addDraggable(), GrDraggable::fill_or_stroke, GrDraggable::item, NR::L2(), GrDragger::mayMerge(), GrDragger::point, GrDraggable::point_num, and GrDragger::updateKnotShape().

Referenced by addDraggersLinear(), and addDraggersRadial().

{
    NR::Point p = sp_item_gradient_get_coords (draggable->item, draggable->point_num, draggable->fill_or_stroke);

    for (GList *i = this->draggers; i != NULL; i = i->next) {
        GrDragger *dragger = (GrDragger *) i->data;
        if (dragger->mayMerge (draggable) && NR::L2 (dragger->point - p) < MERGE_DIST) {
            // distance is small, merge this draggable into dragger, no need to create new dragger
            dragger->addDraggable (draggable);
            dragger->updateKnotShape();
            return;
        }
    }

    GrDragger *new_dragger = new GrDragger(this, p, draggable);
    this->draggers = g_list_prepend (this->draggers, new_dragger);
}


Generated by  Doxygen 1.6.0   Back to index