@@ -249,7 +249,7 @@ ScrollBox.prototype.enable = function enable() {
249
249
}
250
250
251
251
// set initial position
252
- this . _setTranslate ( 0 , 0 ) ;
252
+ this . setTranslate ( ) ;
253
253
} ;
254
254
255
255
/**
@@ -304,7 +304,7 @@ ScrollBox.prototype._onBoxDrag = function onBarDrag() {
304
304
}
305
305
else yf = 0 ;
306
306
307
- this . _setTranslate ( xf , yf ) ;
307
+ this . setTranslate ( xf , yf ) ;
308
308
} ;
309
309
310
310
/**
@@ -338,17 +338,20 @@ ScrollBox.prototype._onBarDrag = function onBarDrag() {
338
338
}
339
339
else yf = 0 ;
340
340
341
- this . _setTranslate ( xf , yf ) ;
341
+ this . setTranslate ( xf , yf ) ;
342
342
} ;
343
343
344
344
/**
345
345
* Set clip path and scroll bar translate transform
346
346
*
347
347
* @method
348
- * @param {number } xf Horizontal position as a container fraction
349
- * @param {number } yf Vertical position as a container fraction
348
+ * @param {number } [xf=0] Horizontal position as a container fraction
349
+ * @param {number } [yf=0] Vertical position as a container fraction
350
350
*/
351
- ScrollBox . prototype . _setTranslate = function _setTranslate ( xf , yf ) {
351
+ ScrollBox . prototype . setTranslate = function setTranslate ( xf , yf ) {
352
+ xf = Lib . constrain ( xf || 0 , 0 , 1 ) ;
353
+ yf = Lib . constrain ( yf || 0 , 0 , 1 ) ;
354
+
352
355
// store xf and yf (needed by ScrollBox.prototype._on*Drag)
353
356
this . _xf = xf ;
354
357
this . _yf = yf ;
0 commit comments