Logo Search packages:      
Sourcecode: inkscape version File versions

SPItem* find_item_at_point ( unsigned int  dkey,
SPGroup *  group,
NR::Point const   p,
gboolean  into_groups,
bool  take_insensitive = false,
SPItem upto = NULL 

Returns the topmost (in z-order) item from the descendants of group (recursively) which is at the point p, or NULL if none. Honors into_groups on whether to recurse into non-layer groups or not. Honors take_insensitive on whether to return insensitive items. If upto != NULL, then if item upto is encountered (at any level), stops searching upwards in z-order and returns what it has found so far (i.e. the found item is guaranteed to be lower than upto).

Definition at line 953 of file document.cpp.

References SPItem::isVisibleAndUnlocked(), item_is_in_group(), and sp_item_get_arenaitem().

    SPItem *seen = NULL, *newseen = 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 (upto && SP_ITEM(o) == upto)

        if (SP_IS_GROUP(o) && (SP_GROUP(o)->effectiveLayerMode(dkey) == SPGroup::LAYER || into_groups))     {
            // if nothing found yet, recurse into the group
            newseen = find_item_at_point(dkey, SP_GROUP(o), p, into_groups, take_insensitive, upto);
            if (newseen) {
                seen = newseen;
                newseen = NULL;

            if (item_is_in_group(upto, SP_GROUP(o)))

        } else {
            SPItem *child = SP_ITEM(o);
            NRArenaItem *arenaitem = sp_item_get_arenaitem(child, dkey);

            // seen remembers the last (topmost) of items pickable at this point
            if (arenaitem && nr_arena_item_invoke_pick(arenaitem, p, delta, 1) != NULL
                && (take_insensitive || child->isVisibleAndUnlocked(dkey))) {
                seen = child;
    return seen;

Generated by  Doxygen 1.6.0   Back to index