From 2a18c8b02a13574578146efdfd0ab76d5d5b6785 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 27 Jan 2011 17:14:28 +0000 Subject: [PATCH] From Eric Buehler, "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. " --- src/osgWidget/Window.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osgWidget/Window.cpp b/src/osgWidget/Window.cpp index b916988c2..14d1bd655 100644 --- a/src/osgWidget/Window.cpp +++ b/src/osgWidget/Window.cpp @@ -324,7 +324,7 @@ void Window::update() { else if(_vAnchor == VA_BOTTOM) y = 0.0f; if(_hAnchor == HA_LEFT) x = 0.0f; - else if(_hAnchor == HA_CENTER) x = osg::round(_wm->getWidth() / 2.0f); + else if(_hAnchor == HA_CENTER) x = osg::round((_wm->getWidth() - _width.current)/ 2.0f); else if(_hAnchor == HA_RIGHT) x = _wm->getWidth() - _width.current + _visibleArea[2]; xy.set(x, y);