Skip to content

Commit

Permalink
Use fade distance instead of opacity, opacity inconsistently applied
Browse files Browse the repository at this point in the history
  • Loading branch information
feilen committed Apr 5, 2023
1 parent 161b855 commit a62bbbe
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 27 deletions.
48 changes: 24 additions & 24 deletions src/res/qml/chaperone_page/ChaperonePage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,13 @@ MyStackViewPage {
chaperonePlaySpaceToggle.checked = ChaperoneTabController.playSpaceMarker
chaperoneForceBoundsToggle.checked = ChaperoneTabController.forceBounds
chaperoneDisableChaperone.checked = ChaperoneTabController.disableChaperone
if(chaperoneDisableChaperone.checked){
var dim = ChaperoneTabController.chaperoneDimHeight
if(dim > 0.0){
chaperoneDisableChaperone.enabled = false;
}else{
chaperoneDisableChaperone.enabled = true;
}
if(dim > 0.0 || chaperoneDisableChaperone.checked){
chaperoneFadeDistanceMinus.enabled = false;
chaperoneFadeDistancePlus.enabled = false;
chaperoneFadeDistanceSlider.enabled = false;
Expand All @@ -575,18 +581,6 @@ MyStackViewPage {
chaperoneFadeDistanceSlider.enabled = true;
chaperoneFadeDistanceText.enabled = true;
}
var dim = ChaperoneTabController.chaperoneDimHeight
if (dim > 0.0) {
chaperoneVisibilityMinus.enabled = false;
chaperoneVisibilityPlus.enabled = false;
chaperoneVisibilitySlider.enabled = false;
chaperoneVisibilityText.enabled = false;
} else {
chaperoneVisibilityMinus.enabled = true;
chaperoneVisibilityPlus.enabled = true;
chaperoneVisibilitySlider.enabled = true;
chaperoneVisibilityText.enabled = true;
}
reloadChaperoneProfiles()
}

Expand All @@ -612,17 +606,23 @@ MyStackViewPage {
chaperoneHeightText.text = h
}
onChaperoneDimHeightChanged: {
var d = ChaperoneTabController.chaperoneDimHeight
if (d > 0.0) {
chaperoneVisibilityMinus.enabled = false;
chaperoneVisibilityPlus.enabled = false;
chaperoneVisibilitySlider.enabled = false;
chaperoneVisibilityText.enabled = false;
} else {
chaperoneVisibilityMinus.enabled = true;
chaperoneVisibilityPlus.enabled = true;
chaperoneVisibilitySlider.enabled = true;
chaperoneVisibilityText.enabled = true;
var dim = ChaperoneTabController.chaperoneDimHeight
if(dim > 0.0){
chaperoneDisableChaperone.enabled = false;
}else{
chaperoneDisableChaperone.enabled = true;
}
if(dim > 0.0 || chaperoneDisableChaperone.checked){
chaperoneFadeDistanceMinus.enabled = false;
chaperoneFadeDistancePlus.enabled = false;
chaperoneFadeDistanceSlider.enabled = false;
chaperoneFadeDistanceText.enabled = false;

}else{
chaperoneFadeDistanceMinus.enabled = true;
chaperoneFadeDistancePlus.enabled = true;
chaperoneFadeDistanceSlider.enabled = true;
chaperoneFadeDistanceText.enabled = true;
}
}
onCenterMarkerNewChanged: {
Expand Down
8 changes: 5 additions & 3 deletions src/tabcontrollers/ChaperoneTabController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,15 @@ void ChaperoneTabController::eventLoopTick(
if ( count > 10000 )
{
m_dimNotificationTimestamp.reset();
setChaperoneColorA( static_cast<int>( 0.f ) );
setFadeDistance( 0.0f, true );
}
else
{
float pct = std::min(
1.0f, 2.0f - static_cast<float>( count ) / 5000.0f );
setChaperoneColorA( static_cast<int>( pct * 0.6f * 255.0f ) );
// Originally this used opacity, but steam will override that it
// seems
setFadeDistance( pct * 0.4f, true );
}
}

Expand Down Expand Up @@ -313,7 +315,7 @@ void ChaperoneTabController::eventLoopTick(
>= chaperoneDimHeight() )
{
m_dimmingActive = false;
setChaperoneColorA( static_cast<int>( 0.6f * 255.0f ) );
setFadeDistance( 0.4f, true );
}
}
}
Expand Down

0 comments on commit a62bbbe

Please sign in to comment.