From 09e13fbf0462e801626d259ae901d5f430d7ebdf Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 13 Nov 2021 10:57:26 +0900 Subject: improve square ratio --- main.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'main.go') diff --git a/main.go b/main.go index 27709ec..9841b34 100644 --- a/main.go +++ b/main.go @@ -118,6 +118,12 @@ func drawClock(scr tcell.Screen, now time.Time, bgStyle, clockStyle tcell.Style) // ### ### ### ### v squareW := scrW / (17 + 2) squareH := scrH / (5 + 2) + if squareH > squareW { + squareH = squareW + } + if squareW > squareH*3/2 { + squareW = squareH * 3 / 2 + } xOffset := (scrW - squareW*17) / 2 yOffset := (scrH - squareH*5) / 2 -- cgit v1.2.3-70-g09d2