Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add a custom tap event inside main panel to detects tapped events onl…

…y when slider menu is open.
  • Loading branch information...
commit 0f2d58465a670c29e759d8d0d0d6c22e8f166498 1 parent a2aa4b7
Xevi authored
13 slider_menu/controller/SliderMenuController.js
@@ -39,12 +39,23 @@ Ext.define('SliderMenu.controller.SliderMenuController', {
39 39 push: 'onMainPush',
40 40 pop: 'onMainPop',
41 41 tap: 'onMainTapped',
  42 + },
  43 +
  44 + mainWrapper: {
  45 + tap: 'onMainTapped'
42 46 }
43 47 },
44 48 },
45 49
  50 + /**
  51 + * When the main menu is tapped (only when it's masked -> menu is open)
  52 + * we close slider menu
  53 + */
46 54 onMainTapped: function(){
47   - console.log('Main tapped');
  55 + var main = this.getMain();
  56 + var menu = this.getMenu();
  57 +
  58 + main.closeMenu(menu.getCloseAnimDuration());
48 59 },
49 60
50 61 /**
16 slider_menu/view/Main.js
@@ -146,7 +146,21 @@ Ext.define('SliderMenu.view.Main', {
146 146 constraint.min.x = offsetX;
147 147 constraint.max.x = offsetX;
148 148 this.slideMenu(offsetX, duration);
149   - this.setMasked(masked);
  149 +
  150 + if(masked){
  151 + //open menu -> create a special mask to detects tap events
  152 + this.setMasked({
  153 + xtype: 'mask',
  154 + listeners: {
  155 + tap: function(){
  156 + //Main (this.parent) fires a tap event only when the main is wrapped
  157 + this.parent.fireEvent('tap');
  158 + }
  159 + }
  160 + })
  161 + }else{
  162 + this.setMasked(false);
  163 + }
150 164 },
151 165
152 166 /**

0 comments on commit 0f2d584

Please sign in to comment.
Something went wrong with that request. Please try again.