I believe that the osgWidget::Window::HA_CENTER alignment should be center 
aligned rather than by the origin, as the osgWidget::Window::VA_TOP causes.

The current setAnchorHorizontal() command doesn't center the center of the 
object, it just center's the object's origin.  The following change to 
osgWidget::Window::update() will correct that behavior so that it is consistent 
with setAnchorVertical() behavior.

Original trunk/src/osgWidget/Window.cpp v:10624:


Code:
309 void Window::update() {
...
320    // We only honor ANCHOR requests on topmost Windows, not embedded ones.
321    if((_vAnchor != VA_NONE || _hAnchor != HA_NONE) && !_parent && _wm) {
322       if(_vAnchor == VA_TOP) y = _wm->getHeight() - _height.current;
323       else if(_vAnchor == VA_CENTER) y = osg::round(_wm->getHeight() / 
2.0f);
324       else if(_vAnchor == VA_BOTTOM) y = 0.0f;
325 
326       if(_hAnchor == HA_LEFT) x = 0.0f;
327       else if(_hAnchor == HA_CENTER) x = osg::round(_wm->getWidth() / 2.0f);
328       else if(_hAnchor == HA_RIGHT) x = _wm->getWidth() - _width.current + 
_visibleArea[2];
329 
330         xy.set(x, y);



New

Code:
327       else if(_hAnchor == HA_CENTER) x = osg::round((_wm->getWidth() - 
_width.current) / 2.0f);




Thank you!
Eric[/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=35778#35778





_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to