Front: add context menu UI
This commit is contained in:
1 parent
31d38d8da9
commit
bd65181da3
9 files changed
+173
-1
No files matched your search
@@ -0,0 +1,28 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ContextMenuService {
|
||||
private contextMenuVisibility = new Subject<boolean>();
|
||||
private contextMenuPosition = new Subject<{ x: number; y: number }>();
|
||||
private menuOptions = new Subject<any[]>();
|
||||
|
||||
contextMenuVisibility$ = this.contextMenuVisibility.asObservable();
|
||||
contextMenuPosition$ = this.contextMenuPosition.asObservable();
|
||||
menuOptions$ = this.menuOptions.asObservable();
|
||||
|
||||
showContextMenu(position: { x: number; y: number }) {
|
||||
this.contextMenuPosition.next(position);
|
||||
this.contextMenuVisibility.next(true);
|
||||
}
|
||||
|
||||
hideContextMenu() {
|
||||
this.contextMenuVisibility.next(false);
|
||||
}
|
||||
|
||||
setMenuOptions(options: any[]) {
|
||||
this.menuOptions.next(options);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user