Skip to content

Commit

Permalink
hideContextMenu using events in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
chinonso098 committed Aug 19, 2024
1 parent 0ca7e33 commit 1a6d12d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
7 changes: 4 additions & 3 deletions src/app/system-apps/desktop/desktop.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class DesktopComponent implements OnInit, OnDestroy, AfterViewInit{

private _timerSubscription!: Subscription;
private _showTaskBarMenuSub!:Subscription;
private _hideMenuSub!:Subscription;
private _hideContextMenuSub!:Subscription;
private _showTaskBarPreviewWindowSub!:Subscription;
private _hideTaskBarPreviewWindowSub!:Subscription;
private _keepTaskBarPreviewWindowSub!:Subscription;
Expand Down Expand Up @@ -151,10 +151,11 @@ export class DesktopComponent implements OnInit, OnDestroy, AfterViewInit{

this._showTaskBarMenuSub = this._menuService.showTaskBarMenu.subscribe((p) => { this.onShowTaskBarContextMenu(p)});
this._showTaskBarPreviewWindowSub = this._runningProcessService.showPreviewWindowNotify.subscribe((p) => { this.showTaskBarPreviewWindow(p)});
this._hideMenuSub = this._menuService.hideContextMenus.subscribe(() => { this.hideContextMenu()});
this._hideContextMenuSub = this._menuService.hideContextMenus.subscribe(() => { this.hideContextMenu()});
this._hideTaskBarPreviewWindowSub = this._runningProcessService.hidePreviewWindowNotify.subscribe(() => { this.hideTaskBarPreviewWindow()});
this._keepTaskBarPreviewWindowSub = this._runningProcessService.keepPreviewWindowNotify.subscribe(() => { this.keepTaskBarPreviewWindow()});


this.processId = this._processIdService.getNewProcessId()
this._runningProcessService.addProcess(this.getComponentDetail());
this.CURRENT_DEG = this.getRandomInt(0, 360);
Expand Down Expand Up @@ -207,7 +208,7 @@ export class DesktopComponent implements OnInit, OnDestroy, AfterViewInit{
ngOnDestroy(): void {
this._timerSubscription?.unsubscribe();
this._showTaskBarMenuSub?.unsubscribe();
this._hideMenuSub?.unsubscribe();
this._hideContextMenuSub?.unsubscribe();
this._showTaskBarPreviewWindowSub?.unsubscribe();
this._hideTaskBarPreviewWindowSub?.unsubscribe();
this._keepTaskBarPreviewWindowSub?.unsubscribe();
Expand Down
21 changes: 12 additions & 9 deletions src/app/system-apps/fileexplorer/fileexplorer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn
private _autoArrangeIconsNotifySub!:Subscription;
private _autoAlignIconsNotifyBySub!:Subscription;
private _dirFilesUpdatedSub!: Subscription;
private _hideContextMenuSub!:Subscription;

private isPrevBtnActive = false;
private isNextBtnActive = false;
Expand Down Expand Up @@ -205,7 +206,7 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn

this._sortByNotifySub = fileManagerService.sortByNotify.subscribe((p)=>{this.sortIcons(p)});
this._refreshNotifySub = fileManagerService.refreshNotify.subscribe(()=>{this.refreshIcons()});

this._hideContextMenuSub = this._menuService.hideContextMenus.subscribe(() => { this.onHideIconContextMenu()});
}

ngOnInit():void{
Expand Down Expand Up @@ -250,6 +251,16 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn

}

ngOnDestroy(): void {
this._viewByNotifySub?.unsubscribe();
this._sortByNotifySub?.unsubscribe();
this._refreshNotifySub?.unsubscribe();
this._autoArrangeIconsNotifySub?.unsubscribe();
this._autoAlignIconsNotifyBySub?.unsubscribe();
this._dirFilesUpdatedSub?.unsubscribe();
this._hideContextMenuSub?.unsubscribe();
}

captureComponentImg():void{
htmlToImage.toPng(this.fileExplorerRootContainer.nativeElement).then(htmlImg =>{
//console.log('img data:',htmlImg);
Expand Down Expand Up @@ -628,14 +639,6 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn
}
}

ngOnDestroy(): void {
this._viewByNotifySub?.unsubscribe();
this._sortByNotifySub?.unsubscribe();
this._refreshNotifySub?.unsubscribe();
this._autoArrangeIconsNotifySub?.unsubscribe();
this._autoAlignIconsNotifyBySub?.unsubscribe();
this._dirFilesUpdatedSub?.unsubscribe();
}

onDragOver(event:DragEvent):void{
event.stopPropagation();
Expand Down
3 changes: 3 additions & 0 deletions src/app/system-apps/filemanager/filemanager.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export class FileManagerComponent implements BaseComponent, OnInit, AfterViewIni
private _autoAlignIconsNotifyBySub!:Subscription;
private _showDesktopIconNotifySub!:Subscription;
private _dirFilesUpdatedSub!: Subscription;
private _hideContextMenuSub!:Subscription;

private autoAlign = true;
private autoArrange = false;
Expand Down Expand Up @@ -111,6 +112,7 @@ export class FileManagerComponent implements BaseComponent, OnInit, AfterViewIni
this._autoAlignIconsNotifyBySub = fileManagerService.alignIconsToGridNotify.subscribe((p) => {this.toggleAutoAlignIconsToGrid(p)});
this._refreshNotifySub = fileManagerService.refreshNotify.subscribe(()=>{this.refreshIcons()});
this._showDesktopIconNotifySub = fileManagerService.showDesktopIconsNotify.subscribe((p) =>{this.toggleDesktopIcons(p)});
this._hideContextMenuSub = this._menuService.hideContextMenus.subscribe(() => { this.onHideIconContextMenu()});
}

ngOnInit():void{
Expand All @@ -131,6 +133,7 @@ export class FileManagerComponent implements BaseComponent, OnInit, AfterViewIni
this._autoAlignIconsNotifyBySub?.unsubscribe();
this._showDesktopIconNotifySub?.unsubscribe();
this._dirFilesUpdatedSub?.unsubscribe();
this._hideContextMenuSub?.unsubscribe();
}

onDragOver(event:DragEvent):void{
Expand Down

0 comments on commit 1a6d12d

Please sign in to comment.