Sha256: f19b9c69f99e449c7f8dcd787d5ee344216dbbfb060d8f665a2add6be729e807
Contents?: true
Size: 1.68 KB
Versions: 12
Compression:
Stored size: 1.68 KB
Contents
# -*- coding: utf-8 -*- require 'xot/bit_flag_accessor' require 'xot/const_symbol_accessor' require 'reflex/ext' module Reflex class Pointer include Comparable alias types get_type alias action get_action bit_flag_reader :types, **{ none: TYPE_NONE, mouse: MOUSE, mouse_left: MOUSE_LEFT, mouse_right: MOUSE_RIGHT, mouse_middle: MOUSE_MIDDLE, touch: TOUCH, pen: PEN } const_symbol_reader :action, **{ none: ACTION_NONE, down: DOWN, up: UP, move: MOVE, cancel: CANCEL, stay: STAY } def mouse?() (get_type & MOUSE) != 0 end def mouse_left?() (get_type & MOUSE_LEFT) != 0 end def mouse_right?() (get_type & MOUSE_RIGHT) != 0 end def mouse_middle?() (get_type & MOUSE_MIDDLE) != 0 end alias left? mouse_left? alias right? mouse_right? alias middle? mouse_middle? def touch?() (get_type & TOUCH) != 0 end def pen?() (get_type & PEN) != 0 end def down?() get_action == DOWN end def up?() get_action == UP end def move?() get_action == MOVE end def cancel?() get_action == CANCEL end def stay?() get_action == STAY end alias pos position def x() position.x end def y() position.y end def <=>(o) inspect <=> o.inspect end def inspect() "#<Reflex::Pointer id:#{id} #{types} #{action} (#{x.round 2}, #{y.round 2}) mod:#{modifiers} click:#{click_count} drag:#{drag?} time:#{time.round 2}>" end end# Pointer end# Reflex
Version data entries
12 entries across 12 versions & 1 rubygems