summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/lldockablefloater.cpp15
-rw-r--r--indra/llui/lldockablefloater.h7
-rw-r--r--indra/llui/llui.cpp16
3 files changed, 32 insertions, 6 deletions
diff --git a/indra/llui/lldockablefloater.cpp b/indra/llui/lldockablefloater.cpp
index 4f5fcddbf4..f9983278d1 100644
--- a/indra/llui/lldockablefloater.cpp
+++ b/indra/llui/lldockablefloater.cpp
@@ -50,6 +50,7 @@ void LLDockableFloater::init(LLDockableFloater* thiz)
thiz->setCanDock(true);
thiz->setCanMinimize(TRUE);
thiz->setOverlapsScreenChannel(false);
+ thiz->mForceDocking = false;
}
LLDockableFloater::LLDockableFloater(LLDockControl* dockControl,
@@ -81,6 +82,12 @@ LLDockableFloater::~LLDockableFloater()
BOOL LLDockableFloater::postBuild()
{
+ // Remember we should force docking when the floater is opened for the first time
+ if (mIsDockedStateForcedCallback != NULL && mIsDockedStateForcedCallback())
+ {
+ mForceDocking = true;
+ }
+
mDockTongue = LLUI::getUIImage("windows/Flyout_Pointer.png");
LLFloater::setDocked(true);
return LLView::postBuild();
@@ -134,6 +141,14 @@ void LLDockableFloater::resetInstance()
void LLDockableFloater::setVisible(BOOL visible)
{
+ // Force docking if requested
+ if (visible && mForceDocking)
+ {
+ setCanDock(true);
+ setDocked(true);
+ mForceDocking = false;
+ }
+
if(visible && isDocked())
{
resetInstance();
diff --git a/indra/llui/lldockablefloater.h b/indra/llui/lldockablefloater.h
index 2b1ce99ae2..054d59b984 100644
--- a/indra/llui/lldockablefloater.h
+++ b/indra/llui/lldockablefloater.h
@@ -130,6 +130,10 @@ protected:
void setDockControl(LLDockControl* dockControl);
const LLUIImagePtr& getDockTongue();
+ // Checks if docking should be forced.
+ // It may be useful e.g. if floater created in mouselook mode (see EXT-5609)
+ boost::function<BOOL ()> mIsDockedStateForcedCallback;
+
private:
std::auto_ptr<LLDockControl> mDockControl;
LLUIImagePtr mDockTongue;
@@ -143,6 +147,9 @@ private:
bool mUseTongue;
bool mOverlapsScreenChannel;
+
+ // Force docking when the floater is being shown for the first time.
+ bool mForceDocking;
};
#endif /* LL_DOCKABLEFLOATER_H */
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index ee308f575a..5d8b628776 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -477,8 +477,8 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex
}
// add in offset of current image to current ui translation
- const LLVector3 ui_translation = gGL.getUITranslation() + LLVector3(x, y, 0.f);
const LLVector3 ui_scale = gGL.getUIScale();
+ const LLVector3 ui_translation = (gGL.getUITranslation() + LLVector3(x, y, 0.f)).scaledVec(ui_scale);
F32 uv_width = uv_outer_rect.getWidth();
F32 uv_height = uv_outer_rect.getHeight();
@@ -514,8 +514,8 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex
F32 shrink_scale = 1.f - llmax(shrink_width_ratio, shrink_height_ratio);
draw_center_rect.mLeft = llround(ui_translation.mV[VX] + (F32)draw_center_rect.mLeft * shrink_scale * ui_scale.mV[VX]);
- draw_center_rect.mTop = llround(ui_translation.mV[VY] + lerp((F32)height, (F32)draw_center_rect.mTop, shrink_scale * ui_scale.mV[VY]));
- draw_center_rect.mRight = llround(ui_translation.mV[VX] + lerp((F32)width, (F32)draw_center_rect.mRight, shrink_scale * ui_scale.mV[VX]));
+ draw_center_rect.mTop = llround(ui_translation.mV[VY] + lerp((F32)height, (F32)draw_center_rect.mTop, shrink_scale) * ui_scale.mV[VY]);
+ draw_center_rect.mRight = llround(ui_translation.mV[VX] + lerp((F32)width, (F32)draw_center_rect.mRight, shrink_scale) * ui_scale.mV[VX]);
draw_center_rect.mBottom = llround(ui_translation.mV[VY] + (F32)draw_center_rect.mBottom * shrink_scale * ui_scale.mV[VY]);
}
@@ -735,17 +735,21 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
gGL.begin(LLRender::QUADS);
{
+ LLVector3 ui_scale = gGL.getUIScale();
LLVector3 ui_translation = gGL.getUITranslation();
ui_translation.mV[VX] += x;
ui_translation.mV[VY] += y;
+ ui_translation.scaleVec(ui_scale);
S32 index = 0;
+ S32 scaled_width = llround(width * ui_scale.mV[VX]);
+ S32 scaled_height = llround(height * ui_scale.mV[VY]);
uv[index] = LLVector2(uv_rect.mRight, uv_rect.mTop);
- pos[index] = LLVector3(ui_translation.mV[VX] + width, ui_translation.mV[VY] + height, 0.f);
+ pos[index] = LLVector3(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY] + scaled_height, 0.f);
index++;
uv[index] = LLVector2(uv_rect.mLeft, uv_rect.mTop);
- pos[index] = LLVector3(ui_translation.mV[VX], ui_translation.mV[VY] + height, 0.f);
+ pos[index] = LLVector3(ui_translation.mV[VX], ui_translation.mV[VY] + scaled_height, 0.f);
index++;
uv[index] = LLVector2(uv_rect.mLeft, uv_rect.mBottom);
@@ -753,7 +757,7 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
index++;
uv[index] = LLVector2(uv_rect.mRight, uv_rect.mBottom);
- pos[index] = LLVector3(ui_translation.mV[VX] + width, ui_translation.mV[VY], 0.f);
+ pos[index] = LLVector3(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY], 0.f);
index++;
gGL.vertexBatchPreTransformed(pos, uv, NUM_VERTICES);