PDA

View Full Version : Custom-permanent tooltip


tokola
06-07-2015, 04:46 PM
I am trying to create a permanent tooltip using panels, but cannot make it work as desired. I basically want the panel/tooltip to be linked to an object (node) on screen, using normalized window coordinates. The problems are:
1. Using tooltips I get limited functionality/appearance and cannot seem to be able to translate to window coordinates (0-1). I couldn't find a way to convert the normalized coordinates in a window to pixels in the window (not world).
2. Using vizdlg panels I can format the panel as desired, but cannot link it to the object (a shape primitive). The offset does not work as expected although the object is added as a parent to the screen (not the world). Additionally, the panel does not follow the movement of the object, as would be expected from the linking.

I attach a script with my experiments. Both approaches can be seen and tested.

Help would be greatly appreciated!

Jeff
06-08-2015, 04:17 PM
The panel is added to the ortho layer so it is positioned in pixel coordinates. The shape is added to the screen and uses normalized screen coordinates. Linking the two will not work. You could get the window size and calculate the pixel coordinates to place the panel at:

windowSize = viz.window.getSize()
shapePos = self.s.getPosition()
self.panelLink = viz.link(viz.LeftBottom,self.tipTab)
self.panelLink.setOffset([windowSize[0]*shapePos[0],windowSize[1]*shapePos[1],0])

tokola
06-09-2015, 01:20 PM
OK, that does the trick, indeed. Thanks!

Just to verify. There is no simpler way (e.g. a command) that translates the screen normalized coordinates to window (ortho) pixel coordinates?