From fefb66fc66b48ab54b96bf27abae1356530d3b84 Mon Sep 17 00:00:00 2001 From: rhenck <richard.henck@iqb.hu-berlin.de> Date: Mon, 29 Nov 2021 16:34:54 +0100 Subject: [PATCH] Add 30px default bottom-margin to likert and radio --- projects/common/ui-elements/likert/likert-element.ts | 9 ++++++++- .../ui-elements/radio/radio-button-group-element.ts | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/projects/common/ui-elements/likert/likert-element.ts b/projects/common/ui-elements/likert/likert-element.ts index ddb36837f..a4d9144e1 100644 --- a/projects/common/ui-elements/likert/likert-element.ts +++ b/projects/common/ui-elements/likert/likert-element.ts @@ -37,8 +37,15 @@ export class LikertElement extends CompoundElement implements PositionedElement, this.height = serializedElement.height || 200; this.width = serializedElement.width || 250; + if (serializedElement.marginBottom !== undefined) { + this.positionProps.marginBottom = serializedElement.marginBottom; + } else if (serializedElement.positionProps?.marginBottom !== undefined) { + this.positionProps.marginBottom = serializedElement.positionProps.marginBottom; + } else { + this.positionProps.marginBottom = 30; + } this.surfaceProps.backgroundColor = - (serializedElement as unknown as SurfaceElement).surfaceProps.backgroundColor as string || + (serializedElement as unknown as SurfaceElement).surfaceProps?.backgroundColor as string || serializedElement.backgroundColor as string || 'transparent'; } diff --git a/projects/common/ui-elements/radio/radio-button-group-element.ts b/projects/common/ui-elements/radio/radio-button-group-element.ts index 01e429e9d..6dffa64ac 100644 --- a/projects/common/ui-elements/radio/radio-button-group-element.ts +++ b/projects/common/ui-elements/radio/radio-button-group-element.ts @@ -26,6 +26,13 @@ export class RadioButtonGroupElement extends InputElement implements PositionedE this.surfaceProps = initSurfaceElement(serializedElement); this.height = serializedElement.height || 85; + if (serializedElement.marginBottom !== undefined) { + this.positionProps.marginBottom = serializedElement.marginBottom; + } else if (serializedElement.positionProps?.marginBottom !== undefined) { + this.positionProps.marginBottom = serializedElement.positionProps.marginBottom; + } else { + this.positionProps.marginBottom = 30; + } this.surfaceProps.backgroundColor = serializedElement.surfaceProps?.backgroundColor as string || serializedElement.backgroundColor as string || -- GitLab