Commit 1a2c87e 1 parent 0512151 commit 1a2c87e Copy full SHA for 1a2c87e
File tree 1 file changed +18
-4
lines changed
1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -774,31 +774,45 @@ export default function sortableContainer(
774
774
y : 10 ,
775
775
} ;
776
776
777
- if ( translate . y >= this . maxTranslate . y - this . height / 2 ) {
777
+ const {
778
+ scrollTop,
779
+ scrollLeft,
780
+ scrollHeight,
781
+ scrollWidth,
782
+ clientHeight,
783
+ clientWidth,
784
+ } = this . scrollContainer ;
785
+
786
+ const isTop = scrollTop === 0 ;
787
+ const isBottom = scrollHeight - scrollTop - clientHeight === 0 ;
788
+ const isLeft = scrollLeft === 0 ;
789
+ const isRight = scrollWidth - scrollLeft - clientWidth === 0 ;
790
+
791
+ if ( translate . y >= this . maxTranslate . y - this . height / 2 && ! isBottom ) {
778
792
// Scroll Down
779
793
direction . y = 1 ;
780
794
speed . y =
781
795
acceleration . y *
782
796
Math . abs (
783
797
( this . maxTranslate . y - this . height / 2 - translate . y ) / this . height ,
784
798
) ;
785
- } else if ( translate . x >= this . maxTranslate . x - this . width / 2 ) {
799
+ } else if ( translate . x >= this . maxTranslate . x - this . width / 2 && ! isRight ) {
786
800
// Scroll Right
787
801
direction . x = 1 ;
788
802
speed . x =
789
803
acceleration . x *
790
804
Math . abs (
791
805
( this . maxTranslate . x - this . width / 2 - translate . x ) / this . width ,
792
806
) ;
793
- } else if ( translate . y <= this . minTranslate . y + this . height / 2 ) {
807
+ } else if ( translate . y <= this . minTranslate . y + this . height / 2 && ! isTop ) {
794
808
// Scroll Up
795
809
direction . y = - 1 ;
796
810
speed . y =
797
811
acceleration . y *
798
812
Math . abs (
799
813
( translate . y - this . height / 2 - this . minTranslate . y ) / this . height ,
800
814
) ;
801
- } else if ( translate . x <= this . minTranslate . x + this . width / 2 ) {
815
+ } else if ( translate . x <= this . minTranslate . x + this . width / 2 && ! isLeft ) {
802
816
// Scroll Left
803
817
direction . x = - 1 ;
804
818
speed . x =
You can’t perform that action at this time.
0 commit comments