# BoundingBoxGizmo displays unexpected highlighting behavior on touch devices

**URL:** <https://forum.babylonjs.com/t/boundingboxgizmo-displays-unexpected-highlighting-behavior-on-touch-devices/37197>\
**Category:** Bugs\
**Tags:** gizmo, mobile\
**Created:** [January 9, 2023, 12:34am UTC](https://forum.babylonjs.com/t/boundingboxgizmo-displays-unexpected-highlighting-behavior-on-touch-devices/37197 "2023-01-09T00:34:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hsifnus](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/hsifnus/32/19243_2.png) [@Hsifnus](https://forum.babylonjs.com/u/Hsifnus)\
**Post date:** [January 9, 2023, 12:34am UTC](https://forum.babylonjs.com/t/boundingboxgizmo-displays-unexpected-highlighting-behavior-on-touch-devices/37197/1 "2023-01-09T00:34:12Z")

</div>

> **[Babylon.js Playground](https://playground.babylonjs.com/#SG9ZZB%2325)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

In the above playground, when the blue `BoundingBoxGizmo` (out-of-the-box implementation) has its scale boxes dragged on touch devices (real or browser-emulated), the behavior of the the scale box highlighting deviates from the behavior that occurs when dragging the scale boxes with mouse.

- **Mouse** : A scale box highlights when selected by mouse `pointerDown` and unhighlights when the mouse leaves the scale box’s area or by a subsequent `pointerUp`.
- **Touch** : A scale box highlights when pressed by touch and appears to only unhighlight when the touching finger leaves the scale box’s area. Releasing the finger from the selected scale box without moving the finger out of the scale box’s area beforehand causes the scale box to remain highlighted.

The purple `BoundingBoxGizmo` extends the base implementation and adds an extra drag-end observer that resets the material of the scale box back to the unhighlighted material whenever a touch release is detected, allowing the touch highlighting behavior to be consistent with that of mouse highlighting for the gizmo. Perhaps this touch release detection could be implemented directly into the base `BoundingBoxGizmo` class?

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [January 9, 2023, 10:34am UTC](https://forum.babylonjs.com/t/boundingboxgizmo-displays-unexpected-highlighting-behavior-on-touch-devices/37197/2 "2023-01-09T10:34:18Z")

</div>

Welcome aboard!

cc @Cedric who is our Gizmo wizard!

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [January 9, 2023, 2:30pm UTC](https://forum.babylonjs.com/t/boundingboxgizmo-displays-unexpected-highlighting-behavior-on-touch-devices/37197/3 "2023-01-09T14:30:15Z")

</div>

This looks like a cool addition! Can you please open a PR @Hsifnus ?

---

<div class="post-metadata">

**Author:** ![Hsifnus](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/hsifnus/32/19243_2.png) [@Hsifnus](https://forum.babylonjs.com/u/Hsifnus)\
**Post date:** [January 10, 2023, 4:35am UTC](https://forum.babylonjs.com/t/boundingboxgizmo-displays-unexpected-highlighting-behavior-on-touch-devices/37197/4 "2023-01-10T04:35:05Z")

</div>

Sure thing! Opened a PR [here](https://github.com/BabylonJS/Babylon.js/pull/13428).
