kdf
Version:
49 lines (35 loc) • 1.26 kB
text/coffeescript
KDCustomHTMLView = require './../../core/customhtmlview.coffee'
module.exports = class KDTabHandleMoveNav extends KDCustomHTMLView
constructor: (options = {}, data) ->
options.cssClass = KD.utils.curry 'kdtabhandle-movenav', options.cssClass
super options, data
= 0
viewAppended:->
= new KDCustomHTMLView
cssClass : 'leftButton'
click : => 'right'
= new KDCustomHTMLView
cssClass : 'rightButton'
click : => 'left'
_windowDidResize:->
delegate =
unless delegate.getWidth() > delegate._tabsWidth + 50
else
'initial'
move:(direction)->
{tabHandleContainer} = delegate =
handleWidth = delegate.getOption 'maxHandleWidth'
switch direction
when 'left'
return if handleWidth * delegate.handles.length + 100 < \
tabHandleContainer.getWidth() -
-= handleWidth
when 'right'
return if is 0
+= handleWidth
when 'initial'
= 0
tabHandleContainer.tabs.setCss 'marginLeft', "#{@_current}px"