summaryrefslogtreecommitdiff
path: root/indra/llui/lldockcontrol.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/lldockcontrol.cpp')
-rw-r--r--indra/llui/lldockcontrol.cpp62
1 files changed, 39 insertions, 23 deletions
diff --git a/indra/llui/lldockcontrol.cpp b/indra/llui/lldockcontrol.cpp
index 6397bbd0de..af39e41fa6 100644
--- a/indra/llui/lldockcontrol.cpp
+++ b/indra/llui/lldockcontrol.cpp
@@ -100,12 +100,16 @@ void LLDockControl::repositionDockable()
if (!mDockWidget) return;
LLRect dockRect = mDockWidget->calcScreenRect();
LLRect rootRect;
+ LLRect floater_rect = mDockableFloater->calcScreenRect();
mGetAllowedRectCallback(rootRect);
- // recalculate dockable position if dock position changed, dock visibility changed,
- // root view rect changed or recalculation is forced
- if (mPrevDockRect != dockRect || mDockWidgetVisible != isDockVisible()
- || mRootRect != rootRect || mRecalculateDocablePosition)
+ // recalculate dockable position if:
+ if (mPrevDockRect != dockRect //dock position changed
+ || mDockWidgetVisible != isDockVisible() //dock visibility changed
+ || mRootRect != rootRect //root view rect changed
+ || mFloaterRect != floater_rect //floater rect changed
+ || mRecalculateDockablePosition //recalculation is forced
+ )
{
// undock dockable and off() if dock not visible
if (!isDockVisible())
@@ -136,7 +140,8 @@ void LLDockControl::repositionDockable()
mPrevDockRect = dockRect;
mRootRect = rootRect;
- mRecalculateDocablePosition = false;
+ mFloaterRect = floater_rect;
+ mRecalculateDockablePosition = false;
mDockWidgetVisible = isDockVisible();
}
}
@@ -203,21 +208,33 @@ void LLDockControl::moveDockable()
switch (mDockAt)
{
case LEFT:
- x = dockRect.mLeft;
- y = dockRect.mTop + mDockTongue->getHeight() + dockableRect.getHeight();
- // check is dockable inside root view rect
- if (x < rootRect.mLeft)
+
+ x = dockRect.mLeft - dockableRect.getWidth();
+ y = dockRect.getCenterY() + dockableRect.getHeight() / 2;
+
+ if (use_tongue)
{
- x = rootRect.mLeft;
+ x -= mDockTongue->getWidth();
}
- if (x + dockableRect.getWidth() > rootRect.mRight)
+
+ mDockTongueX = dockableRect.mRight;
+ mDockTongueY = dockableRect.getCenterY() - mDockTongue->getHeight() / 2;
+
+ break;
+
+ case RIGHT:
+
+ x = dockRect.mRight;
+ y = dockRect.getCenterY() + dockableRect.getHeight() / 2;
+
+ if (use_tongue)
{
- x = rootRect.mRight - dockableRect.getWidth();
+ x += mDockTongue->getWidth();
}
-
- mDockTongueX = x + dockableRect.getWidth()/2 - mDockTongue->getWidth() / 2;
-
- mDockTongueY = dockRect.mTop;
+
+ mDockTongueX = dockRect.mRight;
+ mDockTongueY = dockableRect.getCenterY() - mDockTongue->getHeight() / 2;
+
break;
case TOP:
@@ -315,13 +332,12 @@ void LLDockControl::moveDockable()
dockableRect.setLeftTopAndSize(x, y, dockableRect.getWidth(),
dockableRect.getHeight());
}
+
LLRect localDocableParentRect;
- mDockableFloater->getParent()->screenRectToLocal(dockableRect,
- &localDocableParentRect);
- mDockableFloater->setRect(localDocableParentRect);
- mDockableFloater->screenPointToLocal(mDockTongueX, mDockTongueY,
- &mDockTongueX, &mDockTongueY);
+ mDockableFloater->getParent()->screenRectToLocal(dockableRect, &localDocableParentRect);
+ mDockableFloater->setRect(localDocableParentRect);
+ mDockableFloater->screenPointToLocal(mDockTongueX, mDockTongueY, &mDockTongueX, &mDockTongueY);
}
@@ -330,7 +346,7 @@ void LLDockControl::on()
if (isDockVisible())
{
mEnabled = true;
- mRecalculateDocablePosition = true;
+ mRecalculateDockablePosition = true;
}
}
@@ -341,7 +357,7 @@ void LLDockControl::off()
void LLDockControl::forceRecalculatePosition()
{
- mRecalculateDocablePosition = true;
+ mRecalculateDockablePosition = true;
}
void LLDockControl::drawToungue()