diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 983af5dad9e..e0ca0f8a782 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed volumetric fog with XR single-pass rendering. - Fixed issues with first frame rendering when RenderGraph is used (auto exposure, AO) - Fixed AOV api in render graph (case 1296605) +- Fixed a small discrepancy in the marker placement in light intensity sliders (case 1299750) ### Changed - Removed the material pass probe volumes evaluation mode. diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/LightUnit/LightUnitSlider.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/LightUnit/LightUnitSlider.cs index a5e931857a3..b9327690e24 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/LightUnit/LightUnitSlider.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/LightUnit/LightUnitSlider.cs @@ -21,6 +21,7 @@ static class SliderConfig public const float k_MarkerHeight = 2; public const float k_MarkerTooltipScale = 4; public const float k_ThumbTooltipSize = 10; + public const float k_KnobSize = 10; } protected static class SliderStyles @@ -118,11 +119,16 @@ void DoSliderMarker(Rect rect, float position, float value, string tooltip) // Vertically align with slider. markerRect.y += (EditorGUIUtility.singleLineHeight / 2f) - 1; - // Horizontally place on slider. - const float halfWidth = width * 0.5f; - markerRect.x = rect.x + rect.width * position; + // Horizontally place on slider. We need to take into account the "knob" size when doing this, because position 0 and 1 starts + // at the center of the knob when it's placed at the left and right corner respectively. We don't do this adjustment when placing + // the marker at the corners (to avoid havind the slider slightly extend past the marker) + float knobSize = (position > 0f && position < 1f) ? SliderConfig.k_KnobSize : 0f; + float start = rect.x + knobSize / 2f; + float range = rect.width - knobSize; + markerRect.x = start + range * position; // Center the marker on value. + const float halfWidth = width * 0.5f; markerRect.x -= halfWidth; // Clamp to the slider edges.