diff --git a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/toolbar/toolbar.component.css b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/toolbar/toolbar.component.css index ee0da00c..80178013 100644 --- a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/toolbar/toolbar.component.css +++ b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/toolbar/toolbar.component.css @@ -136,6 +136,13 @@ } } +@media (max-width: 550px) { + #toolbar { + padding: 0px; + place-content: space-evenly; + } +} + ::ng-deep .mat-menu-panel { margin-bottom: 10px; } diff --git a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/toolbar/toolbar.component.html b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/toolbar/toolbar.component.html index 8c09a057..e9179089 100644 --- a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/toolbar/toolbar.component.html +++ b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/toolbar/toolbar.component.html @@ -1,5 +1,5 @@ - -
+ +
diff --git a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/toolbar/toolbar.component.ts b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/toolbar/toolbar.component.ts index 7dcd9d6d..652e309d 100644 --- a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/toolbar/toolbar.component.ts +++ b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/toolbar/toolbar.component.ts @@ -12,7 +12,7 @@ import { TemplateRef, ViewChild } from '@angular/core'; -import { skip, Subscription } from 'rxjs'; +import { first, skip, Subscription } from 'rxjs'; import { TokenService } from '../../services/token/token.service'; import { ChatService } from '../../services/chat/chat.service'; import { PanelService } from '../../services/panel/panel.service'; @@ -38,6 +38,7 @@ import { MatMenuTrigger } from '@angular/material/menu'; import { RecordingService } from '../../services/recording/recording.service'; import { RecordingInfo, RecordingStatus } from '../../models/recording.model'; import { TranslateService } from '../../services/translate/translate.service'; +import { MediaChange } from '@angular/flex-layout'; /** * @@ -321,6 +322,11 @@ export class ToolbarComponent implements OnInit, OnDestroy, AfterViewInit { */ isSessionCreator: boolean = false; + /** + * @ignore + */ + screenSize: string; + private log: ILogger; private minimalSub: Subscription; private panelTogglingSubscription: Subscription; @@ -337,6 +343,7 @@ export class ToolbarComponent implements OnInit, OnDestroy, AfterViewInit { private chatPanelButtonSub: Subscription; private displayLogoSub: Subscription; private displaySessionNameSub: Subscription; + private screenSizeSub: Subscription; private currentWindowHeight = window.innerHeight; /** @@ -398,6 +405,7 @@ export class ToolbarComponent implements OnInit, OnDestroy, AfterViewInit { this.subscribeToMenuToggling(); this.subscribeToChatMessages(); this.subscribeToRecordingStatus(); + this.subscribeToScreenSize(); } ngAfterViewInit() { @@ -423,6 +431,7 @@ export class ToolbarComponent implements OnInit, OnDestroy, AfterViewInit { if (this.minimalSub) this.minimalSub.unsubscribe(); if (this.activitiesPanelButtonSub) this.activitiesPanelButtonSub.unsubscribe(); if (this.recordingSubscription) this.recordingSubscription.unsubscribe(); + if (this.screenSizeSub) this.screenSizeSub.unsubscribe(); } /** @@ -650,6 +659,13 @@ export class ToolbarComponent implements OnInit, OnDestroy, AfterViewInit { }); } + private subscribeToScreenSize() { + this.screenSizeSub = this.documentService.screenSizeObs.subscribe((change: MediaChange[]) => { + console.log(change[0].mqAlias) + this.screenSize = change[0].mqAlias; + }); + } + private checkDisplayMoreOptions() { this.showMoreOptionsButton = this.showFullscreenButton || this.showBackgroundEffectsButton || this.showRecordingButton; } diff --git a/openvidu-components-angular/projects/openvidu-angular/src/lib/services/document/document.service.ts b/openvidu-components-angular/projects/openvidu-angular/src/lib/services/document/document.service.ts index 12cc7d01..d3ff600a 100644 --- a/openvidu-components-angular/projects/openvidu-angular/src/lib/services/document/document.service.ts +++ b/openvidu-components-angular/projects/openvidu-angular/src/lib/services/document/document.service.ts @@ -1,4 +1,6 @@ import { Injectable } from '@angular/core'; +import { MediaChange, MediaObserver } from '@angular/flex-layout'; +import { BehaviorSubject, Observable } from 'rxjs'; import { LayoutClass } from '../../models/layout.model'; /** @@ -8,7 +10,12 @@ import { LayoutClass } from '../../models/layout.model'; providedIn: 'root' }) export class DocumentService { - constructor() {} + screenSizeObs: Observable; + private screenSize = >new BehaviorSubject(MediaChange); + + constructor(private media: MediaObserver) { + this.screenSizeObs= this.media.asObservable(); + } getHTMLElementByClassName(element: HTMLElement, className: string): HTMLElement { while (!!element && element !== document.body) {