diff --git a/src/view/MainView.ts b/src/view/MainView.ts index 9590301..3b5e58d 100644 --- a/src/view/MainView.ts +++ b/src/view/MainView.ts @@ -191,8 +191,7 @@ export class MainView implements ViewModel { if (key in this.spriteInContainer) { img = this.spriteInContainer[key]; } else { - // TODO - const height = this.elBackground.getBoundingClientRect().height; + const height = Math.ceil(this.elBackground.getBoundingClientRect().height); img = document.createElement('img'); img.className = 'sprite'; img.style.height = height + 'px'; @@ -247,8 +246,8 @@ export class MainView implements ViewModel { } private setSpritePosition(img: HTMLImageElement, position: string): void { - const width = this.elBackground.getBoundingClientRect().width; - const imgWidth = img.offsetWidth; + const width = Math.ceil(this.elBackground.getBoundingClientRect().width); + const imgWidth = $(img).width(); // TODO if (TextUtils.isEmpty(position) || position === "center") { img.style.right = "auto"; img.style.left = Math.floor(width / 2 - imgWidth / 2) + "px";