Improved task size calculation.

This commit is contained in:
Martin Edenhofer 2013-08-20 13:27:46 +02:00
parent eba7f9f979
commit 95c1ef3814

View file

@ -208,19 +208,18 @@ class Taskbar extends App.Controller
@navigate '#' @navigate '#'
resizeTasks: -> resizeTasks: ->
width = $('#task .taskbar').width() - $('#task .taskbar-new').width() - 200 width = $('#task .taskbar-items').width()# - $('#task .taskbar-new').width() - 200
task_count = App.TaskManager.all().length task_count = App.TaskManager.all().length
task_size = ( width / task_count ) - ( task_count * 1.3 ) task_size = ( width / task_count ) - 44
elementsOversize = 0 elementsOversize = 0
elementsOversizeLeftTotal = 0 elementsOversizeLeftTotal = 0
$('#task .task').each( $('#task .task').each(
(position, element) -> (position, element) ->
width = $(element).parent().width() widthTask = $(element).parent().width()
if width > task_size if widthTask > task_size
elementsOversize++ elementsOversize++
else else
elementsOversizeLeftTotal += task_size - width elementsOversizeLeftTotal += ( width / task_count ) - widthTask
) )
addOversize = elementsOversizeLeftTotal / elementsOversize addOversize = elementsOversizeLeftTotal / elementsOversize