| 122593 | }); |
| 122594 | } |
| 122595 | function pick(context42, scene, x32, y31, gx, gy) { |
| 122596 | if (scene.bounds && !scene.bounds.contains(gx, gy) || !scene.items) return null; |
| 122597 | const cx = x32 * context42.pixelRatio, cy = y31 * context42.pixelRatio; |
| 122598 | return pickVisit(scene, (group5)=>{ |
| 122599 | let hit4, dx, dy; // first hit test bounding box |
| 122600 | const b14 = group5.bounds; |
| 122601 | if (b14 && !b14.contains(gx, gy)) return; // passed bounds check, test rectangular clip |
| 122602 | dx = group5.x || 0; |
| 122603 | dy = group5.y || 0; |
| 122604 | const dw = dx + (group5.width || 0), dh = dy + (group5.height || 0), c = group5.clip; |
| 122605 | if (c && (gx < dx || gx > dw || gy < dy || gy > dh)) return; // adjust coordinate system |
| 122606 | context42.save(); |
| 122607 | context42.translate(dx, dy); |
| 122608 | dx = gx - dx; |
| 122609 | dy = gy - dy; // test background for rounded corner clip |
| 122610 | if (c && hasCornerRadius(group5) && !hitCorner(context42, group5, cx, cy)) { |
| 122611 | context42.restore(); |
| 122612 | return null; |
| 122613 | } |
| 122614 | const fore = group5.strokeForeground, ix = scene.interactive !== false; // hit test against group foreground |
| 122615 | if (ix && fore && group5.stroke && hitForeground(context42, group5, cx, cy)) { |
| 122616 | context42.restore(); |
| 122617 | return group5; |
| 122618 | } // hit test against contained marks |
| 122619 | hit4 = pickVisit(group5, (mark)=>pickMark(mark, dx, dy) ? this.pick(mark, x32, y31, dx, dy) : null); // hit test against group background |
| 122620 | if (!hit4 && ix && (group5.fill || !fore && group5.stroke) && hitBackground(context42, group5, cx, cy)) hit4 = group5; |
| 122621 | // restore state and return |
| 122622 | context42.restore(); |
| 122623 | return hit4 || null; |
| 122624 | }); |
| 122625 | } |
| 122626 | function pickMark(mark, x33, y32) { |
| 122627 | return (mark.interactive !== false || mark.marktype === "group") && mark.bounds && mark.bounds.contains(x33, y32); |
| 122628 | } |