Skip to content

Instantly share code, notes, and snippets.

@422404
Last active June 14, 2018 20:56
Show Gist options
  • Select an option

  • Save 422404/ee92a0f4cf546b9607f12de888baaf14 to your computer and use it in GitHub Desktop.

Select an option

Save 422404/ee92a0f4cf546b9607f12de888baaf14 to your computer and use it in GitHub Desktop.

Revisions

  1. 422404 revised this gist Jun 14, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions preventSwipe.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    After digging on how to prevent the user to open the side menu by swiping I found nothing.
    While digging on how to prevent the user to open the side menu by swiping I found nothing.
    I tried to override the onEdgeSwipe and onSwipeStart methods of Ext.Viewport but nope...

    Some tests after, tadaaa ! If I replace the Ext.Viewport.beforeMenuAnimate with an empty function it prevent the menu opening by swiping... and by calling Ext.Viewport.showMenu(..)
    Some tests after, tadaaa ! If I replace the Ext.Viewport.beforeMenuAnimate method with an empty function it prevent the menu opening by swiping... and by calling Ext.Viewport.showMenu(..)

    ### The solution
    ```javascript
  2. 422404 created this gist Jun 14, 2018.
    21 changes: 21 additions & 0 deletions preventSwipe.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    After digging on how to prevent the user to open the side menu by swiping I found nothing.
    I tried to override the onEdgeSwipe and onSwipeStart methods of Ext.Viewport but nope...

    Some tests after, tadaaa ! If I replace the Ext.Viewport.beforeMenuAnimate with an empty function it prevent the menu opening by swiping... and by calling Ext.Viewport.showMenu(..)

    ### The solution
    ```javascript
    let oldBeforeMenuAnimate = null;
    let noop = function () {};

    let viewportPreventEdgeSwipe = function () {
    oldBeforeMenuAnimate = Ext.Viewport.beforeMenuAnimate;
    Ext.Viewport.beforeMenuAnimate = noop;
    }

    let openMenu = function () {
    Ext.Viewport.beforeMenuAnimate = oldBeforeMenuAnimate;
    Ext.Viewport.showMenu('right');
    Ext.Viewport.beforeMenuAnimate = noop;
    }
    ```