summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelenvironment.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelenvironment.cpp')
-rw-r--r--indra/newview/llpanelenvironment.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp
index 51e2c05070..2a4323d3e6 100644
--- a/indra/newview/llpanelenvironment.cpp
+++ b/indra/newview/llpanelenvironment.cpp
@@ -296,7 +296,7 @@ void LLPanelEnvironmentInfo::refresh()
F32Hours dayoffset(mCurrentEnvironment->mDayOffset);
if (dayoffset.value() > 12.0f)
- dayoffset -= F32Hours(24.0);
+ dayoffset -= daylength;
mSliderDayLength->setValue(daylength.value());
mSliderDayOffset->setValue(dayoffset.value());
@@ -723,6 +723,11 @@ void LLPanelEnvironmentInfo::onSldDayLengthChanged(F32 value)
F32Hours daylength(value);
mCurrentEnvironment->mDayLength = daylength;
+ F32 offset = (F32)mSliderDayOffset->getValue().asReal();
+ if (offset <= 0.0f)
+ {
+ onSldDayOffsetChanged(offset);
+ }
setDirtyFlag(DIRTY_FLAG_DAYLENGTH);
udpateApparentTimeOfDay();
@@ -736,7 +741,8 @@ void LLPanelEnvironmentInfo::onSldDayOffsetChanged(F32 value)
F32Hours dayoffset(value);
if (dayoffset.value() <= 0.0f)
- dayoffset += F32Hours(24.0);
+ // if day cycle is 5 hours long, we want -1h offset to result in 4h
+ dayoffset += mCurrentEnvironment->mDayLength;
mCurrentEnvironment->mDayOffset = dayoffset;
setDirtyFlag(DIRTY_FLAG_DAYOFFSET);
@@ -929,7 +935,7 @@ void LLPanelEnvironmentInfo::udpateApparentTimeOfDay()
{
static const F32 SECONDSINDAY(24.0 * 60.0 * 60.0);
- if ((!mCurrentEnvironment) || (mCurrentEnvironment->mDayLength.value() < 1.0) || (mCurrentEnvironment->mDayOffset.value() < 1.0))
+ if ((!mCurrentEnvironment) || (mCurrentEnvironment->mDayLength.value() < 1.0))
{
mLabelApparentTime->setVisible(false);
return;