diff options
author | Dimitri Sokolyuk <demon@dim13.org> | 2016-11-14 00:42:23 +0100 |
---|---|---|
committer | Dimitri Sokolyuk <demon@dim13.org> | 2016-11-14 00:42:23 +0100 |
commit | 05af31880498bf60316b85415f9d4c1dfa0d1577 (patch) | |
tree | e7040c967ee8e98ae67c3c89ab9bf6d9d5acb5f8 /units.go | |
parent | 360abb4272dea659de237b1c58d46acc1746ffa7 (diff) |
wip
Diffstat (limited to 'units.go')
-rw-r--r-- | units.go | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -44,14 +44,15 @@ type Point struct { X, Y Unit } +func (p Point) Swap() Point { return Point{X: p.Y, 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) + p = p.Swap() } - return + return fmt.Sprintf("%v,%v", p.X, p.Y) } func (p Point) Scale(f Unit) Point { @@ -86,10 +87,10 @@ func (p Path) String() string { return strings.Join(pp, ",") } -func (ph Path) Scale(f Unit) Path { - ret := make(Path, len(ph)) - for i, p := range ph { - ret[i] = p.Scale(f) +func (p Path) Scale(f Unit) Path { + ret := make(Path, len(p)) + for i, pt := range p { + ret[i] = pt.Scale(f) } return ret } |