From f241e2327c3e28ed0692ec4f3a1a11ebf563b8bf Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Thu, 21 Oct 2010 17:13:09 -0700
Subject: [PATCH] made layout stack open/close time configurable

---
 indra/llui/lllayoutstack.cpp | 17 +++++++++--------
 indra/llui/lllayoutstack.h   |  4 ++++
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index 940c7e7e186..ac30fce3923 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -97,6 +97,8 @@ LLLayoutStack::Params::Params()
 :	orientation("orientation"),
 	animate("animate", true),
 	clip("clip", true),
+	open_time_constant("open_time_constant", 0.02f),
+	close_time_constant("close_time_constant", 0.03f),
 	border_size("border_size", LLCachedControl<S32>(*LLUI::sSettingGroups["config"], "UIResizeBarHeight", 0))
 {
 	name="stack";
@@ -110,7 +112,9 @@ LLLayoutStack::LLLayoutStack(const LLLayoutStack::Params& p)
 	mOrientation((p.orientation() == "vertical") ? VERTICAL : HORIZONTAL),
 	mAnimate(p.animate),
 	mAnimatedThisFrame(false),
-	mClip(p.clip)
+	mClip(p.clip),
+	mOpenTimeConstant(p.open_time_constant),
+	mCloseTimeConstant(p.close_time_constant)
 {}
 
 LLLayoutStack::~LLLayoutStack()
@@ -303,9 +307,6 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
 	S32 total_width = 0;
 	S32 total_height = 0;
 
-	const F32 ANIM_OPEN_TIME = 0.02f;
-	const F32 ANIM_CLOSE_TIME = 0.03f;
-
 	e_panel_list_t::iterator panel_it;
 	for (panel_it = mPanels.begin(); panel_it != mPanels.end();	++panel_it)
 	{
@@ -316,7 +317,7 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
 			{
 				if (!mAnimatedThisFrame)
 				{
-					(*panel_it)->mVisibleAmt = lerp((*panel_it)->mVisibleAmt, 1.f, LLCriticalDamp::getInterpolant(ANIM_OPEN_TIME));
+					(*panel_it)->mVisibleAmt = lerp((*panel_it)->mVisibleAmt, 1.f, LLCriticalDamp::getInterpolant(mOpenTimeConstant));
 					if ((*panel_it)->mVisibleAmt > 0.99f)
 					{
 						(*panel_it)->mVisibleAmt = 1.f;
@@ -334,7 +335,7 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
 			{
 				if (!mAnimatedThisFrame)
 				{
-					(*panel_it)->mVisibleAmt = lerp((*panel_it)->mVisibleAmt, 0.f, LLCriticalDamp::getInterpolant(ANIM_CLOSE_TIME));
+					(*panel_it)->mVisibleAmt = lerp((*panel_it)->mVisibleAmt, 0.f, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
 					if ((*panel_it)->mVisibleAmt < 0.001f)
 					{
 						(*panel_it)->mVisibleAmt = 0.f;
@@ -349,11 +350,11 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
 
 		if ((*panel_it)->mCollapsed)
 		{
-			(*panel_it)->mCollapseAmt = lerp((*panel_it)->mCollapseAmt, 1.f, LLCriticalDamp::getInterpolant(ANIM_CLOSE_TIME));
+			(*panel_it)->mCollapseAmt = lerp((*panel_it)->mCollapseAmt, 1.f, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
 		}
 		else
 		{
-			(*panel_it)->mCollapseAmt = lerp((*panel_it)->mCollapseAmt, 0.f, LLCriticalDamp::getInterpolant(ANIM_CLOSE_TIME));
+			(*panel_it)->mCollapseAmt = lerp((*panel_it)->mCollapseAmt, 0.f, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
 		}
 
 		if (mOrientation == HORIZONTAL)
diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h
index e19ef403eff..2fc6164d7ad 100644
--- a/indra/llui/lllayoutstack.h
+++ b/indra/llui/lllayoutstack.h
@@ -46,6 +46,8 @@ class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack>
 		Optional<S32>			border_size;
 		Optional<bool>			animate,
 								clip;
+		Optional<F32>			open_time_constant,
+								close_time_constant;
 
 		Params();
 	};
@@ -137,6 +139,8 @@ class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack>
 	bool mAnimatedThisFrame;
 	bool mAnimate;
 	bool mClip;
+	F32 mOpenTimeConstant;
+	F32 mCloseTimeConstant;
 }; // end class LLLayoutStack
 
 class LLLayoutPanel : public LLPanel
-- 
GitLab