# How to show and hide objects based on mouse interaction?

**URL:** https://discourse.paraview.org/t/how-to-show-and-hide-objects-based-on-mouse-interaction/8317
**Category:** Web Support
**Tags:** python
**Created:** [November 4, 2021, 10:23am UTC](https://discourse.paraview.org/t/how-to-show-and-hide-objects-based-on-mouse-interaction/8317 "2021-11-04T10:23:51Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ltphy](https://discourse.paraview.org/user_avatar/discourse.paraview.org/ltphy/32/7629_2.png) [@ltphy](https://discourse.paraview.org/u/ltphy)
#### Post date: [November 4, 2021, 10:23am UTC](https://discourse.paraview.org/t/how-to-show-and-hide-objects-based-on-mouse-interaction/8317/1 "2021-11-04T10:23:52Z")

</div>

I have multiple point cloud data that are positioned based on pose graph’s vertices and I want to visualize it partly based on the camera position.

The `updateZoomFromWheel` function has already been written by default as an example.

> <https://github.com/Kitware/web-project-templates/blob/badc180432b7f9af8410276781a4f7df086f736a/vue-vtkjs-pvw-template/server/vtkpython/vtk_protocol.py#L58>

- First question  
I want to write the mouse interaction function in the paraview’s backend which is similar to the following link. How can I achieve this?

> <https://github.com/Kitware/VTK/blob/5a3e0c25deba41d2087a1d60a9c7fd5d81d6e434/Web/Python/vtkmodules/web/protocols.py#L100>

- Second question  
What is the efficient way to load and unload data, I have already found two ways:

```auto
Hide(point_cloud_ply, viewProxy)

```

and

```auto
Delete(point_cloud_ply)
del point_cloud_ply

```

Delete method seems to be more efficient than Hide.

---

<div class="post-metadata">

### Author: ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)
#### Post date: [November 4, 2021, 3:07pm UTC](https://discourse.paraview.org/t/how-to-show-and-hide-objects-based-on-mouse-interaction/8317/2 "2021-11-04T15:07:40Z")

</div>

1. Do you want/need to write it yourself? Or do you want to use the existing one since it is available?
2. Delete deletes and Hide hides. So only Delete truly free memory.

---

<div class="post-metadata">

### Author: ![ltphy](https://discourse.paraview.org/user_avatar/discourse.paraview.org/ltphy/32/7629_2.png) [@ltphy](https://discourse.paraview.org/u/ltphy)
#### Post date: [November 5, 2021, 1:49am UTC](https://discourse.paraview.org/t/how-to-show-and-hide-objects-based-on-mouse-interaction/8317/3 "2021-11-05T01:49:56Z")

</div>

Thanks. The answer to the second question is clear to me.  
About the first question, I want to write it myself while using the existing one as reference.  
Because I want to delete and show 3D objects based on camera position which is affected by the user’s mouse input.

---

<div class="post-metadata">

### Author: ![ltphy](https://discourse.paraview.org/user_avatar/discourse.paraview.org/ltphy/32/7629_2.png) [@ltphy](https://discourse.paraview.org/u/ltphy)
#### Post date: [November 12, 2021, 4:49am UTC](https://discourse.paraview.org/t/how-to-show-and-hide-objects-based-on-mouse-interaction/8317/4 "2021-11-12T04:49:53Z")

</div>

Hi. Any update for this question? Does Paraview support overriding mouse interaction function to add other functionality?
