@@ -89,13 +89,13 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
8989 private mostRecentActiveGroups : GroupIdentifier [ ] = [ ] ;
9090
9191 private container : HTMLElement ;
92+ private centeredLayoutWidget : CenteredViewLayout ;
9293 private gridWidget : SerializableGrid < IEditorGroupView > ;
9394
9495 private _whenRestored : TPromise < void > ;
9596 private whenRestoredComplete : TValueCallback < void > ;
9697
9798 private previousUIState : IEditorPartUIState ;
98- private centeredViewLayout : CenteredViewLayout ;
9999
100100 constructor (
101101 id : string ,
@@ -708,7 +708,7 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
708708
709709 const separatorBorderStyle = { separatorBorder : this . gridSeparatorBorder } ;
710710 this . gridWidget . style ( separatorBorderStyle ) ;
711- this . centeredViewLayout . styles ( separatorBorderStyle ) ;
711+ this . centeredLayoutWidget . styles ( separatorBorderStyle ) ;
712712 }
713713
714714 createContentArea ( parent : HTMLElement ) : HTMLElement {
@@ -720,7 +720,7 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
720720
721721 // Grid control with center layout
722722 this . doCreateGridControl ( ) ;
723- this . centeredViewLayout = new CenteredViewLayout ( this . container , this . getGridAsView ( ) , this . globalMemento [ EditorPart . EDITOR_PART_CENTERED_VIEW_STORAGE_KEY ] ) ;
723+ this . centeredLayoutWidget = this . _register ( new CenteredViewLayout ( this . container , this . getGridAsView ( ) , this . globalMemento [ EditorPart . EDITOR_PART_CENTERED_VIEW_STORAGE_KEY ] ) ) ;
724724
725725 // Drop support
726726 this . _register ( this . instantiationService . createInstance ( EditorDropTarget , this , this . container ) ) ;
@@ -741,11 +741,11 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
741741 }
742742
743743 centerLayout ( active : boolean ) : void {
744- this . centeredViewLayout . activate ( active ) ;
744+ this . centeredLayoutWidget . activate ( active ) ;
745745 }
746746
747747 isLayoutCentered ( ) : boolean {
748- return this . centeredViewLayout . isActive ( ) ;
748+ return this . centeredLayoutWidget . isActive ( ) ;
749749 }
750750
751751 private doCreateGridControl ( ) : void {
@@ -801,6 +801,7 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
801801 }
802802
803803 private doCreateGridControlWithState ( serializedGrid : ISerializedGrid , activeGroupId : GroupIdentifier , editorGroupViewsToReuse ?: IEditorGroupView [ ] ) : void {
804+
804805 // Determine group views to reuse if any
805806 let reuseGroupViews : IEditorGroupView [ ] ;
806807 if ( editorGroupViewsToReuse ) {
@@ -839,9 +840,10 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
839840 this . gridWidget = gridWidget ;
840841
841842 if ( gridWidget ) {
842- if ( this . centeredViewLayout ) {
843- this . centeredViewLayout . resetView ( this . getGridAsView ( ) ) ;
843+ if ( this . centeredLayoutWidget ) {
844+ this . centeredLayoutWidget . resetView ( this . getGridAsView ( ) ) ;
844845 }
846+
845847 this . _onDidSizeConstraintsChange . input = gridWidget . onDidChange ;
846848 }
847849
@@ -999,7 +1001,7 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
9991001
10001002 // Layout Grid
10011003 try {
1002- this . centeredViewLayout . layout ( this . dimension . width , this . dimension . height ) ;
1004+ this . centeredLayoutWidget . layout ( this . dimension . width , this . dimension . height ) ;
10031005 } catch ( error ) {
10041006 this . gridError ( error ) ;
10051007 }
@@ -1024,7 +1026,9 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
10241026 this . memento [ EditorPart . EDITOR_PART_UI_STATE_STORAGE_KEY ] = uiState ;
10251027 }
10261028 }
1027- this . globalMemento [ EditorPart . EDITOR_PART_CENTERED_VIEW_STORAGE_KEY ] = this . centeredViewLayout . state ;
1029+
1030+ // Persist centered view state
1031+ this . globalMemento [ EditorPart . EDITOR_PART_CENTERED_VIEW_STORAGE_KEY ] = this . centeredLayoutWidget . state ;
10281032
10291033 // Forward to all groups
10301034 this . groupViews . forEach ( group => group . shutdown ( ) ) ;
@@ -1042,7 +1046,6 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
10421046 if ( this . gridWidget ) {
10431047 this . gridWidget . dispose ( ) ;
10441048 }
1045- this . centeredViewLayout . dispose ( ) ;
10461049
10471050 super . dispose ( ) ;
10481051 }
0 commit comments