Skip to content

Commit

Permalink
fixed context menu hide/show in file-explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
chinonso098 authored Aug 20, 2024
1 parent e022200 commit 2ad8f7f
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions src/app/system-apps/fileexplorer/fileexplorer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -752,14 +752,11 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn
}

onShowIconContextMenu(evt:MouseEvent, file:FileInfo, id:number):void{
// looking at what Windows does, at any given time. there is only one context window open
this._menuService.hideContextMenus.next();

const menuHeight = 213; //this is not ideal
const menuHeight = 213; //this is not ideal.. menu height should be gotten dynmically
this.iconCntxtCntr++;
if(this.showFileExplrCntxtMenu){
this.showFileExplrCntxtMenu = false;
this.fileExplrCntxtCntr = 0;
this._menuService.hideContextMenus.next();
}

const rect = this.fileExplrCntntCntnr.nativeElement.getBoundingClientRect();
const axis = this.checkAndHandleMenuBounds(rect, evt, menuHeight);
Expand Down Expand Up @@ -789,15 +786,13 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn

onShowFileExplorerContextMenu(evt:MouseEvent):void{

const menuHeight = 230; //this is not ideal
this.fileExplrCntxtCntr++;
if(this.iconCntxtCntr >= this.fileExplrCntxtCntr)
return;
else{
this.showIconCntxtMenu = false;
this.iconCntxtCntr = 0;
this._menuService.hideContextMenus.next();
}

// looking at what Windows does, at any given time. there is only one context window open
this._menuService.hideContextMenus.next();
const menuHeight = 230; //this is not ideal.. menu height should be gotten dynmically

const rect = this.fileExplrCntntCntnr.nativeElement.getBoundingClientRect();
const axis = this.checkAndHandleMenuBounds(rect, evt, menuHeight);
Expand Down Expand Up @@ -1000,7 +995,6 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn
return {xAxis, yAxis};
}


//menu doesn't exist when this method is first called
// getMenuHeight(menuId:string):number{
// const nestedMenu = document.getElementById(menuId) as HTMLDivElement;
Expand Down Expand Up @@ -1672,5 +1666,4 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn
private getComponentDetail():Process{
return new Process(this.processId, this.name, this.icon, this.hasWindow, this.type);
}

}

0 comments on commit 2ad8f7f

Please sign in to comment.