Skip to content

Commit

Permalink
work for #6655
Browse files Browse the repository at this point in the history
  • Loading branch information
OlgaLarina committed Aug 29, 2023
1 parent ae4c84f commit c4cb8af
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/defaultV2-theme/defaultV2.fontless.scss
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ body {
--sd-mobile-width: 600px;
--sd-timer-size: calc(18 * #{$base-unit});
width: 100%;
height: 100%;
overflow: auto;
font-family: var(--font-family, $font-family);
background-color: $background-dim;
position: relative;
Expand Down Expand Up @@ -158,4 +160,4 @@ body {
.sv-popup__body-content {
background-color: $background-dim;
}
}
}
3 changes: 0 additions & 3 deletions src/knockout/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@

<script type="text/html" id="survey-content-template">
<div data-bind="css: rootCss, elementStyle: themeVariables">
<!-- ko if: !!renderBackgroundImage -->
<div data-bind="css: css.rootBackgroundImage, style: backgroundImageStyle"></div>
<!-- /ko -->
<form onsubmit="return false;">
<div class="sv_custom_header" data-bind="visible: !hasLogo"></div>
<div data-bind="css: containerCss">
Expand Down
7 changes: 5 additions & 2 deletions src/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1980,7 +1980,7 @@ export class SurveyModel extends SurveyElementCore

@property({ defaultValue: {} }) private cssVariables: {[index: string]: string} = {};
public get themeVariables() {
return Object.assign({}, this.cssVariables);
return Object.assign({}, this.cssVariables, this.backgroundImageStyle);
}

@property() _isMobile = false;
Expand Down Expand Up @@ -2042,11 +2042,13 @@ export class SurveyModel extends SurveyElementCore
this.setPropertyValue("backgroundOpacity", val);
}
public get backgroundImageStyle() {
if(!this.renderBackgroundImage) return {};

return {
opacity: this.backgroundOpacity,
backgroundImage: this.renderBackgroundImage,
backgroundSize: this.backgroundImageFit,
backgroundAttachment: this.backgroundImageAttachment
backgroundAttachment: this.backgroundImageAttachment === "fixed" ? "scroll" : "local"
};
}
/**
Expand Down Expand Up @@ -4482,6 +4484,7 @@ export class SurveyModel extends SurveyElementCore
.append(this.css.rootMobile, this.isMobile)
.append(this.css.rootReadOnly, this.mode === "display")
.append(this.css.rootCompact, this.isCompact)
.append(this.css.rootBackgroundImage, !!this.renderBackgroundImage)
.toString();
}
private resizeObserver: ResizeObserver;
Expand Down

0 comments on commit c4cb8af

Please sign in to comment.