]> git.proxmox.com Git - extjs.git/blame - extjs/modern/modern/src/slider/Thumb.js
add extjs 6.0.1 sources
[extjs.git] / extjs / modern / modern / src / slider / Thumb.js
CommitLineData
6527f429
DM
1/**\r
2 * @private\r
3 * Utility class used by Ext.slider.Slider - should never need to be used directly.\r
4 */\r
5Ext.define('Ext.slider.Thumb', {\r
6 extend: 'Ext.Component',\r
7 xtype : 'thumb',\r
8\r
9 config: {\r
10 /**\r
11 * @cfg\r
12 * @inheritdoc\r
13 */\r
14 baseCls: Ext.baseCSSPrefix + 'thumb',\r
15\r
16 /**\r
17 * @cfg {String} pressedCls\r
18 * The CSS class to add to the Slider when it is pressed.\r
19 * @accessor\r
20 */\r
21 pressedCls: Ext.baseCSSPrefix + 'thumb-pressing',\r
22\r
23 /**\r
24 * @cfg\r
25 * @inheritdoc\r
26 */\r
27 draggable: {\r
28 direction: 'horizontal'\r
29 }\r
30 },\r
31\r
32 // Strange issue where the thumbs translation value is not being set when it is not visible. Happens when the thumb \r
33 // is contained within a modal panel.\r
34 platformConfig: {\r
35 ie10: {\r
36 draggable: {\r
37 translatable: {\r
38 translationMethod: 'csstransform'\r
39 }\r
40 }\r
41 }\r
42 },\r
43\r
44 elementWidth: 0,\r
45\r
46 initialize: function() {\r
47 var me = this;\r
48 \r
49 me.callParent();\r
50\r
51 me.getDraggable().onBefore({\r
52 beforedragstart: 'onBeforeDragStart',\r
53 dragstart: 'onDragStart',\r
54 drag: 'onDrag',\r
55 dragend: 'onDragEnd',\r
56 scope: this\r
57 });\r
58\r
59 me.getDraggable().on({\r
60 touchstart: 'onPress',\r
61 touchend: 'onRelease',\r
62 scope: me\r
63 });\r
64\r
65 me.element.on('resize', 'onElementResize', me);\r
66 },\r
67\r
68\r
69 /**\r
70 * @private\r
71 */\r
72 updatePressedCls: function(pressedCls, oldPressedCls) {\r
73 var element = this.element;\r
74\r
75 if (element.hasCls(oldPressedCls)) {\r
76 element.replaceCls(oldPressedCls, pressedCls);\r
77 }\r
78 },\r
79\r
80 /**\r
81 * @private\r
82 */\r
83 onPress: function() {\r
84 var me = this,\r
85 element = me.element,\r
86 pressedCls = me.getPressedCls();\r
87\r
88 if (!me.getDisabled()) {\r
89 element.addCls(pressedCls);\r
90 }\r
91 },\r
92\r
93 /**\r
94 * @private\r
95 */\r
96 onRelease: function(e) {\r
97 this.fireAction('release', [this, e], 'doRelease');\r
98 },\r
99\r
100 /**\r
101 * @private\r
102 */\r
103 doRelease: function(me, e) {\r
104 if (!me.getDisabled()) {\r
105 me.element.removeCls(me.getPressedCls());\r
106 }\r
107 },\r
108\r
109 onBeforeDragStart: function(draggable, e, x, y) {\r
110 if (this.isDisabled()) {\r
111 return false;\r
112 }\r
113\r
114 return this.fireEvent('beforedragstart', this, e, x, y);\r
115 },\r
116\r
117 onDragStart: function(draggable, e, x, y) {\r
118 this.fireEvent('dragstart', this, e, x, y);\r
119 },\r
120\r
121 onDrag: function(draggable, e, x, y) {\r
122 if (this.isDisabled()) {\r
123 return false;\r
124 }\r
125\r
126 this.fireEvent('drag', this, e, x, y);\r
127 },\r
128\r
129 onDragEnd: function(draggable, e, x, y) {\r
130 if (this.isDisabled()) {\r
131 return false;\r
132 }\r
133\r
134 this.fireEvent('dragend', this, e, x, y);\r
135 },\r
136\r
137 onElementResize: function(element, info) {\r
138 this.elementWidth = info.width;\r
139 },\r
140\r
141 getElementWidth: function() {\r
142 return this.elementWidth;\r
143 }\r
144});\r