source: Dev/trunk/src/client/dojox/mobile/_ListTouchMixin.js

Last change on this file was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

File size: 1.4 KB
Line 
1define([
2        "dojo/_base/declare",
3        "dojo/touch",
4        "./sniff",
5        "dijit/form/_ListBase"
6], function(declare, touch, has, ListBase){
7
8        return declare( "dojox.mobile._ListTouchMixin", ListBase, {
9                // summary:
10                //              Focus-less menu to handle touch events consistently.
11                // description:
12                //              Focus-less menu to handle touch events consistently. Abstract
13                //              method that must be defined externally:
14                //
15                //              - onClick: item was chosen (mousedown somewhere on the menu and mouseup somewhere on the menu).
16
17                postCreate: function(){
18                        this.inherited(arguments);
19
20                        // For some reason in IE click event is fired immediately after user scrolled combobox control and released
21                        // his/her finger. As a fix we replace click with tap event that is fired correctly.
22                        if(!( (has("ie") === 10 || (!has("ie") && has("trident") > 6)) && typeof(MSGesture) !== "undefined")){
23                                this._listConnect("click", "_onClick");
24                        }else{
25                                this._listConnect(touch.press, "_onPress");
26
27                                var self = this,
28                                        tapGesture = new MSGesture(),
29                                        target;
30
31                                this._onPress = function(e){
32                                        tapGesture.target = self.domNode;
33                                        tapGesture.addPointer(e.pointerId);
34                                        target = e.target;
35                                };
36
37                                this.on("MSGestureTap", function(e){
38                                        self._onClick(e, target);
39                                });
40                        }
41                },
42
43                _onClick: function(/*Event*/ evt, /*DomNode*/ target){
44                        this._setSelectedAttr(target);
45                        this.onClick(target);
46                }
47        });
48});
Note: See TracBrowser for help on using the repository browser.