summaryrefslogtreecommitdiff
path: root/structs.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-08 14:04:11 -0600
committerJeff Carr <[email protected]>2025-02-08 14:04:11 -0600
commit23dfd96a877dadf4a6c36f39785f2b000139491b (patch)
treec3dbf0d425629fbe9c8477693d79339bcd225baa /structs.go
parent5827b9ace289a645be2189c12865f05f59a25fca (diff)
changing Height() to reflect more realistic values
Diffstat (limited to 'structs.go')
-rw-r--r--structs.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/structs.go b/structs.go
index f096e2a..565ce28 100644
--- a/structs.go
+++ b/structs.go
@@ -130,6 +130,19 @@ func (r *rectType) Width() int {
}
func (r *rectType) Height() int {
+ if r.h0 == 0 && r.h1 == 0 {
+ // edge case. only return 0 for these
+ return 0
+ }
+ if r.h1 == r.h0 {
+ // if they are equal, it's actually height = 1
+ return 1
+ }
+ if r.h1-r.h0 < 1 {
+ // can't have negatives. something is wrong. return 1 for now
+ return 1
+ }
+
return r.h1 - r.h0
}