Skip to content

Commit

Permalink
Min/Max works better in fileExplorer
Browse files Browse the repository at this point in the history
  • Loading branch information
chinonso098 committed Sep 6, 2024
1 parent 57a19bf commit 0a089be
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/app/system-apps/audioplayer/audioplayer.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { AudioplayerComponent } from './audioplayer.component';
import { AudioPlayerComponent } from './audioplayer.component';

describe('AudioplayerComponent', () => {
let component: AudioplayerComponent;
let fixture: ComponentFixture<AudioplayerComponent>;
let component: AudioPlayerComponent;
let fixture: ComponentFixture<AudioPlayerComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AudioplayerComponent ]
declarations: [ AudioPlayerComponent ]
})
.compileComponents();

fixture = TestBed.createComponent(AudioplayerComponent);
fixture = TestBed.createComponent(AudioPlayerComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
Expand Down
33 changes: 29 additions & 4 deletions src/app/system-apps/fileexplorer/fileexplorer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn
private _autoAlignIconsNotifyBySub!:Subscription;
private _dirFilesUpdatedSub!: Subscription;
private _hideContextMenuSub!:Subscription;
private _maximizeWindowSub!: Subscription;
private _minimizeWindowSub!: Subscription;


private isPrevBtnActive = false;
private isNextBtnActive = false;
Expand Down Expand Up @@ -204,6 +207,8 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn
}
});

this._maximizeWindowSub = this._runningProcessService.maximizeWindowNotify.subscribe(() =>{this.maximizeWindow()});
this._minimizeWindowSub = this._runningProcessService.minimizeWindowNotify.subscribe((p) =>{this.minimizeWindow(p)})
this._sortByNotifySub = fileManagerService.sortByNotify.subscribe((p)=>{this.sortIcons(p)});
this._refreshNotifySub = fileManagerService.refreshNotify.subscribe(()=>{this.refreshIcons()});
this._hideContextMenuSub = this._menuService.hideContextMenus.subscribe(() => { this.onHideIconContextMenu()});
Expand Down Expand Up @@ -259,6 +264,8 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn
this._autoAlignIconsNotifyBySub?.unsubscribe();
this._dirFilesUpdatedSub?.unsubscribe();
this._hideContextMenuSub?.unsubscribe();
this._maximizeWindowSub?.unsubscribe();
this._minimizeWindowSub?.unsubscribe();
}

captureComponentImg():void{
Expand Down Expand Up @@ -1535,11 +1542,30 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn
if(uid === evtOriginator){
this._runningProcessService.removeEventOriginator();
const mainWindow = document.getElementById('vanta');
//window title and button bar, and windows taskbar height
const pixelTosubtract = 30 + 40;
//window title and button bar, and windows taskbar height, fileExplr headerTab container,
//empty line container, fileExplr header container, empty line container 2, footer container
const pixelTosubtract = 30 + 40 + 115.5 + 6 + 24 + 7 + 24;

this.fileExplrMainCntnr.nativeElement.style.height = `${(mainWindow?.offsetHeight || 0 ) - pixelTosubtract}px`;
this.fileExplrMainCntnr.nativeElement.style.width = `${mainWindow?.offsetWidth}px`;
this.fileExplrCntntCntnr.nativeElement.style.height = `${(mainWindow?.offsetHeight || 0 ) - pixelTosubtract}px`;
}
}


minimizeWindow(arg:number[]):void{
const uid = `${this.name}-${this.processId}`;
const evtOriginator = this._runningProcessService.getEventOrginator();

if(uid === evtOriginator){
this._runningProcessService.removeEventOriginator();

// fileExplr headerTab container, empty line container, fileExplr header container, empty line container 2, footer container
const pixelTosubtract = 115.5 + 6 + 24 + 7 + 24;
const windowHeight = arg[1];
const res = windowHeight - pixelTosubtract;

this.fileExplrMainCntnr.nativeElement.style.height = `${res}px`;
this.fileExplrCntntCntnr.nativeElement.style.height = `${res}px`;
}
}

Expand Down Expand Up @@ -1590,7 +1616,6 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn
this.getFileExplorerMenuData();
}


buildViewMenu():NestedMenuItem[]{

const extraLargeIcon:NestedMenuItem={ icon:'osdrive/icons/circle.png', label:'Extra Large icons', action: () => this.isExtraLargeIcon = !this.isExtraLargeIcon, variables:this.isExtraLargeIcon,
Expand Down

0 comments on commit 0a089be

Please sign in to comment.