@@ -434,7 +434,7 @@ export class DropListRef<T = any> {
434434 const items = this . _orientation === 'horizontal' && this . _direction === 'rtl' ?
435435 this . _itemPositions . slice ( ) . reverse ( ) : this . _itemPositions ;
436436
437- return findIndex ( items , currentItem => currentItem . drag === item ) ;
437+ return items . findIndex ( currentItem => currentItem . drag === item ) ;
438438 }
439439
440440 /**
@@ -468,7 +468,7 @@ export class DropListRef<T = any> {
468468 }
469469
470470 const isHorizontal = this . _orientation === 'horizontal' ;
471- const currentIndex = findIndex ( siblings , currentItem => currentItem . drag === item ) ;
471+ const currentIndex = siblings . findIndex ( currentItem => currentItem . drag === item ) ;
472472 const siblingAtNewPosition = siblings [ newIndex ] ;
473473 const currentPosition = siblings [ currentIndex ] . clientRect ;
474474 const newPosition = siblingAtNewPosition . clientRect ;
@@ -754,7 +754,7 @@ export class DropListRef<T = any> {
754754 private _getItemIndexFromPointerPosition ( item : DragRef , pointerX : number , pointerY : number ,
755755 delta ?: { x : number , y : number } ) : number {
756756 const isHorizontal = this . _orientation === 'horizontal' ;
757- const index = findIndex ( this . _itemPositions , ( { drag, clientRect} , _ , array ) => {
757+ const index = this . _itemPositions . findIndex ( ( { drag, clientRect} , _ , array ) => {
758758 if ( drag === item ) {
759759 // If there's only one item left in the container, it must be
760760 // the dragged item itself so we use it as a reference.
@@ -801,15 +801,15 @@ export class DropListRef<T = any> {
801801 const scrollStep = this . autoScrollStep ;
802802
803803 if ( this . _verticalScrollDirection === AutoScrollVerticalDirection . UP ) {
804- incrementVerticalScroll ( node , - scrollStep ) ;
804+ node . scrollBy ( 0 , - scrollStep ) ;
805805 } else if ( this . _verticalScrollDirection === AutoScrollVerticalDirection . DOWN ) {
806- incrementVerticalScroll ( node , scrollStep ) ;
806+ node . scrollBy ( 0 , scrollStep ) ;
807807 }
808808
809809 if ( this . _horizontalScrollDirection === AutoScrollHorizontalDirection . LEFT ) {
810- incrementHorizontalScroll ( node , - scrollStep ) ;
810+ node . scrollBy ( - scrollStep , 0 ) ;
811811 } else if ( this . _horizontalScrollDirection === AutoScrollHorizontalDirection . RIGHT ) {
812- incrementHorizontalScroll ( node , scrollStep ) ;
812+ node . scrollBy ( scrollStep , 0 ) ;
813813 }
814814 } ) ;
815815 }
@@ -953,52 +953,6 @@ export class DropListRef<T = any> {
953953}
954954
955955
956- /**
957- * Finds the index of an item that matches a predicate function. Used as an equivalent
958- * of `Array.prototype.findIndex` which isn't part of the standard Google typings.
959- * @param array Array in which to look for matches.
960- * @param predicate Function used to determine whether an item is a match.
961- */
962- function findIndex < T > ( array : T [ ] ,
963- predicate : ( value : T , index : number , obj : T [ ] ) => boolean ) : number {
964-
965- for ( let i = 0 ; i < array . length ; i ++ ) {
966- if ( predicate ( array [ i ] , i , array ) ) {
967- return i ;
968- }
969- }
970-
971- return - 1 ;
972- }
973-
974- /**
975- * Increments the vertical scroll position of a node.
976- * @param node Node whose scroll position should change.
977- * @param amount Amount of pixels that the `node` should be scrolled.
978- */
979- function incrementVerticalScroll ( node : HTMLElement | Window , amount : number ) {
980- if ( node === window ) {
981- ( node as Window ) . scrollBy ( 0 , amount ) ;
982- } else {
983- // Ideally we could use `Element.scrollBy` here as well, but IE and Edge don't support it.
984- ( node as HTMLElement ) . scrollTop += amount ;
985- }
986- }
987-
988- /**
989- * Increments the horizontal scroll position of a node.
990- * @param node Node whose scroll position should change.
991- * @param amount Amount of pixels that the `node` should be scrolled.
992- */
993- function incrementHorizontalScroll ( node : HTMLElement | Window , amount : number ) {
994- if ( node === window ) {
995- ( node as Window ) . scrollBy ( amount , 0 ) ;
996- } else {
997- // Ideally we could use `Element.scrollBy` here as well, but IE and Edge don't support it.
998- ( node as HTMLElement ) . scrollLeft += amount ;
999- }
1000- }
1001-
1002956/**
1003957 * Gets whether the vertical auto-scroll direction of a node.
1004958 * @param clientRect Dimensions of the node.
0 commit comments