Skip to content
Snippets Groups Projects
Commit 035b8fc2 authored by jojohoch's avatar jojohoch
Browse files

[player] Remove unused code from `UnitStateElementMapperService`

parent 8780cdcb
No related branches found
No related tags found
No related merge requests found
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { UnitStateElementCode } from '../models/verona';
import { TextMarker } from '../classes/text-marker'; import { TextMarker } from '../classes/text-marker';
import { Unit } from '../../../../common/interfaces/unit'; import { Unit } from '../../../../common/interfaces/unit';
import { import {
AudioElement, DragNDropValueObject, DropListElement, AudioElement, DragNDropValueObject, InputElement, InputElementValue,
ImageElement, InputElement, TextElement, UIElement, UIElementType, VideoElement
InputElementValue, TextElement,
UIElement, UIElementType,
VideoElement
} from '../../../../common/interfaces/elements'; } from '../../../../common/interfaces/elements';
import { UnitUtils } from '../../../../common/util/unit-utils'; import { UnitUtils } from '../../../../common/util/unit-utils';
...@@ -21,62 +17,11 @@ export class UnitStateElementMapperService { ...@@ -21,62 +17,11 @@ export class UnitStateElementMapperService {
this.dropListValueIds = UnitUtils.findUIElements(unitDefinition.pages, 'drop-list') this.dropListValueIds = UnitUtils.findUIElements(unitDefinition.pages, 'drop-list')
.reduce( .reduce(
(accumulator: DragNDropValueObject[], currentValue: UIElement) => ( (accumulator: DragNDropValueObject[], currentValue: UIElement) => (
(currentValue.value && (currentValue.value as DragNDropValueObject[]).length) ? accumulator.concat(currentValue.value as DragNDropValueObject) : accumulator), [] (currentValue.value && (currentValue.value as DragNDropValueObject[]).length) ?
accumulator.concat(currentValue.value as DragNDropValueObject) : accumulator), []
); );
} }
// mapToElementValue(
// elementModel: UIElement,
// unitStateElement: UnitStateElementCode | undefined
// ): UIElement {
// if (unitStateElement && unitStateElement.value !== undefined) {
// switch (elementModel.type) {
// case 'text':
// elementModel.text = TextMarker
// .restoreMarkings(unitStateElement.value as string[], (elementModel as TextElement).text);
// break;
// case 'image':
// elementModel.magnifierUsed = unitStateElement.value;
// break;
// case 'video':
// case 'audio':
// if (elementModel && elementModel.playerProps) {
// elementModel.playerProps.playbackTime = unitStateElement.value as number;
// }
// break;
// case 'drop-list':
// (elementModel as DropListElement).value = (unitStateElement.value as string[])
// .map(id => this.getDropListValueById(id)) as DragNDropValueObject[];
// break;
// default:
// elementModel.value = unitStateElement.value;
// }
// }
// return elementModel;
// }
//
// mapToUnitStateValue = (elementModel: UIElement, unitStateElement: UnitStateElementCode | undefined):
// { id: string, value: InputElementValue } => {
// switch (elementModel.type) {
// case 'text':
// return { id: elementModel.id, value: unitStateElement?.value || [] };
// case 'image':
// return { id: elementModel.id, value: (elementModel as ImageElement).magnifierUsed };
// case 'video':
// return { id: elementModel.id, value: (elementModel as VideoElement).playerProps.playbackTime };
// case 'audio':
// return { id: elementModel.id, value: (elementModel as AudioElement).playerProps.playbackTime };
// case 'drop-list':
// return {
// id: elementModel.id,
// value: ((elementModel as DropListElement).value as DragNDropValueObject[])
// .map(element => element.id)
// };
// default:
// return { id: elementModel.id, value: (elementModel as InputElement).value };
// }
// };
fromUnitState = (unitStateValue: InputElementValue | undefined, elementModel: UIElement): InputElementValue => { fromUnitState = (unitStateValue: InputElementValue | undefined, elementModel: UIElement): InputElementValue => {
switch (elementModel.type) { switch (elementModel.type) {
case 'drop-list': case 'drop-list':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment