Newer
Older
import { ComponentFactory, ComponentFactoryResolver } from '@angular/core';
import { TextComponent } from '../components/ui-elements/text.component';
import { ButtonComponent } from '../components/ui-elements/button.component';
import { TextFieldComponent } from '../components/ui-elements/text-field.component';
import { TextAreaComponent } from '../components/ui-elements/text-area.component';
import { CheckboxComponent } from '../components/ui-elements/checkbox.component';
import { DropdownComponent } from '../components/ui-elements/dropdown.component';
import { RadioButtonGroupComponent } from '../components/ui-elements/radio-button-group.component';
import { ImageComponent } from '../components/ui-elements/image.component';
import { AudioComponent } from '../components/ui-elements/audio.component';
import { VideoComponent } from '../components/ui-elements/video.component';
import { LikertComponent } from '../components/ui-elements/likert.component';
import { RadioGroupImagesComponent } from '../components/ui-elements/radio-group-images.component';
import { DropListComponent } from '../components/ui-elements/drop-list.component';
import { ClozeComponent } from '../components/ui-elements/cloze.component';
import { SliderComponent } from '../components/ui-elements/slider.component';
import { SpellCorrectComponent } from '../components/ui-elements/spell-correct.component';
import { FrameComponent } from '../components/ui-elements/frame.component';
import { ElementComponent } from '../directives/element-component.directive';
ButtonElement,
CheckboxElement,
ClozeElement,
DropdownElement,
DropListElement,
InputElement, InputElementValue, LikertElement, LikertRowElement, PlayerProperties, PositionProperties,
RadioButtonGroupElement, SliderElement, SpellCorrectElement,
UIElement, UIElementType, UIElementValue,
VideoElement
} from '../interfaces/elements';
import { ClozeDocument, ClozeDocumentParagraph, ClozeDocumentParagraphPart } from '../interfaces/cloze';
export abstract class ElementFactory {
static createElement(element: Partial<UIElement>): UIElement {
// console.log('createElement', element);
switch (element.type) {
return ElementFactory.createTextElement(element as Partial<TextElement>);
return ElementFactory.createButtonElement(element as Partial<ButtonElement>);
return ElementFactory.createTextFieldElement(element as Partial<TextFieldElement>);
return ElementFactory.createTextAreaElement(element as Partial<TextAreaElement>);
return ElementFactory.createCheckboxElement(element as Partial<CheckboxElement>);
return ElementFactory.createDropdownElement(element as Partial<DropdownElement>);
return ElementFactory.createRadioButtonGroupElement(element as Partial<RadioButtonGroupElement>);
return ElementFactory.createImageElement(element as Partial<ImageElement>);
return ElementFactory.createAudioElement(element as Partial<AudioElement>);
return ElementFactory.createVideoElement(element as Partial<VideoElement>);
return ElementFactory.createLikertElement(element as Partial<LikertElement>);
return ElementFactory.createRadioButtonGroupComplexElement(element as Partial<RadioButtonGroupComplexElement>);
return ElementFactory.createDropListElement(element as Partial<DropListElement>);
case 'drop-list-simple':
return ElementFactory.createDropListSimpleElement(element as Partial<DropListSimpleElement>);
return ElementFactory.createClozeElement(element as Partial<ClozeElement>);
return ElementFactory.createSliderElement(element as Partial<SliderElement>);
return ElementFactory.createSpellCorrectElement(element as Partial<SpellCorrectElement>);
return ElementFactory.createFrameElement(element as Partial<FrameElement>);
return ElementFactory.createToggleButtonElement(element as Partial<ToggleButtonElement>);
throw new Error(`ElementType ${element.type} not found!`);
static initElement(element: Partial<UIElement>): UIElement {
type: element.type as UIElementType,
id: element.id ? String(element.id) : 'id_placeholder',
static initInputElement(element: Partial<UIElement>): InputElement {
label: element.value !== undefined ? element.label as string : 'Beschriftung',
value: element.value !== undefined ? element.value as InputElementValue : null,
required: element.required !== undefined ? element.required as boolean : false,
requiredWarnMessage: element.requiredWarnMessage !== undefined ?
element.requiredWarnMessage as string :
'Eingabe erforderlich',
readOnly: element.readOnly !== undefined ? element.readOnly as boolean : false
static initPositionProps(defaults: Record<string, UIElementValue> = {}): PositionProperties {
fixedSize: defaults.fixedSize !== undefined ? defaults.fixedSize as boolean : false,
dynamicPositioning: defaults.dynamicPositioning !== undefined ? defaults.dynamicPositioning as boolean : true,
xPosition: defaults.xPosition !== undefined ? defaults.xPosition as number : 0,
yPosition: defaults.yPosition !== undefined ? defaults.yPosition as number : 0,
useMinHeight: defaults.useMinHeight !== undefined ? defaults.useMinHeight as boolean : false,
gridColumn: defaults.gridColumn !== undefined ? defaults.gridColumn as number : null,
gridColumnRange: defaults.gridColumnRange !== undefined ? defaults.gridColumnRange as number : 1,
gridRow: defaults.gridRow !== undefined ? defaults.gridRow as number : null,
gridRowRange: defaults.gridRowRange !== undefined ? defaults.gridRowRange as number : 1,
marginLeft: defaults.marginLeft !== undefined ? defaults.marginLeft as number : 0,
marginRight: defaults.marginRight !== undefined ? defaults.marginRight as number : 0,
marginTop: defaults.marginTop !== undefined ? defaults.marginTop as number : 0,
marginBottom: defaults.marginBottom !== undefined ? defaults.marginBottom as number : 0,
zIndex: defaults.zIndex !== undefined ? defaults.zIndex as number : 0
static initBasicStyles(defaults: Record<string, UIElementValue> = {}): BasicStyles {
fontColor: defaults.fontColor !== undefined ? defaults.fontColor as string : '#000000',
font: defaults.font !== undefined ? defaults.font as string : 'Roboto',
fontSize: defaults.fontSize !== undefined ? defaults.fontSize as number : 20,
bold: defaults.bold !== undefined ? defaults.bold as boolean : false,
italic: defaults.italic !== undefined ? defaults.italic as boolean : false,
underline: defaults.underline !== undefined ? defaults.underline as boolean : false,
backgroundColor: defaults.backgroundColor !== undefined ? defaults.backgroundColor as string : '#d3d3d3'
static initPlayerProps(defaults: Record<string, UIElementValue> = {}): PlayerProperties {
autostart: defaults.autostart !== undefined ? defaults.autostart as boolean : false,
autostartDelay: defaults.autostartDelay !== undefined ? defaults.autostartDelay as number : 0,
loop: defaults.loop !== undefined ? defaults.loop as boolean : false,
startControl: defaults.startControl !== undefined ? defaults.startControl as boolean : true,
pauseControl: defaults.pauseControl !== undefined ? defaults.pauseControl as boolean : false,
progressBar: defaults.progressBar !== undefined ? defaults.progressBar as boolean : true,
interactiveProgressbar: defaults.interactiveProgressbar !== undefined ?
defaults.interactiveProgressbar as boolean :
false, // TODO default?
volumeControl: defaults.volumeControl !== undefined ? defaults.volumeControl as boolean : true,
defaultVolume: defaults.defaultVolume !== undefined ? defaults.defaultVolume as number : 0.8,
minVolume: defaults.minVolume !== undefined ? defaults.minVolume as number : 0,
muteControl: defaults.muteControl !== undefined ? defaults.muteControl as boolean : true,
interactiveMuteControl: defaults.interactiveMuteControl !== undefined ?
defaults.interactiveMuteControl as boolean :
false, // TODO default?
hintLabel: defaults.hintLabel !== undefined ? defaults.hintLabel as string : '',
hintLabelDelay: defaults.hintLabelDelay !== undefined ? defaults.hintLabelDelay as number : 0,
activeAfterID: defaults.activeAfterID !== undefined ? defaults.activeAfterID as string : '',
minRuns: defaults.minRuns !== undefined ? defaults.minRuns as number : 1,
maxRuns: defaults.maxRuns !== undefined ? defaults.maxRuns as number | null : null,
showRestRuns: defaults.showRestRuns !== undefined ? defaults.showRestRuns as boolean : false,
showRestTime: defaults.showRestTime !== undefined ? defaults.showRestTime as boolean : true,
playbackTime: defaults.playbackTime !== undefined ? defaults.playbackTime as number : 0
elementType: string, componentFactoryResolver: ComponentFactoryResolver
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
switch (elementType) {
case 'text':
return componentFactoryResolver.resolveComponentFactory(TextComponent);
case 'button':
return componentFactoryResolver.resolveComponentFactory(ButtonComponent);
case 'text-field':
return componentFactoryResolver.resolveComponentFactory(TextFieldComponent);
case 'text-area':
return componentFactoryResolver.resolveComponentFactory(TextAreaComponent);
case 'checkbox':
return componentFactoryResolver.resolveComponentFactory(CheckboxComponent);
case 'dropdown':
return componentFactoryResolver.resolveComponentFactory(DropdownComponent);
case 'radio':
return componentFactoryResolver.resolveComponentFactory(RadioButtonGroupComponent);
case 'image':
return componentFactoryResolver.resolveComponentFactory(ImageComponent);
case 'audio':
return componentFactoryResolver.resolveComponentFactory(AudioComponent);
case 'video':
return componentFactoryResolver.resolveComponentFactory(VideoComponent);
case 'likert':
return componentFactoryResolver.resolveComponentFactory(LikertComponent);
case 'radio-group-images':
return componentFactoryResolver.resolveComponentFactory(RadioGroupImagesComponent);
case 'drop-list':
return componentFactoryResolver.resolveComponentFactory(DropListComponent);
case 'cloze':
return componentFactoryResolver.resolveComponentFactory(ClozeComponent);
case 'slider':
return componentFactoryResolver.resolveComponentFactory(SliderComponent);
case 'spell-correct':
return componentFactoryResolver.resolveComponentFactory(SpellCorrectComponent);
case 'frame':
return componentFactoryResolver.resolveComponentFactory(FrameComponent);
default:
throw new Error('unknown element');
}
private static createButtonElement(element: Partial<ButtonElement>): ButtonElement {
label: element.label !== undefined ? element.label : 'Knopf',
imageSrc: element.imageSrc || null,
asLink: element.asLink !== undefined ? element.asLink : false,
actionParam: element.actionParam !== undefined ? element.actionParam : null,
position: ElementFactory.initPositionProps(element.position as Record<string, UIElementValue>),
styling: {
...ElementFactory.initBasicStyles(element.styling),
borderRadius: element.borderRadius !== undefined ? element.borderRadius as number : 0
private static createCheckboxElement(element: Partial<CheckboxElement>): CheckboxElement {
...ElementFactory.initInputElement({ width: 215, ...element }),
value: element.value !== undefined ? element.value : false,
position: ElementFactory.initPositionProps(element.position),
styling: ElementFactory.initBasicStyles(element.styling)
private static createClozeElement(element: Partial<ClozeElement>): ClozeElement {
...ElementFactory.initElement({ height: 200, ...element }),
document: element.document !== undefined ?
{
...element.document,
content: element.document.content
.map((paragraph: ClozeDocumentParagraph) => ({
...paragraph,
content: paragraph.content
.map((paraPart: ClozeDocumentParagraphPart) => (
['TextField', 'DropList', 'ToggleButton'].includes(paraPart.type) ?
{
...paraPart,
attrs: {
...paraPart.attrs,
model: ElementFactory.createElement(paraPart.attrs!.model as InputElement)
}
} :
{
...paraPart
}
))
}))
} as ClozeDocument :
{ type: 'doc', content: [] },
columnCount: element.columnCount !== undefined ? element.columnCount : 1,
position: ElementFactory.initPositionProps(element.position),
styling: {
...ElementFactory.initBasicStyles(element.styling),
lineHeight: element.styling?.lineHeight !== undefined ? element.styling?.lineHeight as number : 150
private static createDropdownElement(element: Partial<DropdownElement>): DropdownElement {
...ElementFactory.initInputElement({ width: 240, height: 83, ...element }),
options: element.options !== undefined ? element.options : [],
allowUnset: element.allowUnset !== undefined ? element.allowUnset : false,
position: ElementFactory.initPositionProps(element.position),
styling: ElementFactory.initBasicStyles(element.styling)
private static createDropListElement(element: Partial<DropListElement>): DropListElement {
...ElementFactory.initInputElement({ height: 100, ...element }),
value: element.value !== undefined ? element.value : [],
onlyOneItem: element.onlyOneItem !== undefined ? element.onlyOneItem : false,
connectedTo: element.connectedTo !== undefined ? element.connectedTo : [],
orientation: element.orientation !== undefined ? element.orientation : 'vertical',
highlightReceivingDropList: element.highlightReceivingDropList !== undefined ?
element.highlightReceivingDropList :
false,
highlightReceivingDropListColor: element.highlightReceivingDropListColor !== undefined ?
element.highlightReceivingDropListColor : '#006064',
position: ElementFactory.initPositionProps({ useMinHeight: true, ...element.position }),
styling: {
...ElementFactory.initBasicStyles({ backgroundColor: '#f4f4f2', ...element.styling }),
itemBackgroundColor: element.styling?.itemBackgroundColor !== undefined ?
element.styling.itemBackgroundColor as string : '#c9e0e0'
private static createDropListSimpleElement(element: Partial<DropListSimpleElement>): DropListSimpleElement {
...ElementFactory.initInputElement({ height: 100, ...element }),
value: element.value !== undefined ? element.value : [],
connectedTo: element.connectedTo !== undefined ? element.connectedTo : [],
highlightReceivingDropList: element.highlightReceivingDropList !== undefined ?
element.highlightReceivingDropList : false,
highlightReceivingDropListColor: element.highlightReceivingDropListColor !== undefined ?
element.highlightReceivingDropListColor : '#add8e6',
styling: {
...ElementFactory.initBasicStyles({ backgroundColor: '#f4f4f2', ...element.styling }),
itemBackgroundColor: element.itemBackgroundColor !== undefined ?
element.itemBackgroundColor as string : '#c9e0e0'
private static createFrameElement(element: Partial<FrameElement>): FrameElement {
position: ElementFactory.initPositionProps({ zIndex: -1, ...element.position }),
styling: {
...ElementFactory.initBasicStyles({ backgroundColor: 'transparent', ...element.styling }) as BasicStyles,
borderWidth: element.borderWidth !== undefined ? element.borderWidth as number : 1,
borderColor: element.borderColor !== undefined ? element.borderColor as string : 'black',
borderStyle: element.borderStyle !== undefined ?
element.borderStyle as 'solid' | 'dotted' | 'dashed' | 'double' | 'groove' |
'ridge' | 'inset' | 'outset' :
'solid',
borderRadius: element.borderRadius !== undefined ? element.borderRadius as number : 0
private static createImageElement(element: Partial<ImageElement>): ImageElement {
...ElementFactory.initElement({ height: 100, ...element }),
src: element.src || '', // TODO eigentlich undefined
scale: element.scale !== undefined ? element.scale : false,
magnifier: element.magnifier !== undefined ? element.magnifier : false,
magnifierSize: element.magnifierSize !== undefined ? element.magnifierSize : 100,
magnifierZoom: element.magnifierZoom !== undefined ? element.magnifierZoom : 1.5,
magnifierUsed: element.magnifierUsed !== undefined ? element.magnifierUsed : false,
position: ElementFactory.initPositionProps({ ...element.position })
private static createLikertElement(element: Partial<LikertElement>): LikertElement {
...ElementFactory.initElement({ width: 250, height: 200, ...element }),
rows: element.rows !== undefined ?
element.rows.map(row => ElementFactory.createLikertRowElement(row)) :
[],
columns: element.columns !== undefined ? element.columns : [],
firstColumnSizeRatio: element.firstColumnSizeRatio !== undefined ? element.firstColumnSizeRatio : 5,
readOnly: element.readOnly !== undefined ? element.readOnly : false,
position: ElementFactory.initPositionProps({ marginBottom: 30, ...element.position }),
...ElementFactory.initBasicStyles({ backgroundColor: 'transparent', ...element.styling }),
lineHeight: element.styling?.lineHeight !== undefined ? element.styling?.lineHeight as number : 135,
lineColoring: element.lineColoring !== undefined ? element.lineColoring as boolean : true,
lineColoringColor: element.lineColoringColor !== undefined ? element.lineColoringColor as string : '#c9e0e0'
static createLikertRowElement(element: Partial<LikertRowElement>): LikertRowElement {
...ElementFactory.initInputElement(element),
rowLabel: element.rowLabel !== undefined ? element.rowLabel : {
text: '',
imgSrc: null,
position: 'above'
},
columnCount: element.columnCount !== undefined ? element.columnCount : 0,
firstColumnSizeRatio: element.firstColumnSizeRatio !== undefined ? element.firstColumnSizeRatio : 5,
verticalButtonAlignment:
element.verticalButtonAlignment !== undefined ? element.verticalButtonAlignment : 'center'
private static createRadioButtonGroupElement(element: Partial<RadioButtonGroupElement>): RadioButtonGroupElement {
...ElementFactory.initInputElement({ height: 100, ...element }),
richTextOptions: element.richTextOptions !== undefined ? element.richTextOptions : [],
alignment: element.alignment !== undefined ? element.alignment : 'column',
strikeOtherOptions: element.strikeOtherOptions !== undefined ? element.strikeOtherOptions : false,
position: ElementFactory.initPositionProps({ marginBottom: 30, ...element.position }),
styling: {
...ElementFactory.initBasicStyles({ backgroundColor: 'transparent', ...element.styling }),
lineHeight: element.styling?.lineHeight !== undefined ? element.styling?.lineHeight as number : 135
}
private static createRadioButtonGroupComplexElement(element: Partial<RadioButtonGroupComplexElement>):
RadioButtonGroupComplexElement {
...ElementFactory.initInputElement({ height: 100, ...element }), // TODO better name
columns: element.columns !== undefined ? element.columns : [],
position: ElementFactory.initPositionProps({ marginBottom: 40, ...element.position }),
styling: ElementFactory.initBasicStyles({ backgroundColor: 'transparent', ...element.styling })
private static createSliderElement(element: Partial<SliderElement>): SliderElement {
...ElementFactory.initInputElement({ width: 300, height: 75, ...element }),
minValue: element.minValue !== undefined ? element.minValue : 0,
maxValue: element.maxValue !== undefined ? element.maxValue : 100,
showValues: element.showValues !== undefined ? element.showValues : true,
barStyle: element.barStyle !== undefined ? element.barStyle : false,
thumbLabel: element.thumbLabel !== undefined ? element.thumbLabel : false,
position: ElementFactory.initPositionProps(element.position),
styling: ElementFactory.initBasicStyles({ backgroundColor: 'transparent', ...element.styling })
private static createSpellCorrectElement(element: Partial<SpellCorrectElement>): SpellCorrectElement {
...ElementFactory.initInputElement({ width: 230, height: 80, ...element }),
inputAssistancePreset: element.inputAssistancePreset !== undefined ? element.inputAssistancePreset : 'none',
inputAssistancePosition: element.inputAssistancePosition !== undefined ?
element.inputAssistancePosition : 'floating',
restrictedToInputAssistanceChars: element.restrictedToInputAssistanceChars !== undefined ?
element.restrictedToInputAssistanceChars : true,
showSoftwareKeyboard: element.showSoftwareKeyboard !== undefined ?
element.showSoftwareKeyboard : false,
softwareKeyboardShowFrench: element.softwareKeyboardShowFrench !== undefined ?
element.softwareKeyboardShowFrench : false,
position: ElementFactory.initPositionProps(element.position),
styling: ElementFactory.initBasicStyles({ backgroundColor: 'transparent', ...element.styling })
private static createTextElement(element: Partial<TextElement>): TextElement {
...ElementFactory.initElement({ height: 98, ...element }),
text: element.text !== undefined ? element.text : 'Lorem ipsum dolor sit amet',
highlightableOrange: element.highlightableOrange !== undefined ? element.highlightableOrange : false,
highlightableTurquoise: element.highlightableTurquoise !== undefined ? element.highlightableTurquoise : false,
highlightableYellow: element.highlightableYellow !== undefined ? element.highlightableYellow : false,
columnCount: element.columnCount !== undefined ? element.columnCount : 1,
position: ElementFactory.initPositionProps(element.position),
styling: {
...ElementFactory.initBasicStyles({ backgroundColor: 'transparent', ...element.styling }),
lineHeight: element.styling?.lineHeight !== undefined ? element.styling?.lineHeight as number : 135
private static createTextAreaElement(element: Partial<TextAreaElement>): TextAreaElement {
...ElementFactory.initInputElement({ width: 230, height: 132, ...element }),
appearance: element.appearance !== undefined ? element.appearance : 'outline',
resizeEnabled: element.resizeEnabled !== undefined ? element.resizeEnabled : false,
rowCount: element.rowCount !== undefined ? element.rowCount : 3,
inputAssistancePreset: element.inputAssistancePreset !== undefined ? element.inputAssistancePreset : 'none',
inputAssistancePosition: element.inputAssistancePosition !== undefined ?
element.inputAssistancePosition : 'floating',
restrictedToInputAssistanceChars: element.restrictedToInputAssistanceChars !== undefined ?
element.restrictedToInputAssistanceChars : true,
showSoftwareKeyboard: element.showSoftwareKeyboard !== undefined ?
element.showSoftwareKeyboard : false,
softwareKeyboardShowFrench: element.softwareKeyboardShowFrench !== undefined ?
element.softwareKeyboardShowFrench : false,
position: ElementFactory.initPositionProps(element.position),
styling: {
...ElementFactory.initBasicStyles({ backgroundColor: 'transparent', ...element.styling }),
lineHeight: element.styling?.lineHeight !== undefined ? element.styling?.lineHeight as number : 135
private static createTextFieldElement(element: Partial<TextFieldElement>): TextFieldElement {
...ElementFactory.initInputElement({ width: 180, height: 120, ...element }),
appearance: element.appearance !== undefined ? element.appearance : 'outline',
minLength: element.minLength !== undefined ? element.minLength : 0,
minLengthWarnMessage: element.minLengthWarnMessage !== undefined ?
element.minLengthWarnMessage : 'Eingabe zu kurz',
maxLength: element.maxLength !== undefined ? element.maxLength : 0,
maxLengthWarnMessage: element.maxLengthWarnMessage !== undefined ?
element.maxLengthWarnMessage : 'Eingabe zu lang',
pattern: element.pattern !== undefined ? element.pattern : '',
patternWarnMessage: element.patternWarnMessage !== undefined ?
element.patternWarnMessage : 'Eingabe entspricht nicht der Vorgabe',
inputAssistancePreset: element.inputAssistancePreset !== undefined ? element.inputAssistancePreset : 'none',
inputAssistancePosition: element.inputAssistancePosition !== undefined ?
element.inputAssistancePosition : 'floating',
restrictedToInputAssistanceChars: element.restrictedToInputAssistanceChars !== undefined ?
element.restrictedToInputAssistanceChars : true,
showSoftwareKeyboard: element.showSoftwareKeyboard !== undefined ?
element.showSoftwareKeyboard : false,
softwareKeyboardShowFrench: element.softwareKeyboardShowFrench !== undefined ?
element.softwareKeyboardShowFrench : false,
clearable: element.clearable !== undefined ? element.clearable : false,
position: ElementFactory.initPositionProps(element.position),
styling: {
...ElementFactory.initBasicStyles({ backgroundColor: 'transparent', ...element.styling }),
lineHeight: element.styling?.lineHeight !== undefined ? element.styling?.lineHeight as number : 135
}
private static createToggleButtonElement(element: Partial<ToggleButtonElement>): ToggleButtonElement {
...ElementFactory.initInputElement({ height: 25, ...element }),
options: element.options !== undefined ? element.options : [],
strikeOtherOptions: element.strikeOtherOptions !== undefined ? element.strikeOtherOptions : false,
verticalOrientation: element.verticalOrientation !== undefined ? element.verticalOrientation : false,
dynamicWidth: element.dynamicWidth !== undefined ? element.dynamicWidth : true,
styling: {
...ElementFactory.initBasicStyles({ backgroundColor: 'transparent', ...element.styling }),
lineHeight: element.styling?.lineHeight !== undefined ? element.styling?.lineHeight as number : 135,
selectionColor: element.styling?.selectionColor !== undefined ? element.styling.selectionColor : '#c7f3d0'
private static createAudioElement(element: Partial<AudioElement>): AudioElement {
...ElementFactory.initElement({ width: 250, height: 90, ...element }),
src: element.src !== undefined ? element.src : '', // TODO eigentlich undefined
position: ElementFactory.initPositionProps(element.position),
player: ElementFactory.initPlayerProps(element.player)
private static createVideoElement(element: Partial<VideoElement>): VideoElement {
...ElementFactory.initElement({ width: 280, height: 230, ...element }),
src: element.src !== undefined ? element.src : '', // TODO eigentlich undefined
scale: element.scale !== undefined ? element.scale : false,
position: ElementFactory.initPositionProps(element.position),
player: ElementFactory.initPlayerProps(element.player)