Skip to content

Commit

Permalink
cntxt menus still in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
chinonso098 committed Aug 17, 2024
1 parent 253fe0e commit 6e82ee5
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/app/shared/system-component/menu/menu.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<div class="dm-dsktp-vertical-menu">
<div class="dm-dsktp-empty-line-container"></div>

<div class="dm-dsktp-vertical-sub-menu" *ngFor="let menuItem of desktopMenu" >
<div class="dm-dsktp-vertical-sub-menu" *ngFor="let menuItem of nestedMenu" >

<div *ngIf="menuItem.label !== paste" class="dm-dsktp-vertical-menu-item" (click)="onMenuItemClick(menuItem.action)">
<div class="dm-dsktp-head"><figure class="dm-dsktp-figure"><img *ngIf="menuItem.icon1" class="dm-dsktp-img" [src]="menuItem.icon1"/></figure></div>
Expand Down Expand Up @@ -98,7 +98,7 @@
<div class="dm-fileExplr-vertical-menu">
<div class="dm-fileExplr-empty-line-container"></div>

<div class="dm-fileExplr-vertical-sub-menu" *ngFor="let menuItem of desktopMenu" >
<div class="dm-fileExplr-vertical-sub-menu" *ngFor="let menuItem of nestedMenu" >

<div *ngIf="menuItem.label !== paste" class="dm-fileExplr-vertical-menu-item" (click)="onMenuItemClick(menuItem.action)">
<div class="dm-fileExplr-head"><figure class="dm-fileExplr-figure"><img *ngIf="menuItem.icon1" class="dm-fileExplr-img" [src]="menuItem.icon1"/></figure></div>
Expand Down
8 changes: 4 additions & 4 deletions src/app/shared/system-component/menu/menu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Subscription } from 'rxjs';
export class MenuComponent implements OnChanges, OnDestroy{

@Input() generalMenu: GeneralMenu[] = [];
@Input() desktopMenu: NestedMenu[] = [];
@Input() nestedMenu: NestedMenu[] = [];
@Input() fileExplorerMenu: NestedMenu[] = [];
@Input() menuType = '';

Expand All @@ -20,16 +20,16 @@ export class MenuComponent implements OnChanges, OnDestroy{
isPasteActive!:boolean;

menuOption = '';
fileExplrMngrMenuOption = "file-explorer-file-manager-menu";
tskBarMenuOption = "taskbar-menu";
deskTopMenuOption = "desktop-menu";
fileExplrMenuOption = "file-explorer-menu";
fileExplrMngrMenuOption = "file-explorer-file-manager-menu";

keys: string[] = [];
paste = 'Paste';
readonly paste = 'Paste';

constructor(menuService:MenuService) {
this._menuService = menuService;

this.isPasteActive = this._menuService.getPasteState();
this._storeDataSub = this._menuService.storeData.subscribe(p => {

Expand Down
1 change: 0 additions & 1 deletion src/app/shared/system-service/file.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import * as BrowserFS from 'browserfs';
import { Buffer } from 'buffer';
import osDriveFileSystemIndex from '../../../osdrive.json';
import ini from 'ini';
import { P } from "@angular/cdk/keycodes";

@Injectable({
providedIn: 'root'
Expand Down
2 changes: 1 addition & 1 deletion src/app/system-apps/desktop/desktop.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<img [src]="dsktpPrevImg"/>
</div>

<cos-menu [desktopMenu]="deskTopMenu" *ngIf="showDesktopCntxtMenu" [style]="dskTopCntxtMenuStyle" [menuType]="deskTopMenuOption"> </cos-menu>
<cos-menu [nestedMenu]="deskTopMenu" *ngIf="showDesktopCntxtMenu" [style]="dskTopCntxtMenuStyle" [menuType]="deskTopMenuOption"> </cos-menu>
<cos-taskbarpreview [fadeState]="tskBarPreviewWindowState" [name]="appToPreview" [icon]="appToPreviewIcon" *ngIf="showTskBarPreviewWindow" [ngStyle]="tskBarPrevWindowStyle"> </cos-taskbarpreview>
<cos-menu [generalMenu]="taskBarMenuData" *ngIf="showTskBarCntxtMenu" [style]="tskBarCntxtMenuStyle" [menuType]="tskBarMenuOption"> </cos-menu>
<ng-content> </ng-content>
Expand Down
6 changes: 3 additions & 3 deletions src/app/system-apps/fileexplorer/fileexplorer.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@
<!-- ngDraggable [inBounds]="true" zIndex="1" [preventDefaultEvent]="true"
(stopped)="onDragEnd($event)" (started)="onDragStart($event)" -->

<ol [ngClass]="olClassName" (dragover)="onDragOver($event)" (drop)="onDrop($event)" (click)="onHideIconContextMenu()" (contextmenu)="showFileExplorerContextMenu($event)" id="olElmnt-{{this.processId}}">
<ol [ngClass]="olClassName" (dragover)="onDragOver($event)" (drop)="onDrop($event)" (click)="onHideIconContextMenu()" (contextmenu)="onShowFileExplorerContextMenu($event)" id="olElmnt-{{this.processId}}">
<ng-container [ngTemplateOutlet]="currentViewOption === smallIconsView ? iconsView :
currentViewOption === mediumIconsView ? iconsView :
currentViewOption === largeIconsView ? iconsView :
Expand Down Expand Up @@ -397,8 +397,8 @@
</div>


<cos-menu [generalMenu]="menuData" *ngIf="showCntxtMenu" [style]="fileExplrCntxtMenuStyle" [menuType]="fileExplrMngrMenuOption"> </cos-menu>
<cos-menu [desktopMenu]="fileExplrMenu" *ngIf="showFileExplrCntxtMenu" [style]="fileExplrCntxtMenuStyle" [menuType]="fileExplrMenuOption"> </cos-menu>
<cos-menu [generalMenu]="menuData" *ngIf="showIconCntxtMenu" [style]="fileExplrCntxtMenuStyle" [menuType]="fileExplrMngrMenuOption"> </cos-menu>
<cos-menu [nestedMenu]="fileExplrMenu" *ngIf="showFileExplrCntxtMenu" [style]="fileExplrCntxtMenuStyle" [menuType]="fileExplrMenuOption"> </cos-menu>

<div class="fx-information-tip-container" id="fx-information-tip-{{this.processId}}" *ngIf="showInformationTip">
<div class="fx-information-tip-item-container" *ngFor="let tip of fileInfoTipData;" >
Expand Down
21 changes: 14 additions & 7 deletions src/app/system-apps/fileexplorer/fileexplorer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn
showPathHistory = false;
onClearSearchIconHover = false;
onSearchIconHover = false;
showCntxtMenu = false;
showIconCntxtMenu = false;
showFileExplrCntxtMenu = false;
showInformationTip = false;
hasWindow = true;
Expand Down Expand Up @@ -746,6 +746,9 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn
}

onShowIconContextMenu(evt:MouseEvent, file:FileInfo, id:number):void{

console.log('onShowIconContextMenu');

const rect = this.fileExplrCntntCntnr.nativeElement.getBoundingClientRect();
const x = evt.clientX - rect.left;
const y = evt.clientY - rect.top;
Expand All @@ -756,7 +759,7 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn
this.selectedFile = file;
this.isIconInFocusDueToPriorAction = false;
this.showInformationTip = false;
this.showCntxtMenu = !this.showCntxtMenu;
this.showIconCntxtMenu = !this.showIconCntxtMenu;

// show IconContexMenu is still a btn click, just a different type
this.doBtnClickThings(id);
Expand Down Expand Up @@ -878,7 +881,8 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn
}

onHideIconContextMenu():void{
this.showCntxtMenu = false;
this.showIconCntxtMenu = false;
this.showFileExplrCntxtMenu = false;

//First case - I'm clicking only on the desktop icons
if((this.isBtnClickEvt && this.btnClickCnt >= 1) && (!this.isHideCntxtMenuEvt && this.hideCntxtMenuEvtCnt == 0)){
Expand Down Expand Up @@ -913,7 +917,12 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn
}
}

showFileExplorerContextMenu(evt:MouseEvent,):void{
onShowFileExplorerContextMenu(evt:MouseEvent,):void{

console.log('showFileExplorerContextMenu');

if(this.showIconCntxtMenu)
return;

const rect = this.fileExplrCntntCntnr.nativeElement.getBoundingClientRect();
const x = evt.clientX - rect.left;
Expand Down Expand Up @@ -1526,9 +1535,7 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn
const titlesIcon:NestedMenuItem={ icon:'osdrive/icons/circle.png', label:'Titles icons', action: () => this.isTitleIcon = !this.isTitleIcon, variables:this.isTitleIcon,
emptyline:false, styleOption:'A' }



const viewByMenu = [extraLargeIcon, largeIcon, mediumIcon, smallIcon, listIcon,detailsIcon, titlesIcon];
const viewByMenu = [extraLargeIcon, largeIcon, mediumIcon, smallIcon, listIcon, detailsIcon, titlesIcon];

return viewByMenu;
}
Expand Down

0 comments on commit 6e82ee5

Please sign in to comment.