Skip to content

Commit

Permalink
Hotfix: Fix hit fade slider being inverted
Browse files Browse the repository at this point in the history
  • Loading branch information
pema99 committed Sep 29, 2023
1 parent 4a309ea commit 0acbd13
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6392,7 +6392,7 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 0}
m_FillRect: {fileID: 0}
m_HandleRect: {fileID: 6616153333565592132}
m_Direction: 0
m_Direction: 1
m_MinValue: 0
m_MaxValue: 1
m_WholeNumbers: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,19 +452,20 @@
float marginX = remainingWidth / 2;
float marginY = remainingHeight / 2;

triUV.x += halfWidth * _HitFade;
float fgTriangleDist = inflate(sdTriangleRight(triUV, halfWidth * (1.0 - _HitFade), halfHeight), 0.002);
float invHitFade = 1 - _HitFade;
triUV.x += halfWidth * invHitFade;
float fgTriangleDist = inflate(sdTriangleRight(triUV, halfWidth * _HitFade, halfHeight), 0.002);
ADD_ELEMENT(color, ACTIVE_COLOR, fgTriangleDist);

// Slider handle
float handleDist = sdSphere(
translate(uv, float2(_HitFade * fullWidth + marginX, size.y * 0.5)),
translate(uv, float2(invHitFade * fullWidth + marginX, size.y * 0.5)),
HANDLE_RADIUS
);
ADD_ELEMENT(color, ACTIVE_COLOR, handleDist);

// Slider vertical grip
float gripDist = abs(uv.x - _HitFade * halfWidth * 2 - marginX) - OUTLINE_WIDTH;
float gripDist = abs(uv.x - invHitFade * halfWidth * 2 - marginX) - OUTLINE_WIDTH;
ADD_ELEMENT(color, ACTIVE_COLOR, gripDist);

return color;
Expand Down

0 comments on commit 0acbd13

Please sign in to comment.