WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Drag and drop Panels (https://forum.worldviz.com/showthread.php?t=5851)

Eugene 09-15-2016 01:27 PM

Drag and drop Panels
 
Hi Jeff,

I've created a few panels and would like to allow the user to relocate the panel using the mouse. Similar to moving a window. May I know how can I do that in vizard?

Thanks.

Eugene

Jeff 09-16-2016 04:41 AM

Are you referring to a vizinfo panel? There is no built-in way to do this. I'm not sure if the viz.pick command will work with objects added to viz.ORTHO, like the panel. I'll check and update here if there is a way. It maybe necessary to calculate if a mouse click is within a panel's bounds. You could try the following:

1) Calculate the panel bounds using the node.getBoundingBox method.
2) Handle the mouse down event and determine if the mouse position is inside the panel bounds.
3) Enable an update function that sets the panel position every frame based on the mouse position. The panel position takes screen coordinates and you can get the mouse position in screen coordinates.
4) Disable the update function when the mouse up event occurs.

Eugene 09-16-2016 07:58 AM

Hi Jeff,

I'm using the vizdlg.panel() and vizdlg.TabPanel(). Would it be different?

Eugene

Jeff 09-20-2016 06:45 AM

No, you would have to follow the same steps.


All times are GMT -7. The time now is 09:12 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC