Skip to content

Commit

Permalink
Add Utils.roundWhole
Browse files Browse the repository at this point in the history
  • Loading branch information
koenbok committed May 11, 2016
1 parent 9c7c945 commit 0430a7a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions framer/Utils.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,11 @@ Utils.round = (value, decimals=0, increment=null, min=null, max=null) ->
return max if max and value > max
return value

Utils.roundWhole = (value, decimals=1) ->
# Return integer if whole value, else include decimals
return parseInt(value) if parseInt(value) is value
return Utils.round(value, decimals)

Utils.clamp = (value, a, b) ->

min = Math.min(a, b)
Expand Down

0 comments on commit 0430a7a

Please sign in to comment.