@@ -737,13 +737,24 @@ export class Draggable extends Base<HTMLElement> implements INotifyPropertyChang
737737 }
738738 let draEleTop : number ;
739739 let draEleLeft : number ;
740- if ( this . dragArea ) {
741- this . dragLimit . top = this . clone ? this . dragLimit . top : 0 ;
742- draEleTop = ( top - iTop ) < 0 ? this . dragLimit . top : ( top - this . borderWidth . top ) ;
743- draEleLeft = ( left - iLeft ) < 0 ? this . dragLimit . left : ( left - this . borderWidth . left ) ;
740+ if ( this . helperElement . classList . contains ( 'e-treeview' ) ) {
741+ if ( this . dragArea ) {
742+ this . dragLimit . top = this . clone ? this . dragLimit . top : 0 ;
743+ draEleTop = ( top - iTop ) < 0 ? this . dragLimit . top : ( top - this . borderWidth . top ) ;
744+ draEleLeft = ( left - iLeft ) < 0 ? this . dragLimit . left : ( left - this . borderWidth . left ) ;
745+ } else {
746+ draEleTop = top - this . borderWidth . top ;
747+ draEleLeft = left - this . borderWidth . left ;
748+ }
744749 } else {
745- draEleTop = top - this . borderWidth . top ;
746- draEleLeft = left - this . borderWidth . left ;
750+ if ( this . dragArea ) {
751+ this . dragLimit . top = this . clone ? this . dragLimit . top : 0 ;
752+ draEleTop = ( top - iTop ) < 0 ? this . dragLimit . top : ( top - iTop ) ;
753+ draEleLeft = ( left - iLeft ) < 0 ? this . dragElePosition . left : ( left - iLeft ) ;
754+ } else {
755+ draEleTop = top - iTop ;
756+ draEleLeft = left - iLeft ;
757+ }
747758 }
748759 let marginTop : number = parseFloat ( getComputedStyle ( this . element ) . marginTop ) ;
749760 // when drag-element has margin-top
@@ -774,7 +785,7 @@ export class Draggable extends Base<HTMLElement> implements INotifyPropertyChang
774785 }
775786 }
776787
777- if ( this . dragArea ) {
788+ if ( this . dragArea && this . helperElement . classList . contains ( 'e-treeview' ) ) {
778789 let helperHeight : number = helperElement . offsetHeight + ( parseFloat ( styles . marginTop )
779790 + parseFloat ( styles . marginBottom ) ) ;
780791 draEleTop = ( draEleTop + helperHeight ) > this . dragLimit . bottom ? ( this . dragLimit . bottom - helperHeight ) : draEleTop ;
@@ -849,7 +860,7 @@ export class Draggable extends Base<HTMLElement> implements INotifyPropertyChang
849860 nodeEle . scrollTop -= this . helperElement . clientHeight ;
850861 }
851862 } else if ( nodeEle && nodeEle !== document . scrollingElement ) {
852- if ( ( nodeEle . clientHeight + nodeEle . getBoundingClientRect ( ) . top - this . helperElement . clientHeight + document . scrollingElement . scrollTop - this . borderWidth . top - this . borderWidth . bottom ) <= draEleTop ) {
863+ if ( ( nodeEle . clientHeight + nodeEle . getBoundingClientRect ( ) . top - this . helperElement . clientHeight + document . scrollingElement . scrollTop ) < draEleTop ) {
853864 nodeEle . scrollTop += this . helperElement . clientHeight ;
854865 } else if ( nodeEle . getBoundingClientRect ( ) . top > ( draEleTop - this . helperElement . clientHeight - document . scrollingElement . scrollTop ) ) {
855866 nodeEle . scrollTop -= this . helperElement . clientHeight ;
@@ -959,7 +970,7 @@ export class Draggable extends Base<HTMLElement> implements INotifyPropertyChang
959970 if ( ele ) {
960971 let elementArea : ClientRect = ele . getBoundingClientRect ( ) ;
961972 eleWidthBound = ele . scrollWidth ? ele . scrollWidth : elementArea . right - elementArea . left ;
962- eleHeightBound = ele . scrollHeight ? ( this . dragArea && this . helperElement . classList . contains ( 'e-treeview' ) ) ? ele . clientHeight : ele . scrollHeight : elementArea . bottom - elementArea . top ;
973+ eleHeightBound = ele . scrollHeight ? ( this . dragArea && ! isNullOrUndefined ( this . helperElement ) && this . helperElement . classList . contains ( 'e-treeview' ) ) ? ele . clientHeight : ele . scrollHeight : elementArea . bottom - elementArea . top ;
963974 let keys : string [ ] = [ 'Top' , 'Left' , 'Bottom' , 'Right' ] ;
964975 let styles : any = getComputedStyle ( ele ) ;
965976 for ( let i : number = 0 ; i < keys . length ; i ++ ) {
@@ -970,7 +981,11 @@ export class Draggable extends Base<HTMLElement> implements INotifyPropertyChang
970981 ( < any > this . borderWidth ) [ lowerKey ] = isNaN ( parseFloat ( tborder ) ) ? 0 : parseFloat ( tborder ) ;
971982 ( < any > this . padding ) [ lowerKey ] = isNaN ( parseFloat ( tpadding ) ) ? 0 : parseFloat ( tpadding ) ;
972983 }
973- top = elementArea . top + document . scrollingElement . scrollTop ;
984+ if ( this . dragArea && ! isNullOrUndefined ( this . helperElement ) && this . helperElement . classList . contains ( 'e-treeview' ) ) {
985+ top = elementArea . top + document . scrollingElement . scrollTop ;
986+ } else {
987+ top = elementArea . top ;
988+ }
974989 left = elementArea . left ;
975990 this . dragLimit . left = left + this . borderWidth . left + this . padding . left ;
976991 this . dragLimit . top = ele . offsetTop + this . borderWidth . top + this . padding . top ;
0 commit comments