Переглянути джерело

prohibited the naviagtion menu to expand when modals are opened

Warafear 9 місяців тому
батько
коміт
9969cb674a

+ 10 - 1
src/app/journal/journal-home/journal-home.component.ts

@@ -1,5 +1,6 @@
 import { Component, Renderer2, ElementRef } from '@angular/core';
 import { NavigationPanelService } from 'src/services/navigationPanel/navigation-panel.service';
+import { ModalService } from 'src/services/modal/modal.service';
 
 @Component({
   selector: 'app-journal-home',
@@ -13,6 +14,7 @@ export class JournalHomeComponent {
     public navigation: NavigationPanelService,
     private renderer: Renderer2,
     private el: ElementRef,
+    public modalService: ModalService,
   ) {}
 
   ngOnInit() {
@@ -22,7 +24,14 @@ export class JournalHomeComponent {
     });
 
     window.addEventListener('mousemove', (event) => {
-      if (event.clientX < 10 && !this.isNavigationOpen) {
+      if (event.clientX < 10) {
+        console.log(this.isNavigationOpen);
+      }
+      if (
+        event.clientX < 10 &&
+        !this.isNavigationOpen &&
+        !this.modalService.isModalOpen
+      ) {
         this.navigation.openNavigation();
       }
     });

+ 0 - 1
src/app/shared-components/full-spellcard/full-spellcard.component.scss

@@ -118,7 +118,6 @@
     flex-direction: column;
     justify-content: space-evenly;
     .stats-row {
-      //   margin-top: 0.8rem;
       display: flex;
       align-items: center;
       width: 14.5rem;

+ 8 - 2
src/services/modal/modal.service.ts

@@ -14,13 +14,18 @@ export class ModalService {
   private _resultSubject = new Subject<any>();
   result$ = this._resultSubject.asObservable();
 
+  private _isModalOpen = false;
+  public get isModalOpen(): boolean {
+    return this._isModalOpen;
+  }
+
   /**
    * Opens the modal with the specified component and provides the data as input for the component.
    * @param component The component to open in the modal.
    * @param data The data for the input of the component.
    */
   public openModal(component: any, data: any) {
-    console.log('ModalService: openModal');
+    this._isModalOpen = true;
     this._modalSubject.next({ component, data });
   }
 
@@ -30,8 +35,9 @@ export class ModalService {
    * @param data The oprional data object that eg contains a new or modifed weapon object.
    */
   public handleModalClosing(result: any, data?: any) {
-    //The host components subscribe to the result$ Observable to get the result of the modal
+    //The host components subscribes to the result$ Observable to get the result of the modal
     this._resultSubject.next({ state: result, data: data });
     this._closeModalSubject.next('close');
+    this._isModalOpen = false;
   }
 }