Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates the min or max value when set(value) is out of bounds #36

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
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
13 changes: 10 additions & 3 deletions dist/gauge.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -333,21 +333,28 @@ class Gauge extends BaseGauge
for i in [0...(value.length - @gp.length)]
@gp.push(new GaugePointer(@))

# get max value and update pointer(s)
# get max and min values and update pointer(s)
i = 0
max_hit = false
min_hit = false

for val in value
if val > @maxValue
@maxValue = @value * 1.1
@maxValue = val
max_hit = true
if val < @minValue
@minValue = val
min_hit = true
@gp[i].setOptions({maxValue: @maxValue, minValue: @minValue, angle: @options.angle})
@gp[i].value = val
@gp[i++].setOptions({maxValue: @maxValue, angle: @options.angle})
@value = value[value.length - 1] # TODO: Span maybe??

if max_hit
unless @options.limitMax
AnimationUpdater.run()
else if min_hit
unless @options.limitMin
AnimationUpdater.run()
else
AnimationUpdater.run()

Expand Down
Loading