Skip to content

Commit 645efee

Browse files
Migrated from Mouse to Pointer
1 parent 13bbc77 commit 645efee

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

ui/widgets/slider.js

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
// AMD. Register as an anonymous module.
2525
define( [
2626
"jquery",
27-
"./mouse",
27+
"./pointer",
2828
"../keycode",
2929
"../version",
3030
"../widget"
@@ -37,7 +37,7 @@
3737
} )( function( $ ) {
3838
"use strict";
3939

40-
return $.widget( "ui.slider", $.ui.mouse, {
40+
return $.widget( "ui.slider", $.ui.pointer, {
4141
version: "@VERSION",
4242
widgetEventPrefix: "slide",
4343

@@ -73,11 +73,11 @@ return $.widget( "ui.slider", $.ui.mouse, {
7373

7474
_create: function() {
7575
this._keySliding = false;
76-
this._mouseSliding = false;
76+
this._pointerSliding = false;
7777
this._animateOff = true;
7878
this._handleIndex = null;
7979
this._detectOrientation();
80-
this._mouseInit();
80+
this._pointerInit();
8181
this._calculateNewMax();
8282

8383
this._addClass( "ui-slider ui-slider-" + this.orientation,
@@ -178,11 +178,11 @@ return $.widget( "ui.slider", $.ui.mouse, {
178178
this.range.remove();
179179
}
180180

181-
this._mouseDestroy();
181+
this._pointerDestroy();
182182
},
183183

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,
186186
that = this,
187187
o = this.options;
188188

@@ -197,7 +197,7 @@ return $.widget( "ui.slider", $.ui.mouse, {
197197
this.elementOffset = this.element.offset();
198198

199199
position = { x: event.pageX, y: event.pageY };
200-
normValue = this._normValueFromMouse( position );
200+
normValue = this._normValueFromPointer( position );
201201
distance = this._valueMax() - this._valueMin() + 1;
202202
this.handles.each( function( i ) {
203203
var thisDistance = Math.abs( normValue - that.values( i ) );
@@ -214,16 +214,16 @@ return $.widget( "ui.slider", $.ui.mouse, {
214214
if ( allowed === false ) {
215215
return false;
216216
}
217-
this._mouseSliding = true;
217+
this._pointerSliding = true;
218218

219219
this._handleIndex = index;
220220

221221
this._addClass( closestHandle, null, "ui-state-active" );
222222
closestHandle.trigger( "focus" );
223223

224224
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 } : {
227227
left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
228228
top: event.pageY - offset.top -
229229
( closestHandle.height() / 2 ) -
@@ -239,22 +239,22 @@ return $.widget( "ui.slider", $.ui.mouse, {
239239
return true;
240240
},
241241

242-
_mouseStart: function() {
242+
_pointerStart: function() {
243243
return true;
244244
},
245245

246-
_mouseDrag: function( event ) {
246+
_pointerDrag: function( event ) {
247247
var position = { x: event.pageX, y: event.pageY },
248-
normValue = this._normValueFromMouse( position );
248+
normValue = this._normValueFromPointer( position );
249249

250250
this._slide( event, this._handleIndex, normValue );
251251

252252
return false;
253253
},
254254

255-
_mouseStop: function( event ) {
255+
_pointerStop: function( event ) {
256256
this._removeClass( this.handles, null, "ui-state-active" );
257-
this._mouseSliding = false;
257+
this._pointerSliding = false;
258258

259259
this._stop( event, this._handleIndex );
260260
this._change( event, this._handleIndex );
@@ -270,38 +270,38 @@ return $.widget( "ui.slider", $.ui.mouse, {
270270
this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
271271
},
272272

273-
_normValueFromMouse: function( position ) {
273+
_normValueFromPointer: function( position ) {
274274
var pixelTotal,
275-
pixelMouse,
276-
percentMouse,
275+
pixelPointer,
276+
percentPointer,
277277
valueTotal,
278-
valueMouse;
278+
valuePointer;
279279

280280
if ( this.orientation === "horizontal" ) {
281281
pixelTotal = this.elementSize.width;
282-
pixelMouse = position.x - this.elementOffset.left -
282+
pixelPointer = position.x - this.elementOffset.left -
283283
( this._clickOffset ? this._clickOffset.left : 0 );
284284
} else {
285285
pixelTotal = this.elementSize.height;
286-
pixelMouse = position.y - this.elementOffset.top -
286+
pixelPointer = position.y - this.elementOffset.top -
287287
( this._clickOffset ? this._clickOffset.top : 0 );
288288
}
289289

290-
percentMouse = ( pixelMouse / pixelTotal );
291-
if ( percentMouse > 1 ) {
292-
percentMouse = 1;
290+
percentPointer = ( pixelPointer / pixelTotal );
291+
if ( percentPointer > 1 ) {
292+
percentPointer = 1;
293293
}
294-
if ( percentMouse < 0 ) {
295-
percentMouse = 0;
294+
if ( percentPointer < 0 ) {
295+
percentPointer = 0;
296296
}
297297
if ( this.orientation === "vertical" ) {
298-
percentMouse = 1 - percentMouse;
298+
percentPointer = 1 - percentPointer;
299299
}
300300

301301
valueTotal = this._valueMax() - this._valueMin();
302-
valueMouse = this._valueMin() + percentMouse * valueTotal;
302+
valuePointer = this._valueMin() + percentPointer * valueTotal;
303303

304-
return this._trimAlignValue( valueMouse );
304+
return this._trimAlignValue( valuePointer );
305305
},
306306

307307
_uiHash: function( index, value, values ) {
@@ -366,7 +366,7 @@ return $.widget( "ui.slider", $.ui.mouse, {
366366
},
367367

368368
_change: function( event, index ) {
369-
if ( !this._keySliding && !this._mouseSliding ) {
369+
if ( !this._keySliding && !this._pointerSliding ) {
370370

371371
//store the last changed value index for reference when handles overlap
372372
this._lastChangedValue = index;

0 commit comments

Comments
 (0)