Debian Codegraph @

dojox/mobile/_ListTouchMixin.js

raw symbols SCIP
1 define([
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 });