@@ -266,6 +266,20 @@ export class SplitView extends Disposable {
266266 return this . sashItems . map ( s => s . sash ) ;
267267 }
268268
269+ private _startSnappingEnabled = true ;
270+ get startSnappingEnabled ( ) : boolean { return this . _startSnappingEnabled ; }
271+ set startSnappingEnabled ( startSnappingEnabled : boolean ) {
272+ this . _startSnappingEnabled = startSnappingEnabled ;
273+ this . updateSashEnablement ( ) ;
274+ }
275+
276+ private _endSnappingEnabled = true ;
277+ get endSnappingEnabled ( ) : boolean { return this . _endSnappingEnabled ; }
278+ set endSnappingEnabled ( endSnappingEnabled : boolean ) {
279+ this . _endSnappingEnabled = endSnappingEnabled ;
280+ this . updateSashEnablement ( ) ;
281+ }
282+
269283 constructor ( container : HTMLElement , options : ISplitViewOptions = { } ) {
270284 super ( ) ;
271285
@@ -870,8 +884,10 @@ export class SplitView extends Disposable {
870884
871885 // Layout sashes
872886 this . sashItems . forEach ( item => item . sash . layout ( ) ) ;
887+ this . updateSashEnablement ( ) ;
888+ }
873889
874- // Update sashes enablement
890+ private updateSashEnablement ( ) : void {
875891 let previous = false ;
876892 const collapsesDown = this . viewItems . map ( i => previous = ( i . size - i . minimumSize > 0 ) || previous ) ;
877893
@@ -885,7 +901,12 @@ export class SplitView extends Disposable {
885901 previous = false ;
886902 const expandsUp = reverseViews . map ( i => previous = ( i . maximumSize - i . size > 0 ) || previous ) . reverse ( ) ;
887903
888- this . sashItems . forEach ( ( { sash } , index ) => {
904+ let position = 0 ;
905+ for ( let index = 0 ; index < this . sashItems . length ; index ++ ) {
906+ const { sash } = this . sashItems [ index ] ;
907+ const viewItem = this . viewItems [ index ] ;
908+ position += viewItem . size ;
909+
889910 const min = ! ( collapsesDown [ index ] && expandsUp [ index + 1 ] ) ;
890911 const max = ! ( expandsDown [ index ] && collapsesUp [ index + 1 ] ) ;
891912
@@ -898,9 +919,9 @@ export class SplitView extends Disposable {
898919 const snappedBefore = typeof snapBeforeIndex === 'number' && ! this . viewItems [ snapBeforeIndex ] . visible ;
899920 const snappedAfter = typeof snapAfterIndex === 'number' && ! this . viewItems [ snapAfterIndex ] . visible ;
900921
901- if ( snappedBefore && collapsesUp [ index ] ) {
922+ if ( snappedBefore && collapsesUp [ index ] && ( position > 0 || this . startSnappingEnabled ) ) {
902923 sash . state = SashState . Minimum ;
903- } else if ( snappedAfter && collapsesDown [ index ] ) {
924+ } else if ( snappedAfter && collapsesDown [ index ] && ( position < this . contentSize || this . endSnappingEnabled ) ) {
904925 sash . state = SashState . Maximum ;
905926 } else {
906927 sash . state = SashState . Disabled ;
@@ -912,7 +933,7 @@ export class SplitView extends Disposable {
912933 } else {
913934 sash . state = SashState . Enabled ;
914935 }
915- } ) ;
936+ }
916937 }
917938
918939 private getSashPosition ( sash : Sash ) : number {
0 commit comments