@@ -116,33 +116,35 @@ var FixedDataTableCell = React.createClass({
116116 newState . isReorderingThisColumn = true ;
117117
118118 } else {
119- var theTurningPoint = left + ( props . width / 2 ) - ( props . columnReorderingData . columnWidth / 2 ) ;
120- theTurningPoint = Math . max ( theTurningPoint , 0 ) ;
121- theTurningPoint = Math . min ( theTurningPoint , farthestPossiblePoint ) ;
119+ var centerOfThisColumn = left + ( props . width / 2 ) ;
122120
123121 // cell is before the one being dragged
124- if ( originalLeft > props . left ) {
125- if ( reorderCellLeft <= theTurningPoint ) {
122+ if ( reorderCellLeft > left ) {
123+ if ( reorderCellLeft < centerOfThisColumn ) {
126124 newState . displacement = props . columnReorderingData . columnWidth ;
127125 if ( ! props . columnReorderingData . columnAfter ) {
128126 props . columnReorderingData . columnAfter = props . columnKey ;
129127 }
130128 } else {
131- newState . displacement = 0 ;
129+ if ( props . left < originalLeft ) {
130+ newState . displacement = 0 ;
131+ }
132132 props . columnReorderingData . columnBefore = props . columnKey ;
133133 }
134134 }
135135
136136 // cell is after the one being dragged
137- if ( originalLeft < props . left ) {
138- if ( reorderCellLeft >= theTurningPoint ) {
137+ if ( reorderCellLeft < left ) {
138+ if ( reorderCellLeft + props . columnReorderingData . columnWidth > centerOfThisColumn ) {
139139 newState . displacement = - props . columnReorderingData . columnWidth ;
140140 props . columnReorderingData . columnBefore = props . columnKey ;
141141 } else {
142- newState . displacement = 0 ;
143142 if ( ! props . columnReorderingData . columnAfter ) {
144143 props . columnReorderingData . columnAfter = props . columnKey ;
145144 }
145+ if ( props . left > originalLeft ) {
146+ newState . displacement = 0 ;
147+ }
146148 }
147149 }
148150 }
0 commit comments