From 97affcb7665b838aa230a8192992b43fa31ad3e5 Mon Sep 17 00:00:00 2001 From: Voula Dionisiou Date: Fri, 21 Oct 2016 10:49:12 +0300 Subject: [PATCH] Percentage calculation This fix is required so that the percentage is calculated correctly when min != 0. --- src/Controls/Slider.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Controls/Slider.ts b/src/Controls/Slider.ts index 38f9ab35..d7e6d5c0 100644 --- a/src/Controls/Slider.ts +++ b/src/Controls/Slider.ts @@ -145,7 +145,7 @@ module Fayde.Controls { if (max === min) return; - var percent = val / (max - min); + var percent = (val - min) / (max - min); if (largeDecrease != null && thumb != null) { if (isHorizontal) largeDecrease.Width = Math.max(0, percent * (this.ActualWidth - thumb.ActualWidth)); @@ -253,4 +253,4 @@ module Fayde.Controls { { Name: "VerticalThumb", Type: Primitives.Thumb }, { Name: "VerticalTrackLargeChangeIncreaseRepeatButton", Type: Primitives.RepeatButton }, { Name: "VerticalTrackLargeChangeDecreaseRepeatButton", Type: Primitives.RepeatButton }); -} \ No newline at end of file +}