Logo Search packages:      
Sourcecode: inkscape version File versions

SPItem* find_group_at_point ( unsigned int  dkey,
SPGroup *  group,
NR::Point const   p 
)

Returns the topmost non-layer group from the descendants of group which is at point p, or NULL if none. Recurses into layers but not into groups.

Definition at line 995 of file document.cpp.

References sp_item_get_arenaitem().

{
    SPItem *seen = NULL;

    gdouble delta = prefs_get_double_attribute ("options.cursortolerance", "value", 1.0);

    for (SPObject *o = sp_object_first_child(SP_OBJECT(group)) ; o != NULL ; o = SP_OBJECT_NEXT(o) ) {
        if (!SP_IS_ITEM(o)) continue;
        if (SP_IS_GROUP(o) && SP_GROUP(o)->effectiveLayerMode(dkey) == SPGroup::LAYER) {
            SPItem *newseen = find_group_at_point(dkey, SP_GROUP(o), p);
            if (newseen) {
                seen = newseen;
            }
        }
        if (SP_IS_GROUP(o) && SP_GROUP(o)->effectiveLayerMode(dkey) != SPGroup::LAYER ) {
            SPItem *child = SP_ITEM(o);
            NRArenaItem *arenaitem = sp_item_get_arenaitem(child, dkey);

            // seen remembers the last (topmost) of groups pickable at this point
            if (arenaitem && nr_arena_item_invoke_pick(arenaitem, p, delta, 1) != NULL) {
                seen = child;
            }
        }
    }
    return seen;
}


Generated by  Doxygen 1.6.0   Back to index