Class: LogBench::App::Renderer::Scrollbar
- Inherits:
-
Object
- Object
- LogBench::App::Renderer::Scrollbar
- Includes:
- Curses
- Defined in:
- lib/log_bench/app/renderer/scrollbar.rb
Instance Method Summary collapse
- #draw(win, height, offset, total) ⇒ Object
-
#initialize(screen) ⇒ Scrollbar
constructor
A new instance of Scrollbar.
Constructor Details
#initialize(screen) ⇒ Scrollbar
9 10 11 |
# File 'lib/log_bench/app/renderer/scrollbar.rb', line 9 def initialize(screen) self.screen = screen end |
Instance Method Details
#draw(win, height, offset, total) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/log_bench/app/renderer/scrollbar.rb', line 13 def draw(win, height, offset, total) return if total <= height = [(height * height / total), 1].max = offset * height / total x = win.maxx - 2 # Position scrollbar closer to the border height.times do |i| win.setpos(i + 1, x) if i >= && i < + win.attron(color_pair(1)) { win.addstr("█") } # Solid block for scrollbar thumb end end end |