 class KDSliderBarView extends KDCustomHTMLView
   constructor:(options = {}, data = {})->
+
     options.cssClass    = KD.utils.curryCssClass "sliderbar-container", options.cssClass
     options.minValue   ?= 0
     options.maxValue   ?= 100


  drawBar:->
    positions = []
    for i in @handles
      positions.push i.getPosition()

    len    = positions.length
    left   = (positions[0] if len>1) || 0
    right  = positions[len-1]
    diff   = right - left

    if !@bar
      @addSubView @bar = new KDCustomHTMLView
        cssClass : "bar"
    @bar.setWidth diff, "%"
    @bar.setX "#{left}%"

  addLabels:->
    maxValue = @getOption('maxValue')
    minValue = @getOption('minValue')
    interval = @getOption('interval')

    for v in [minValue..maxValue] by interval
      pos = ((v-minValue)*100)/(maxValue-minValue)

      @labels.push @addSubView label = new KDCustomHTMLView
        cssClass    : "sliderbar-label"
        partial     : "#{v}"

      label.setX "#{pos}%"


        else value

  snap:->
    {interval}  = @parent.getOptions()
    value       = @getSnappedValue()

    if interval isnt no and @parent.getOption "snap"
      @setValue value
