# Is there a way to allow mouse clicks to pass to object beneath

**URL:** <https://forum.inductiveautomation.com/t/is-there-a-way-to-allow-mouse-clicks-to-pass-to-object-beneath/17093>\
**Category:** Ignition\
**Created:** [February 22, 2018, 4:23pm UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-allow-mouse-clicks-to-pass-to-object-beneath/17093 "2018-02-22T16:23:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dws2384](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@dws2384](https://forum.inductiveautomation.com/u/dws2384)\
**Post date:** [February 22, 2018, 4:23pm UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-allow-mouse-clicks-to-pass-to-object-beneath/17093/1 "2018-02-22T16:23:18Z")

</div>

I have some overlaying objects on top of a larger object. Is there a way that when clicking on these overlaying objects the event for the object beneath is executed. I know I can group them and put the code there but was wondering if there is a way to pass it through?

---

<div class="post-metadata">

**Author:** ![bfuson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bfuson/32/4597_2.png) [@bfuson](https://forum.inductiveautomation.com/u/bfuson)\
**Post date:** [February 22, 2018, 10:50pm UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-allow-mouse-clicks-to-pass-to-object-beneath/17093/2 "2018-02-22T22:50:37Z")

</div>

You could do a hit-test in the OnMouseClicked event of your overlaying component.

I was able to implement this with custom methods named “clicked” on various vision components. A semi-transparent rectangle overlays all the components and performs the hit-tests.

Here’s the hit-test code:

```auto
from com.inductiveautomation.vision.api.client.components.shapes import PathBasedVisionShape

for comp in event.source.parent.getComponents():
	if comp == event.source:
		continue
	if isinstance(comp, PathBasedVisionShape):
		if comp.getBoundingRect().contains(event.point):
			comp.clicked()
	else:
		if comp.bounds.contains(event.point):
			comp.clicked()

```

It’s necessary to perform the type check before the hit-test because only shapes have the getBoundingRect() method. Curiously, the bounds property of vision shapes doesn’t store the actual layout information. For most standard vision/swing components, component.bounds works fine.

https://i.imgur.com/ySWJRNM.gifv?twitter#t
