+# example = new KDSliderBarView
+#   cssClass   : 'my-cute-slider'
+#   minValue   : 0
+#   maxValue   : 200
+#   interval   : 10
+#   width      : 500
+#   snap       : yes
+#   snapOnDrag : no
+#   drawBar    : yes - [0, 25, 50, 75, 100]
+#   showLabels : yes 
+#   handles    : [100, 60]
+
 class KDSliderBarView extends KDCustomHTMLView
   constructor:(options = {}, data = {})->
 


  createHandles:->
    for value in @getOption "handles"
      @handles.push @addSubView handle = new KDSliderBarHandleView  {}, {value}

    sortRef = (a,b) ->
      return -1 if a.getData().value < b.getData().value
      return  1 if a.getData().value > b.getData().value
      return  0
    @handles.sort sortRef

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

    len       =  positions.length
    left      = (parseInt(positions.first) if len>1) or 0
    right     =  parseInt(positions.last)
    diff      =  right - left

    unless @bar
      @addSubView @bar = new KDCustomHTMLView

    options.drawBar    ?= yes
    options.showLabels ?= yes
    options.snap       ?= yes
    options.snapOnDrag ?= no
    options.width     or= 300

    super options, data
