diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.html index cf3a5a45..fe8d3d01 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.html @@ -1,4 +1,4 @@ -
+
; - onLangChangeSubscription: Subscription; badgeChatUnReadCount: number; @@ -102,6 +97,7 @@ export class LeftSideComponent implements OnInit, OnDestroy { constructor( private store: Store, + public elementRef: ElementRef, private dialogService: DialogService, private sessionStorageService: SessionStorageService, private translateService: TranslateService, @@ -183,51 +179,6 @@ export class LeftSideComponent implements OnInit, OnDestroy { } } - @HostListener('mouseenter', ['$event']) - mouseOver(event: MouseEvent) { - const rect = this.leftSideContainer.nativeElement.getBoundingClientRect(); - - const minX = rect.left + rect.width - 5; - const maxX = rect.left + rect.width; - const minY = rect.top; - const maxY = rect.top + rect.height; - - if ( - event.pageX >= minX && - event.pageX <= maxX && - event.pageY >= minY && - event.pageY <= maxY - ) { - this.logger.debug('mouseOver edge of container'); - this.store.dispatch( - ChatStore.toggleLeftSideDrawerIndicator({ show: true }) - ); - } - } - - @HostListener('mouseleave', ['$event']) - mouseLeave(event: MouseEvent) { - // const rect = this.leftSideContainer.nativeElement.getBoundingClientRect(); - // const minX = rect.left; - // const maxX = rect.left + rect.width + 5; - // const minY = rect.top; - // const maxY = rect.top + rect.height; - // if ( - // event.pageX >= minX && - // event.pageX <= maxX && - // event.pageY >= minY && - // event.pageY <= maxY - // ) { - // } else { - // this.store.dispatch( - // ChatStore.toggleLeftSideDrawerIndicator({ show: false }) - // ); - // } - this.store.dispatch( - ChatStore.toggleLeftSideDrawerIndicator({ show: false }) - ); - } - async onClickNewChat(type: string = 'NORMAL') { const result = await this.dialogService.open< CreateChatDialogComponent, diff --git a/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.html b/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.html index 843bc514..31f2f69d 100644 --- a/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.html +++ b/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.html @@ -6,9 +6,12 @@
diff --git a/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.ts b/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.ts index 9cb0c148..62bd02b2 100644 --- a/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.ts +++ b/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.ts @@ -5,7 +5,8 @@ import { Inject, OnDestroy, ViewChild, - NgZone + NgZone, + ElementRef } from '@angular/core'; import { Store, select } from '@ngrx/store'; @@ -48,6 +49,7 @@ import { MessageType } from '@ucap-webmessenger/api-message'; import { AppUserInfo, KEY_APP_USER_INFO } from '@app/types/app-user-info.type'; import { environment } from '../../../../environments/environment'; import { TranslateService } from '@ngx-translate/core'; +import { LeftSideComponent } from '@app/layouts/messenger/components/left-side.component'; @Component({ selector: 'app-page-messenger-main', @@ -55,8 +57,12 @@ import { TranslateService } from '@ngx-translate/core'; styleUrls: ['./main.page.component.scss'] }) export class MainPageComponent implements OnInit, OnDestroy { - @ViewChild('rightDrawer', { static: true }) rightDrawer: MatDrawer; - @ViewChild('leftSideDrawer', { static: true }) leftSideDrawer: MatDrawer; + @ViewChild('rightDrawer', { static: true }) + rightDrawer: MatDrawer; + @ViewChild('leftSideDrawer', { static: true }) + leftSideDrawer: MatDrawer; + @ViewChild('leftSideContainer', { static: false }) + leftSideContainer: LeftSideComponent; selectedChat$: Observable; selectedRightDrawer$: Observable; @@ -455,4 +461,31 @@ export class MainPageComponent implements OnInit, OnDestroy { this.onLeftDrawerIndicator = false; } } + + onMouseEnterLeftSideContainer(event: MouseEvent) { + const rect = this.leftSideContainer.elementRef.nativeElement.getBoundingClientRect(); + + const minX = rect.left + rect.width - 10; + const maxX = rect.left + rect.width; + const minY = rect.top; + const maxY = rect.top + rect.height; + + if ( + event.pageX >= minX && + event.pageX <= maxX && + event.pageY >= minY && + event.pageY <= maxY + ) { + this.logger.debug('mouseOver edge of container'); + this.store.dispatch( + ChatStore.toggleLeftSideDrawerIndicator({ show: true }) + ); + } + } + + onMouseLeaveLeftSideContainer(event: MouseEvent) { + this.store.dispatch( + ChatStore.toggleLeftSideDrawerIndicator({ show: false }) + ); + } }