24
24
// AMD. Register as an anonymous module.
25
25
define ( [
26
26
"jquery" ,
27
- "./mouse " ,
27
+ "./pointer " ,
28
28
"../keycode" ,
29
29
"../version" ,
30
30
"../widget"
37
37
} ) ( function ( $ ) {
38
38
"use strict" ;
39
39
40
- return $ . widget ( "ui.slider" , $ . ui . mouse , {
40
+ return $ . widget ( "ui.slider" , $ . ui . pointer , {
41
41
version : "@VERSION" ,
42
42
widgetEventPrefix : "slide" ,
43
43
@@ -73,11 +73,11 @@ return $.widget( "ui.slider", $.ui.mouse, {
73
73
74
74
_create : function ( ) {
75
75
this . _keySliding = false ;
76
- this . _mouseSliding = false ;
76
+ this . _pointerSliding = false ;
77
77
this . _animateOff = true ;
78
78
this . _handleIndex = null ;
79
79
this . _detectOrientation ( ) ;
80
- this . _mouseInit ( ) ;
80
+ this . _pointerInit ( ) ;
81
81
this . _calculateNewMax ( ) ;
82
82
83
83
this . _addClass ( "ui-slider ui-slider-" + this . orientation ,
@@ -178,11 +178,11 @@ return $.widget( "ui.slider", $.ui.mouse, {
178
178
this . range . remove ( ) ;
179
179
}
180
180
181
- this . _mouseDestroy ( ) ;
181
+ this . _pointerDestroy ( ) ;
182
182
} ,
183
183
184
- _mouseCapture : function ( event ) {
185
- var position , normValue , distance , closestHandle , index , allowed , offset , mouseOverHandle ,
184
+ _pointerCapture : function ( event ) {
185
+ var position , normValue , distance , closestHandle , index , allowed , offset , pointerOverHandle ,
186
186
that = this ,
187
187
o = this . options ;
188
188
@@ -197,7 +197,7 @@ return $.widget( "ui.slider", $.ui.mouse, {
197
197
this . elementOffset = this . element . offset ( ) ;
198
198
199
199
position = { x : event . pageX , y : event . pageY } ;
200
- normValue = this . _normValueFromMouse ( position ) ;
200
+ normValue = this . _normValueFromPointer ( position ) ;
201
201
distance = this . _valueMax ( ) - this . _valueMin ( ) + 1 ;
202
202
this . handles . each ( function ( i ) {
203
203
var thisDistance = Math . abs ( normValue - that . values ( i ) ) ;
@@ -214,16 +214,16 @@ return $.widget( "ui.slider", $.ui.mouse, {
214
214
if ( allowed === false ) {
215
215
return false ;
216
216
}
217
- this . _mouseSliding = true ;
217
+ this . _pointerSliding = true ;
218
218
219
219
this . _handleIndex = index ;
220
220
221
221
this . _addClass ( closestHandle , null , "ui-state-active" ) ;
222
222
closestHandle . trigger ( "focus" ) ;
223
223
224
224
offset = closestHandle . offset ( ) ;
225
- mouseOverHandle = ! $ ( event . target ) . parents ( ) . addBack ( ) . is ( ".ui-slider-handle" ) ;
226
- this . _clickOffset = mouseOverHandle ? { left : 0 , top : 0 } : {
225
+ pointerOverHandle = ! $ ( event . target ) . parents ( ) . addBack ( ) . is ( ".ui-slider-handle" ) ;
226
+ this . _clickOffset = pointerOverHandle ? { left : 0 , top : 0 } : {
227
227
left : event . pageX - offset . left - ( closestHandle . width ( ) / 2 ) ,
228
228
top : event . pageY - offset . top -
229
229
( closestHandle . height ( ) / 2 ) -
@@ -239,22 +239,22 @@ return $.widget( "ui.slider", $.ui.mouse, {
239
239
return true ;
240
240
} ,
241
241
242
- _mouseStart : function ( ) {
242
+ _pointerStart : function ( ) {
243
243
return true ;
244
244
} ,
245
245
246
- _mouseDrag : function ( event ) {
246
+ _pointerDrag : function ( event ) {
247
247
var position = { x : event . pageX , y : event . pageY } ,
248
- normValue = this . _normValueFromMouse ( position ) ;
248
+ normValue = this . _normValueFromPointer ( position ) ;
249
249
250
250
this . _slide ( event , this . _handleIndex , normValue ) ;
251
251
252
252
return false ;
253
253
} ,
254
254
255
- _mouseStop : function ( event ) {
255
+ _pointerStop : function ( event ) {
256
256
this . _removeClass ( this . handles , null , "ui-state-active" ) ;
257
- this . _mouseSliding = false ;
257
+ this . _pointerSliding = false ;
258
258
259
259
this . _stop ( event , this . _handleIndex ) ;
260
260
this . _change ( event , this . _handleIndex ) ;
@@ -270,38 +270,38 @@ return $.widget( "ui.slider", $.ui.mouse, {
270
270
this . orientation = ( this . options . orientation === "vertical" ) ? "vertical" : "horizontal" ;
271
271
} ,
272
272
273
- _normValueFromMouse : function ( position ) {
273
+ _normValueFromPointer : function ( position ) {
274
274
var pixelTotal ,
275
- pixelMouse ,
276
- percentMouse ,
275
+ pixelPointer ,
276
+ percentPointer ,
277
277
valueTotal ,
278
- valueMouse ;
278
+ valuePointer ;
279
279
280
280
if ( this . orientation === "horizontal" ) {
281
281
pixelTotal = this . elementSize . width ;
282
- pixelMouse = position . x - this . elementOffset . left -
282
+ pixelPointer = position . x - this . elementOffset . left -
283
283
( this . _clickOffset ? this . _clickOffset . left : 0 ) ;
284
284
} else {
285
285
pixelTotal = this . elementSize . height ;
286
- pixelMouse = position . y - this . elementOffset . top -
286
+ pixelPointer = position . y - this . elementOffset . top -
287
287
( this . _clickOffset ? this . _clickOffset . top : 0 ) ;
288
288
}
289
289
290
- percentMouse = ( pixelMouse / pixelTotal ) ;
291
- if ( percentMouse > 1 ) {
292
- percentMouse = 1 ;
290
+ percentPointer = ( pixelPointer / pixelTotal ) ;
291
+ if ( percentPointer > 1 ) {
292
+ percentPointer = 1 ;
293
293
}
294
- if ( percentMouse < 0 ) {
295
- percentMouse = 0 ;
294
+ if ( percentPointer < 0 ) {
295
+ percentPointer = 0 ;
296
296
}
297
297
if ( this . orientation === "vertical" ) {
298
- percentMouse = 1 - percentMouse ;
298
+ percentPointer = 1 - percentPointer ;
299
299
}
300
300
301
301
valueTotal = this . _valueMax ( ) - this . _valueMin ( ) ;
302
- valueMouse = this . _valueMin ( ) + percentMouse * valueTotal ;
302
+ valuePointer = this . _valueMin ( ) + percentPointer * valueTotal ;
303
303
304
- return this . _trimAlignValue ( valueMouse ) ;
304
+ return this . _trimAlignValue ( valuePointer ) ;
305
305
} ,
306
306
307
307
_uiHash : function ( index , value , values ) {
@@ -366,7 +366,7 @@ return $.widget( "ui.slider", $.ui.mouse, {
366
366
} ,
367
367
368
368
_change : function ( event , index ) {
369
- if ( ! this . _keySliding && ! this . _mouseSliding ) {
369
+ if ( ! this . _keySliding && ! this . _pointerSliding ) {
370
370
371
371
//store the last changed value index for reference when handles overlap
372
372
this . _lastChangedValue = index ;
0 commit comments