Module: ProMotion::Menu::Gestures

Included in:
Drawer
Defined in:
lib/ProMotion/menu/gestures.rb

Constant Summary collapse

SHOW_MASKS =
{
  pan_nav_bar: MMOpenDrawerGestureModePanningNavigationBar,  # Pan anywhere on the navigation bar
  pan_content: MMOpenDrawerGestureModePanningCenterView,     # Pan anywhere on the center view
  pan_center: MMOpenDrawerGestureModePanningCenterView,      # Alias of above
  pan_bezel: MMOpenDrawerGestureModeBezelPanningCenterView,  # Pan anywhere within 20 pts of the bezel
  all: MMOpenDrawerGestureModeAll,                           # All of the above
  none: MMOpenDrawerGestureModeNone                          # No gesture recognition
}
HIDE_MASKS =
{
  pan_nav_bar: MMCloseDrawerGestureModePanningNavigationBar,  # Pan anywhere on the navigation bar
  pan_content: MMCloseDrawerGestureModePanningCenterView,     # Pan anywhere on the center view
  pan_center: MMCloseDrawerGestureModePanningCenterView,      # Alias of above
  pan_bezel: MMCloseDrawerGestureModeBezelPanningCenterView,  # Pan anywhere within the bezel of the center view
  tap_nav_bar: MMCloseDrawerGestureModeTapNavigationBar,      # Tap the navigation bar
  tap_content: MMCloseDrawerGestureModeTapCenterView,         # Tap the center view
  tap_center: MMCloseDrawerGestureModeTapCenterView,          # Alias of above
  pan_menu: MMCloseDrawerGestureModePanningDrawerView,        # Pan anywhere on the drawer view
  all: MMCloseDrawerGestureModeAll,                           # All of the above
  none: MMCloseDrawerGestureModeNone                          # No gesture recognition
}

Instance Method Summary collapse

Instance Method Details

#mask_for_hide(gestures) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/ProMotion/menu/gestures.rb', line 42

def mask_for_hide(gestures)
  mask = 0
  Array(gestures).each do |g|
    mask = mask | HIDE_MASKS[g]
  end
  mask
end

#mask_for_show(gestures) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/ProMotion/menu/gestures.rb', line 34

def mask_for_show(gestures)
  mask = 0
  Array(gestures).each do |g|
    mask = mask | SHOW_MASKS[g]
  end
  mask
end

#to_hide=(gestures) ⇒ Object



30
31
32
# File 'lib/ProMotion/menu/gestures.rb', line 30

def to_hide=(gestures)
  self.closeDrawerGestureModeMask = mask_for_hide(gestures)
end

#to_show=(gestures) ⇒ Object



26
27
28
# File 'lib/ProMotion/menu/gestures.rb', line 26

def to_show=(gestures)
  self.openDrawerGestureModeMask = mask_for_show(gestures)
end