refactoring

This commit is contained in:
병준 박 2019-10-16 10:10:20 +09:00
parent 43f937e74c
commit f87a456b48

View File

@ -51,12 +51,7 @@ export class GroupComponent implements OnInit, OnDestroy {
@ViewChildren(MatMenuTrigger) menuTriggerList: QueryList<MatMenuTrigger>;
@ViewChild('profileContextMenu', { static: true })
profileContextMenu: MatMenu;
profileContextMenuPosition = { x: '0px', y: '0px' };
@ViewChild('groupContextMenu', { static: true })
groupContextMenu: MatMenu;
groupContextMenuPosition = { x: '0px', y: '0px' };
groupBuddyList$: Observable<
@ -231,13 +226,12 @@ export class GroupComponent implements OnInit, OnDestroy {
event.preventDefault();
event.stopPropagation();
this.profileContextMenu.focusFirstItem('mouse');
this.profileContextMenuPosition.x = event.clientX + 'px';
this.profileContextMenuPosition.y = event.clientY + 'px';
const profileContextMenuTrigger = this.menuTriggerList.toArray()[1];
profileContextMenuTrigger.menuData = { userInfo };
profileContextMenuTrigger.openMenu();
const contextMenuTrigger = this.menuTriggerList.toArray()[1];
contextMenuTrigger.menu.focusFirstItem('mouse');
contextMenuTrigger.menuData = { userInfo };
contextMenuTrigger.openMenu();
}
onClickGroupContextMenu(menuType: string, group: GroupDetailData) {
@ -254,12 +248,11 @@ export class GroupComponent implements OnInit, OnDestroy {
params.event.preventDefault();
params.event.stopPropagation();
this.groupContextMenu.focusFirstItem('mouse');
this.groupContextMenuPosition.x = params.event.clientX + 'px';
this.groupContextMenuPosition.y = params.event.clientY + 'px';
const groupContextMenuTrigger = this.menuTriggerList.toArray()[2];
groupContextMenuTrigger.menuData = { group: params.group };
groupContextMenuTrigger.openMenu();
const contextMenuTrigger = this.menuTriggerList.toArray()[2];
contextMenuTrigger.menu.focusFirstItem('mouse');
contextMenuTrigger.menuData = { group: params.group };
contextMenuTrigger.openMenu();
}
}