aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--units.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/units.go b/units.go
index 81e48c7..726829d 100644
--- a/units.go
+++ b/units.go
@@ -34,12 +34,14 @@ type Point struct {
var orientation = Portrait
-func (p Point) String() string {
- if orientation == Portrait {
- return fmt.Sprintf("%v,%v", p.X, p.Y)
- } else {
- return fmt.Sprintf("%v,%v", p.Y, p.X)
+func (p Point) String() (s string) {
+ switch orientation {
+ case Portrait:
+ s = fmt.Sprintf("%v,%v", p.X, p.Y)
+ case Landscape:
+ s = fmt.Sprintf("%v,%v", p.Y, p.X)
}
+ return
}
func parsePoint(s string) (p Point) {