lib/vedeu/support/geometry.rb in vedeu-0.0.26 vs lib/vedeu/support/geometry.rb in vedeu-0.0.27
- old
+ new
@@ -22,22 +22,22 @@
def virtual_y(index = 0)
((y..max_y).to_a)[index]
end
def max_y
- if ((y + height) > Terminal.height)
- Terminal.height
+ if ((y + height) > screen_height)
+ screen_height
else
(y + height)
end
end
def max_x
- if ((x + width) > Terminal.width)
- Terminal.width
+ if ((x + width) > screen_width)
+ screen_width
else
(x + width)
end
@@ -59,8 +59,16 @@
interface.x
end
def y
interface.y
+ end
+
+ def screen_height
+ @height ||= Terminal.height
+ end
+
+ def screen_width
+ @width ||= Terminal.width
end
end
end