module Rabbit::Element::SlideElement
Attributes
drawing_index[RW]
index[RW]
transition[RW]
Public Class Methods
new(title_element)
click to toggle source
Calls superclass method
Rabbit::Element::ContainerElement.new
# File lib/rabbit/element/slide-element.rb, line 10 def initialize(title_element) @index = -1 @default_waited_draw_procs = [] super(title_element) end
Public Instance Methods
clear_theme()
click to toggle source
Calls superclass method
Rabbit::Element::ContainerElement#clear_theme
# File lib/rabbit/element/slide-element.rb, line 48 def clear_theme super clear_waiting clear_transition @waited_draw_procs = @default_waited_draw_procs.dup end
clear_transition()
click to toggle source
# File lib/rabbit/element/slide-element.rb, line 44 def clear_transition @transition = nil end
clear_waiting()
click to toggle source
# File lib/rabbit/element/slide-element.rb, line 40 def clear_waiting @drawing_index = 0 end
draw(canvas, simulation=nil)
click to toggle source
Calls superclass method
# File lib/rabbit/element/slide-element.rb, line 24 def draw(canvas, simulation=nil) if simulation.nil? begin draw(canvas, true) draw(canvas, false) rescue StandardError, LoadError canvas.logger.warn($!) end else canvas.draw_slide(self, simulation) do compile(canvas, 0, 0, canvas.width, canvas.height) super(simulation) end end end
first?(index=nil)
click to toggle source
# File lib/rabbit/element/slide-element.rb, line 55 def first?(index=nil) (index || @drawing_index).zero? end
flush()
click to toggle source
# File lib/rabbit/element/slide-element.rb, line 79 def flush @drawing_index = @waited_draw_procs.size end
last?(index=nil)
click to toggle source
# File lib/rabbit/element/slide-element.rb, line 59 def last?(index=nil) @waited_draw_procs.size == (index || @drawing_index) end
move_to_next()
click to toggle source
# File lib/rabbit/element/slide-element.rb, line 63 def move_to_next @drawing_index += 1 unless last? end
move_to_previous()
click to toggle source
# File lib/rabbit/element/slide-element.rb, line 67 def move_to_previous @drawing_index -= 1 unless first? end
register_default_wait_proc(target, exact=false, &proc)
click to toggle source
# File lib/rabbit/element/slide-element.rb, line 71 def register_default_wait_proc(target, exact=false, &proc) @default_waited_draw_procs << [target, exact, proc] end
register_wait_proc(target, exact=false, &proc)
click to toggle source
# File lib/rabbit/element/slide-element.rb, line 75 def register_wait_proc(target, exact=false, &proc) @waited_draw_procs << [target, exact, proc] end
slide()
click to toggle source
# File lib/rabbit/element/slide-element.rb, line 16 def slide self end
title()
click to toggle source
# File lib/rabbit/element/slide-element.rb, line 20 def title @elements.first.text end
waited_draw_procs(target)
click to toggle source
# File lib/rabbit/element/slide-element.rb, line 83 def waited_draw_procs(target) procs = [] candidates = @waited_draw_procs[0, @drawing_index] candidates.each_with_index do |(t, exact, proc), i| next unless target == t if exact procs << proc if i == @drawing_index - 1 else procs << proc end end procs end