Skip to content

Commit b5cc1de

Browse files
authored
Merge pull request #44 from AlexKvazos/master
Fix backgrounds and add ready api
2 parents 8101125 + 5f374e6 commit b5cc1de

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/widget/widget.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,11 @@ function render() {
7373
// Set background image if needed
7474
if (design && design.backgroundImage) {
7575
const DPR = window.devicePixelRatio;
76+
const width = Math.ceil(state.width * DPR);
77+
const height = Math.ceil(state.height * DPR);
7678

7779
const baseUrl = 'https://czi3m2qn.cloudimg.io/s/crop';
78-
const cropUrl = `${baseUrl}/${state.width * DPR}x${state.height * DPR}`;
80+
const cropUrl = `${baseUrl}/${width}x${height}`;
7981
const url = `${cropUrl}/${design.backgroundImage}`;
8082

8183
window.document.body.setAttribute('style', `
@@ -90,6 +92,12 @@ function render() {
9092

9193
// Render HTML content
9294
textContainer.innerHTML = content.text;
95+
96+
try {
97+
buildfire.appearance.ready();
98+
} catch (err) {
99+
console.log('appearance.ready() failed, is sdk up to date?');
100+
}
93101
}
94102

95103

0 commit comments

Comments
 (0)