Skip to content

Commit

Permalink
pot align
Browse files Browse the repository at this point in the history
  • Loading branch information
nothub committed Mar 19, 2023
1 parent f188fa5 commit 4d25c0e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
22 changes: 21 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,28 @@ func main() {

sc.Clear()

// -a --align=INT Align tree: center=0 left=1 right=2
// default center position
px, py := opts.pot.ulPos(sc)

// align by moving 1/4 screen size
switch opts.align {
case left:
sw, _ := sc.Size()
px = px - (sw / 4)
case right:
sw, _ := sc.Size()
px = px + (sw / 4)
}

// user defined position overrides
if opts.baseX != 0 {
px = opts.baseX
}
if opts.baseY != 0 {
py = opts.baseY
}

// draw pot
opts.pot.draw(sc, px, py)

// draw from pot upwards
Expand Down
1 change: 0 additions & 1 deletion options.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ func options() opts {
log.Panicln("unknown pot type", strconv.Itoa(*pot))
}

// TODO: use align to set base-x and base-y values relative to window-size
o.align = align(*alignRaw)

o.leaves = strings.Split(*leavesRaw, ",")
Expand Down

0 comments on commit 4d25c0e

Please sign in to comment.