Comment 10 for bug 365458

Revision history for this message
Martin Sucha (martin-sucha) wrote :

I investigated this issue a little and it seems that it actually did not work (even) in Inkscape 0.46.

In 0.46, you can select invisible (clipped/masked) objects as well. The difference is that you need to click inside bounding box of visible part of the clipped object, so if you try this just with rectangles, it seems it is working. However, if you try this with e.g. circles, you can select that invisible part of the clipped object (provided you click inside the bounding box).

In current version (to be precise r9020, but I think it is current enough), you can select invisible parts of clipped objects even outside of that "small" bounding box that was in effect in 0.46. Please note that you cannot select invisible objects outside of area of drawing (as when you select "Resize page to drawing or selection" in Document properties). So it appears handling of bounding boxes is at least inconsistent in whether invisible parts of masked objects should be selected or not.

So one may say that neither version behaves correctly.

The change in behavior described above was caused by revision 7451, in nr_arena_item.cpp, nr_arena_item_invoke_update function, particularly:
@@ -272,7 +278,8 @@
             item->state |= NR_ARENA_ITEM_STATE_INVALID;
             return item->state;
         }
- nr_rect_l_intersect (&item->bbox, &item->bbox, &item->clip->bbox);
+ // for clipping, we need geometric bbox
+ nr_rect_l_intersect (&item->drawbox, &item->drawbox, &item->clip->bbox);
     }
     /* Masking */
     if (item->mask) {
@@ -281,7 +288,14 @@
             item->state |= NR_ARENA_ITEM_STATE_INVALID;
             return item->state;
         }
- nr_rect_l_intersect (&item->bbox, &item->bbox, &item->mask->bbox);
+ // for masking, we need full drawbox of mask
+ nr_rect_l_intersect (&item->drawbox, &item->drawbox, &item->mask->drawbox);
+ }

I believe it is not good idea just to revert this change though, unless there is not a better option, as it would not solve the problem for non rectangular clip/mask and if I understood it correctly it fixed some rendering issues.

Also I have thought about what the correct behavior really is. For clip it is obvious, but what to do with ([semi]transparent/bitmap) masks?
One option would be to take the shape of mask when testing for hits. Other option would be to look whether the mask completely hides the masked object at the mouse location
(consider greyscale bitmap or gradient used as a mask...).
(Probably this could be configurable as well)