# IsPointerBlocker Improvement

**URL:** <https://forum.babylonjs.com/t/ispointerblocker-improvement/31152>\
**Category:** Feature requests\
**Created:** [June 8, 2022, 5:24am UTC](https://forum.babylonjs.com/t/ispointerblocker-improvement/31152 "2022-06-08T05:24:55Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Slimfinger](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@Slimfinger](https://forum.babylonjs.com/u/Slimfinger)\
**Post date:** [June 8, 2022, 5:24am UTC](https://forum.babylonjs.com/t/ispointerblocker-improvement/31152/1 "2022-06-08T05:24:55Z")

</div>

It appears that the GUI.Control.isPointerBlocker flag only allows one to stop pointer events from propagating through the scene. I’m curious why this doesn’t also stop the pointer events from propagating up the GUI control hierarchy. Perhaps even better would be another flag that separately controlled this (e.g., GUI.Control.isPointerGUIBlocker).

I’ve also noticed some other odd behavior with this flag. E.g., if I have code that “drag” animates a control with the mouse pointer, and which disables the scene’s pointer events via isPointerBlocker, I get a very noticeable slowdown in performance. (If anything, wouldn’t one expect an improvement in performance here?)

Additionally, I said “propagating up the control hierarchy” because that is indeed what seems to be happening. Mouse events activated by a control seemed to get passed on to its ancestors - regardless of their positions. (I.e., the “parent” control will receive the mouse event triggered by its child even when the mouse pointer isn’t actually positioned within the parent.) You can see that here:  
[https://playground.babylonjs.com/#0108NG#345](https://playground.babylonjs.com/#0108NG#345) . This doesn’t really seem optimal.

If I got anything wrong here (or I am simply missing the reasons for the current design) I would be grateful for the correction. If not, perhaps this behavior could be improved?

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [June 8, 2022, 4:04pm UTC](https://forum.babylonjs.com/t/ispointerblocker-improvement/31152/2 "2022-06-08T16:04:19Z")

</div>

cc @RaananW, @carolhmj and @DarraghBurke 😉

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [July 21, 2022, 1:08pm UTC](https://forum.babylonjs.com/t/ispointerblocker-improvement/31152/3 "2022-07-21T13:08:29Z")

</div>

> [@Slimfinger](#):
>
> E.g., if I have code that “drag” animates a control with the mouse pointer, and which disables the scene’s pointer events via isPointerBlocker, I get a very noticeable slowdown in performance.

Hey, I just wanted to check, do you have an example of this happening?

---

<div class="post-metadata">

**Author:** ![Slimfinger](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@Slimfinger](https://forum.babylonjs.com/u/Slimfinger)\
**Post date:** [July 21, 2022, 4:10pm UTC](https://forum.babylonjs.com/t/ispointerblocker-improvement/31152/4 "2022-07-21T16:10:11Z")

</div>

It happens very clearly in my codebase when I do nothing but set/unset that flag. To re-create this entire system in your playground would probably take me a day or two. I thought if I described the problem precisely, whomever wrote the “isPointerBlocker” logic might have enough insight to figure out why this occurs.

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [July 21, 2022, 4:37pm UTC](https://forum.babylonjs.com/t/ispointerblocker-improvement/31152/5 "2022-07-21T16:37:00Z")

</div>

You wouldn’t need to recreate the entire system, just enough for it to happen 🙂

---

<div class="post-metadata">

**Author:** ![Slimfinger](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@Slimfinger](https://forum.babylonjs.com/u/Slimfinger)\
**Post date:** [July 21, 2022, 4:43pm UTC](https://forum.babylonjs.com/t/ispointerblocker-improvement/31152/6 "2022-07-21T16:43:36Z")

</div>

Of course, that’s what I meant.

---

<div class="post-metadata">

**Author:** ![Slimfinger](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@Slimfinger](https://forum.babylonjs.com/u/Slimfinger)\
**Post date:** [July 21, 2022, 4:59pm UTC](https://forum.babylonjs.com/t/ispointerblocker-improvement/31152/7 "2022-07-21T16:59:53Z")

</div>

And think about it: regardless of what my (or anyone’s) code is doing, can you think of any reason why setting a flag that supposedly disables mouse pointer logic in the scene would ever decrease performance? My point is, it shouldn’t matter what code I am using, and nothing that I write should cause it to happen! 😃

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [July 21, 2022, 5:03pm UTC](https://forum.babylonjs.com/t/ispointerblocker-improvement/31152/8 "2022-07-21T17:03:12Z")

</div>

I agree that it shouldn’t be happening, it’s just that having a reproducible set up would make finding the root cause easier 😅

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [July 22, 2022, 7:24pm UTC](https://forum.babylonjs.com/t/ispointerblocker-improvement/31152/9 "2022-07-22T19:24:45Z")

</div>

PR up now with the events not going up the hierarchy if the control is a isPointerBlocker: [isPointerBlocker fixes by carolhmj · Pull Request #12787 · BabylonJS/Babylon.js (github.com)](https://github.com/BabylonJS/Babylon.js/pull/12787) 🙂

---

<div class="post-metadata">

**Author:** ![stevendelapena](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/stevendelapena/32/19322_2.png) [@stevendelapena](https://forum.babylonjs.com/u/stevendelapena)\
**Post date:** [August 17, 2022, 8:41pm UTC](https://forum.babylonjs.com/t/ispointerblocker-improvement/31152/10 "2022-08-17T20:41:30Z")

</div>

The new PR change appears to break existing behavior for scenes utilizing a Video and Photo Domes. Likely resulting from the fact the mesh covers the scene and captures inputs. So it may exist in other similar scenarios. See behavior. See PG: [https://playground.babylonjs.com/#SQ5UC1#375](https://playground.babylonjs.com/#SQ5UC1#375) and [https://playground.babylonjs.com/#14KRGG#715](https://playground.babylonjs.com/#14KRGG#715)

Click and drag from outside of GUI element to gain control of camera. Release mouse from within the GUI element. You’ll notice the camera is still observing the mouse movement and pans around with mouse even though click/pointer has been released.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [August 17, 2022, 8:42pm UTC](https://forum.babylonjs.com/t/ispointerblocker-improvement/31152/11 "2022-08-17T20:42:20Z")

</div>

Assigned @carolhmj on August 17, 2022, 8:42pm UTC



---

<div class="post-metadata">

**Author:** ![stevendelapena](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/stevendelapena/32/19322_2.png) [@stevendelapena](https://forum.babylonjs.com/u/stevendelapena)\
**Post date:** [August 18, 2022, 2:38am UTC](https://forum.babylonjs.com/t/ispointerblocker-improvement/31152/13 "2022-08-18T02:38:45Z")

</div>

If it helps, I created a PR on a fork just to highlight a fix that worked for my particular case. This allows the release (POINTER\_UP) to propagate up to the scene so the camera can remove its observer. [Fix Drag/Release Behavior in GUI and Photo Dome by stevendelapena · Pull Request #1 · stevendelapena/Babylon.js · GitHub](https://github.com/stevendelapena/Babylon.js/pull/1)

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [August 18, 2022, 10:31am UTC](https://forum.babylonjs.com/t/ispointerblocker-improvement/31152/14 "2022-08-18T10:31:08Z")

</div>

The fix makes sense to me, would you like to contribute it to the main project? 😃

---

<div class="post-metadata">

**Author:** ![stevendelapena](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/stevendelapena/32/19322_2.png) [@stevendelapena](https://forum.babylonjs.com/u/stevendelapena)\
**Post date:** [August 18, 2022, 3:23pm UTC](https://forum.babylonjs.com/t/ispointerblocker-improvement/31152/15 "2022-08-18T15:23:59Z")

</div>

Sure - will do.

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [August 22, 2022, 12:52pm UTC](https://forum.babylonjs.com/t/ispointerblocker-improvement/31152/16 "2022-08-22T12:52:34Z")

</div>

Unassigned @carolhmj on August 22, 2022, 12:52pm UTC


