Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Added bounds to the slider rage, fix for bug https://github.com/prajwalk... #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/angular-slider.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,15 @@ sliderDirective = ($timeout) ->
newOffset = eventX - element[0].getBoundingClientRect().left - pointerHalfWidth
newOffset = Math.max(Math.min(newOffset, maxOffset), minOffset)
newPercent = percentOffset newOffset
newValue = minValue + (valueRange * newPercent / 100.0)
newValue = Math.round(minValue + (valueRange * newPercent / 100.0))
if range
if ref is refLow
if newValue > scope[refHigh]
if newValue >= scope[refHigh]
ref = refHigh
minPtr.removeClass 'active'
maxPtr.addClass 'active'
else
if newValue < scope[refLow]
if newValue <= scope[refLow]
ref = refLow
maxPtr.removeClass 'active'
minPtr.addClass 'active'
Expand Down