module Rabbit::Renderer::Display::ScrollHandler
Constants
- ScrollEvent
Public Class Methods
Source
# File lib/rabbit/renderer/display/scroll-handler.rb, line 23 def initialize(*args, &block) super init_scroll_handler end
Calls superclass method
Private Instance Methods
Source
# File lib/rabbit/renderer/display/scroll-handler.rb, line 29 def init_scroll_handler end
Source
# File lib/rabbit/renderer/display/scroll-handler.rb, line 35 def set_scroll_event(widget) scroll = Gtk::EventControllerScroll.new([:both_axes]) scroll.signal_connect(:scroll) do |_, dx, dy| if dy.zero? false else if dy.positive? direction = Gdk::ScrollDirection::UP else direction = Gdk::ScrollDirection::DOWN end event = ScrollEvent.new(direction) handled = call_hook_procs(@scroll_hook_procs, event) unless handled if direction == Gdk::ScrollDirection::UP @canvas.activate("NextSlide") else @canvas.activate("PreviousSlide") end end true end end widget.add_controller(scroll) end