summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2019-01-30 21:51:59 +0200
committerandreykproductengine <andreykproductengine@lindenlab.com>2019-01-30 21:51:59 +0200
commit16b47db736fed0995eaeeed77ba4dd0d310f1072 (patch)
treeb9686fcd100dded5a9ac4c4b8b70bdbb91681f24
parent17a4093223ce735696eb27103bfff64ef49cbe81 (diff)
SL-10279 Remake altitude 'bumping'
-rw-r--r--indra/newview/llpanelenvironment.cpp110
-rw-r--r--indra/newview/skins/default/xui/en/panel_region_environment.xml2
2 files changed, 84 insertions, 28 deletions
diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp
index 0e2c7bcaac..8f279c07ba 100644
--- a/indra/newview/llpanelenvironment.cpp
+++ b/indra/newview/llpanelenvironment.cpp
@@ -343,8 +343,6 @@ std::string LLPanelEnvironmentInfo::getInventoryNameForAssetId(LLUUID asset_id)
std::string LLPanelEnvironmentInfo::getNameForTrackIndex(S32 index)
{
std::string invname;
-
- LL_WARNS("ENVPANEL") << "mDayCycleName='" << mCurrentEnvironment->mDayCycleName << "'" << LL_ENDL;
if (mCurrentEnvironment->mDayCycleName.empty())
{
invname = mCurrentEnvironment->mNameList[index];
@@ -583,41 +581,101 @@ void LLPanelEnvironmentInfo::readjustAltLabels()
{
// Re-adjust all labels
// Very simple "adjust after the fact" method
- // Note: labels can be in any ordered
- for (U32 i = 0; i < ALTITUDE_SLIDER_COUNT - 1; i++)
- {
- LLView* view_cmp = findChild<LLView>(alt_panels[i]);
+ // Note: labels can be in any order
+
+ LLMultiSliderCtrl *sld = findChild<LLMultiSliderCtrl>(SLD_ALTITUDES);
+ if (!sld) return;
- for (U32 j = i + 1; j < ALTITUDE_SLIDER_COUNT; j++)
+ LLView* view_midle = NULL;
+ U32 midle_ind = 0;
+ S32 shift_up = 0;
+ S32 shift_down = 0;
+ LLRect sld_rect = sld->getRect();
+
+ // Find the middle one
+ for (U32 i = 0; i < ALTITUDE_SLIDER_COUNT; i++)
+ {
+ LLView* cmp_view = findChild<LLView>(alt_panels[i], true);
+ if (!cmp_view) return;
+ LLRect cmp_rect = cmp_view->getRect();
+ S32 pos = 0;
+ shift_up = 0;
+ shift_down = 0;
+
+ for (U32 j = 0; j < ALTITUDE_SLIDER_COUNT; j++)
{
- LLView* view_intr = findChild<LLView>(alt_panels[j]);
- if (view_cmp && view_intr)
+ if (i != j)
{
- LLRect cmp_rect = view_cmp->getRect();
- LLRect intr_rect = view_intr->getRect();
- S32 shift = 0;
- if (cmp_rect.mBottom <= intr_rect.mTop && cmp_rect.mBottom >= intr_rect.mBottom)
+ LLView* intr_view = findChild<LLView>(alt_panels[j], true);
+ if (!intr_view) return;
+ LLRect intr_rect = intr_view->getRect();
+ if (cmp_rect.mBottom >= intr_rect.mBottom)
{
- // Approximate shift
- // We probably will need more runs over all labels to get accurate shift
- // At the moment single cycle should do since we have too little elements to do something complicated
- shift = (cmp_rect.mBottom - intr_rect.mTop) / 2;
+ pos++;
}
- else if (cmp_rect.mTop >= intr_rect.mBottom && cmp_rect.mTop <= intr_rect.mTop)
+ if (intr_rect.mBottom <= cmp_rect.mTop && intr_rect.mBottom >= cmp_rect.mBottom)
{
- // Approximate shift
- shift = (cmp_rect.mTop - intr_rect.mBottom) / 2;
+ shift_up = cmp_rect.mTop - intr_rect.mBottom;
}
- if (shift != 0)
+ else if (intr_rect.mTop >= cmp_rect.mBottom && intr_rect.mBottom <= cmp_rect.mBottom)
{
- cmp_rect.translate(0, -shift);
- view_cmp->setRect(cmp_rect);
-
- intr_rect.translate(0, shift);
- view_intr->setRect(intr_rect);
+ shift_down = cmp_rect.mBottom - intr_rect.mTop;
}
}
}
+ if (pos == 1) // middle
+ {
+ view_midle = cmp_view;
+ midle_ind = i;
+ break;
+ }
+ }
+
+ // Account for edges
+ LLRect midle_rect = view_midle->getRect();
+ F32 factor = 0.5f;
+ S32 edge_zone_height = midle_rect.getHeight() * 1.5f;
+
+ if (midle_rect.mBottom - sld_rect.mBottom < edge_zone_height)
+ {
+ factor = 1 - ((midle_rect.mBottom - sld_rect.mBottom) / (edge_zone_height * 2));
+ }
+ else if (sld_rect.mTop - midle_rect.mTop < edge_zone_height )
+ {
+ factor = ((sld_rect.mTop - midle_rect.mTop) / (edge_zone_height * 2));
+ }
+
+ S32 shift_middle = (S32)(((F32)shift_down * factor) + ((F32)shift_up * (1.f - factor)));
+ shift_down = shift_down - shift_middle;
+ shift_up = shift_up - shift_middle;
+
+ // fix crossings
+ for (U32 i = 0; i < ALTITUDE_SLIDER_COUNT; i++)
+ {
+ if (i != midle_ind)
+ {
+ LLView* trn_view = findChild<LLView>(alt_panels[i], true);
+ LLRect trn_rect = trn_view->getRect();
+
+ if (trn_rect.mBottom <= midle_rect.mTop && trn_rect.mBottom >= midle_rect.mBottom)
+ {
+ // Approximate shift
+ trn_rect.translate(0, shift_up);
+ trn_view->setRect(trn_rect);
+ }
+ else if (trn_rect.mTop >= midle_rect.mBottom && trn_rect.mBottom <= midle_rect.mBottom)
+ {
+ // Approximate shift
+ trn_rect.translate(0, shift_down);
+ trn_view->setRect(trn_rect);
+ }
+ }
+ }
+
+ if (shift_middle != 0)
+ {
+ midle_rect.translate(0, -shift_middle); //reversed relative to others
+ view_midle->setRect(midle_rect);
}
}
diff --git a/indra/newview/skins/default/xui/en/panel_region_environment.xml b/indra/newview/skins/default/xui/en/panel_region_environment.xml
index 51926351c0..77858ecbc4 100644
--- a/indra/newview/skins/default/xui/en/panel_region_environment.xml
+++ b/indra/newview/skins/default/xui/en/panel_region_environment.xml
@@ -251,7 +251,6 @@
enabled="false"
top_delta="3"
left_pad="21"
- xxxleft="-160"
height="20"
layout="topleft"
name="edt_invname_alt1"
@@ -296,7 +295,6 @@
enabled="false"
top_delta="3"
left_pad="21"
- xxxleft="-160"
height="20"
layout="topleft"
name="edt_invname_alt2"