fixes
This commit is contained in:
parent
78d107e37c
commit
efbce9b645
@ -1,17 +1,17 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
import { MatSnackBar } from '@angular/material';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
import { BaseViewComponent } from 'app/site/base/base-view';
|
||||
import { ViewProjector } from '../../models/view-projector';
|
||||
import { ProjectorElements, ProjectorElement } from 'app/shared/models/core/projector';
|
||||
import { Mediafile } from 'app/shared/models/mediafiles/mediafile';
|
||||
import { MediafileRepositoryService } from 'app/core/repositories/mediafiles/mediafile-repository.service';
|
||||
import { ViewMediafile } from 'app/site/mediafiles/models/view-mediafile';
|
||||
import { SlideManager } from 'app/slides/services/slide-manager.service';
|
||||
import { ProjectorElements, ProjectorElement } from 'app/shared/models/core/projector';
|
||||
import { ProjectorService } from 'app/core/core-services/projector.service';
|
||||
import { SlideManager } from 'app/slides/services/slide-manager.service';
|
||||
import { ViewMediafile } from 'app/site/mediafiles/models/view-mediafile';
|
||||
import { ViewProjector } from '../../models/view-projector';
|
||||
|
||||
/**
|
||||
* The presentation controls.
|
||||
@ -40,6 +40,16 @@ export class PresentationControlComponent extends BaseViewComponent {
|
||||
// All mediafile elements.
|
||||
public elements: ProjectorElements = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param titleService
|
||||
* @param translate
|
||||
* @param matSnackBar
|
||||
* @param mediafileRepo
|
||||
* @param slideManager
|
||||
* @param projectorService
|
||||
*/
|
||||
public constructor(
|
||||
titleService: Title,
|
||||
translate: TranslateService,
|
||||
@ -51,6 +61,9 @@ export class PresentationControlComponent extends BaseViewComponent {
|
||||
super(titleService, translate, matSnackBar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates incoming elements
|
||||
*/
|
||||
private updateElements(): void {
|
||||
this.elements = this.projector.elements.filter(element => {
|
||||
if (element.name !== Mediafile.COLLECTIONSTRING && !element.id) {
|
||||
@ -65,26 +78,48 @@ export class PresentationControlComponent extends BaseViewComponent {
|
||||
return this.mediafileRepo.getViewModel(element.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns the currently used page number (1 in case of unnumbered elements)
|
||||
*/
|
||||
public getPage(element: ProjectorElement): number {
|
||||
return element.page || 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* moves the projected forward by one page (if not already at end)
|
||||
*
|
||||
* @param element
|
||||
*/
|
||||
public pdfForward(element: ProjectorElement): void {
|
||||
if (this.getPage(element) < this.getMediafile(element).pages) {
|
||||
this.pdfSetPage(element, this.getPage(element) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* moves the projected one page backwards (if not already at beginnning)
|
||||
*
|
||||
* @param element
|
||||
*/
|
||||
public pdfBackward(element: ProjectorElement): void {
|
||||
if (this.getPage(element) > 1) {
|
||||
this.pdfSetPage(element, this.getPage(element) - 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the element to a specific given page. If the number given is greater
|
||||
* than the amount of element pages, it does nothing
|
||||
*
|
||||
* @param element
|
||||
* @param page
|
||||
*/
|
||||
public pdfSetPage(element: ProjectorElement, page: number): void {
|
||||
const idElement = this.slideManager.getIdentifialbeProjectorElement(element);
|
||||
idElement.page = page;
|
||||
this.projectorService.updateElement(this.projector.projector, idElement).then(null, this.raiseError);
|
||||
if (this.getMediafile(element).pages >= page) {
|
||||
idElement.page = page;
|
||||
this.projectorService.updateElement(this.projector.projector, idElement).then(null, this.raiseError);
|
||||
}
|
||||
}
|
||||
|
||||
public pdfZoom(element: ProjectorElement, direction: 'in' | 'out' | 'reset'): void {}
|
||||
|
@ -262,6 +262,15 @@
|
||||
</mat-list-item>
|
||||
</mat-list>
|
||||
</mat-expansion-panel>
|
||||
|
||||
<!-- File display controls -->
|
||||
<mat-expansion-panel>
|
||||
<mat-expansion-panel-header>
|
||||
<span translate>Media controls</span>
|
||||
</mat-expansion-panel-header>
|
||||
<os-presentation-control [projector]="projector">
|
||||
</os-presentation-control>
|
||||
</mat-expansion-panel>
|
||||
</mat-accordion>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,16 +1,16 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
|
||||
import { ProjectorRoutingModule } from './projector-routing.module';
|
||||
import { SharedModule } from '../../shared/shared.module';
|
||||
import { ProjectorListComponent } from './components/projector-list/projector-list.component';
|
||||
import { ProjectorDetailComponent } from './components/projector-detail/projector-detail.component';
|
||||
import { CountdownControlsComponent } from './components/countdown-controls/countdown-controls.component';
|
||||
import { CountdownDialogComponent } from './components/countdown-dialog/countdown-dialog.component';
|
||||
import { MessageControlsComponent } from './components/message-controls/message-controls.component';
|
||||
import { MessageDialogComponent } from './components/message-dialog/message-dialog.component';
|
||||
import { PresentationControlComponent } from './components/presentation-control/presentation-control.component';
|
||||
import { ProjectorDetailComponent } from './components/projector-detail/projector-detail.component';
|
||||
import { ProjectorListComponent } from './components/projector-list/projector-list.component';
|
||||
import { ProjectorListEntryComponent } from './components/projector-list-entry/projector-list-entry.component';
|
||||
import { ProjectorRoutingModule } from './projector-routing.module';
|
||||
import { SharedModule } from '../../shared/shared.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, ProjectorRoutingModule, SharedModule],
|
||||
@ -21,12 +21,14 @@ import { ProjectorListEntryComponent } from './components/projector-list-entry/p
|
||||
CountdownControlsComponent,
|
||||
CountdownDialogComponent,
|
||||
MessageControlsComponent,
|
||||
MessageDialogComponent
|
||||
MessageDialogComponent,
|
||||
PresentationControlComponent
|
||||
],
|
||||
entryComponents: [
|
||||
CountdownDialogComponent,
|
||||
MessageDialogComponent,
|
||||
PresentationControlComponent
|
||||
PresentationControlComponent,
|
||||
ProjectorListEntryComponent
|
||||
]
|
||||
})
|
||||
export class ProjectorModule {}
|
||||
|
@ -4,8 +4,8 @@ import { CommonModule } from '@angular/common';
|
||||
import { PdfViewerModule } from 'ng2-pdf-viewer';
|
||||
|
||||
import { MediafileSlideComponent } from './mediafile-slide.component';
|
||||
import { SLIDE } from 'app/slides/slide-token';
|
||||
import { SharedModule } from 'app/shared/shared.module';
|
||||
import { SLIDE } from 'app/slides/slide-token';
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, SharedModule, PdfViewerModule],
|
||||
|
Loading…
Reference in New Issue
Block a user