From 2463c93b50c8c7a2bcd55074aa2f3611daaa452e Mon Sep 17 00:00:00 2001 From: lecoanet Date: Wed, 28 Jul 2004 14:41:34 +0000 Subject: Changed the group picking code to enable correct picking with a complex clipping shape. CVS: ---------------------------------------------------------------------- CVS: Enter Log. Lines beginning with `CVS: ' are removed automatically CVS: committing files: CVS: /home/lecoanet/TCLTK/Tkzinc-3.2.99/generic/Group.c CVS: CVS: Type C-c C-c when done or C-c C-d to abort. CVS: ---------------------------------------------------------------------- --- generic/Group.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'generic') diff --git a/generic/Group.c b/generic/Group.c index 509bd6f..5b5505e 100644 --- a/generic/Group.c +++ b/generic/Group.c @@ -1185,6 +1185,7 @@ Pick(ZnItem item, ZnBBox bbox, inter, *clip_box; ZnPoint *p = ps->point; ZnBool atomic; + TkRegion reg; ps->a_item= ZN_NO_ITEM; ps->a_part = ZN_NO_PART; @@ -1232,13 +1233,25 @@ Pick(ZnItem item, bbox.corner.x = p->x + (aperture?aperture:1); bbox.corner.y = p->y + (aperture?aperture:1); - if (ZnCurrentClip(wi, NULL, &clip_box, NULL)) { + if (ZnCurrentClip(wi, ®, &clip_box, NULL)) { ZnIntersectBBox(&bbox, clip_box, &inter); if (ZnIsEmptyBBox(&inter)) { goto out; } + if (reg && !ZnPointInRegion(reg, p->x, p->y)) { + goto out; + } } - + + if (group->clip) { + PushTransform(group->clip); + dist = group->clip->class->Pick(group->clip, ps); + PopTransform(group->clip); + if (dist > 0.0) { + goto out; + } + } + current_item = (ps->start_item == ZN_NO_ITEM) ? group->head : ps->start_item; atomic = ISSET(item->flags, ATOMIC_BIT) && !ps->override_atomic; -- cgit v1.1