Only take visible tasks into account for the margin.

Previously the margin was calculated also based on invisible task names.