Skip to content

Commit

Permalink
remove underscore dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Bailey committed Jan 7, 2015
1 parent 535b645 commit 5f5789a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions slider.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ MODULE_NAME = 'ui.slider'
SLIDER_TAG = 'slider'

# HELPER FUNCTIONS

angularize = (element) -> angular.element element
pixelize = (position) -> "#{position}px"
hide = (element) -> element.css opacity: 0
Expand All @@ -13,11 +12,14 @@ offset = (element, position) -> element.css left: position
halfWidth = (element) -> element[0].offsetWidth / 2
offsetLeft = (element) -> element[0].offsetLeft
width = (element) -> element[0].offsetWidth
gap = (element1, element2) -> offsetLeft(element2) - offsetLeft(element1) - width(element1)
gap = (element1, element2) ->
offsetLeft(element2) - offsetLeft(element1) - width(element1)

contain = (value) ->
if _.isInt value
if value % 1 is 0
Math.min Math.max(0, value), 100
else value

roundStep = (value, precision, step, floor = 0) ->
step ?= 1 / Math.pow(10, precision)
remainder = (value - floor) % step
Expand All @@ -28,6 +30,7 @@ roundStep = (value, precision, step, floor = 0) ->
decimals = Math.pow 10, precision
roundedValue = steppedValue * decimals / decimals
parseFloat roundedValue.toFixed precision

inputEvents =
mouse:
start: 'mousedown'
Expand Down
2 changes: 1 addition & 1 deletion slider.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5f5789a

Please sign in to comment.