Hybrid View
-
6 Dec 2012 2:22 PM #1
Answered: Swipe on components other than list
Answered: Swipe on components other than list
Hello,
Is it possible to use the swipe recognizer on other components than the list?
I found this fiddle: http://www.senchafiddle.com/#DbH5t that allows me to swipe on a container, but it uses an internal private class.
Specifically I'm looking to swipe left or right on a button.
Has anyone worked with this before or have any thoughts?
thanks,
Paul
-
Best Answer Posted by paulroth3d
Ugh, so this was difficult, but I found a solution:
Code:Ext.application({ name: 'swipeTest', //change the default recognisers eventPublishers: { touchGesture: { recognizers: { swipe: { //this will include both vertical and horizontal swipe recognisers xclass: 'Ext.event.recognizer.Swipe' } } } }, launch: function() { Ext.create('Ext.Panel', { fullscreen: true, scrollable: true, html: 'This is a Panel', items: [{ xtype: 'titlebar', docked: 'top', title: 'Panel' },{ xtype: 'button', text: 'Swipe on button supported', name: 'myButton', id: 'myButtony' }], listeners: { initialize: function(comp , eOpts){ var btn = comp.down( "button" ); btn.element.on( 'swipe', function(event, node, options, eOpts) { Ext.Msg.alert('swipe', 'direction: '+event.direction, Ext.emptyFn); }, comp ); } } }); } });
-
6 Dec 2012 4:53 PM #2
Ugh, so this was difficult, but I found a solution:
Code:Ext.application({ name: 'swipeTest', //change the default recognisers eventPublishers: { touchGesture: { recognizers: { swipe: { //this will include both vertical and horizontal swipe recognisers xclass: 'Ext.event.recognizer.Swipe' } } } }, launch: function() { Ext.create('Ext.Panel', { fullscreen: true, scrollable: true, html: 'This is a Panel', items: [{ xtype: 'titlebar', docked: 'top', title: 'Panel' },{ xtype: 'button', text: 'Swipe on button supported', name: 'myButton', id: 'myButtony' }], listeners: { initialize: function(comp , eOpts){ var btn = comp.down( "button" ); btn.element.on( 'swipe', function(event, node, options, eOpts) { Ext.Msg.alert('swipe', 'direction: '+event.direction, Ext.emptyFn); }, comp ); } } }); } });


Reply With Quote