 class KDSliderBarHandleView extends KDCustomHTMLView
   constructor:(options = {}, data = {})->
     options.cssClass  = "handle"
-    options.name
+    options.name    or= "defaultHandle"
     data.value       ?= 0
 
     super options, data

    @on "mousedown", ->
      @parent.bindEvent "mousemove"
      windowController.setDragInAction true

      @parent.on "mousemove", (event) =>
        relPos  = (((event.pageX - @parent.getX())/@parent.getWidth())*100)
        @setValue ((relPos*(maxValue - minValue))/100)+minValue

      @on "mouseup", dragEnded
      @parent.on "mouseleave", dragEnded

    dragEnded = ->
      @parent.off "mousemove"
      windowController.setDragInAction false
      @snap() if @parent.getOption "snap"

  getPosition:->
    {maxValue, minValue} = @parent.getOptions()

    @parent.drawBar()
    @parent.setLimits()
    @setX "#{@getPosition()}%"
    @parent.emit "valuechange"
      
  getSnappedValue:->
    {interval}  = @parent.getOptions()
