Skip to content

Commit

Permalink
#19 Improve layout for columns in rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
ThetaSinner committed Nov 13, 2018
1 parent 02632c7 commit 9b1fa61
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,18 @@ internal class ReportRunner : IReportRunner {
depthMap.forEach { node, depth ->
val currentDepthCount = tempDepthCounts[depth] ?: throw IllegalStateException("missing temp depth count")

val depthCount = depthCounts[depth] ?: throw IllegalStateException("missing depth count")

val x = diagramPadding + depth * cardSeparationHorizontal + depth * tileWidth

val y = diagramPadding + (currentDepthCount - 1) * tileHeight
+ (currentDepthCount - 1) * cardSeparationVertical
// This isn't fantastic. Does exact layout if the column is going to be filled and distributes otherwise.
val y: Double = if (depthCount < maxDepthCount) {
diagramPadding + ((diagramHeight - 2 * diagramPadding) / (depthCount + 1)) * currentDepthCount - 0.5 * tileHeight
}
else {
(diagramPadding + (currentDepthCount - 1) * tileHeight
+ (currentDepthCount - 1) * cardSeparationVertical).toDouble()
}

val position = Position2D(
x.toFloat(),
Expand Down

0 comments on commit 9b1fa61

Please sign in to comment.