Use jQuery width for sprites temporarily

This commit is contained in:
aNNiMON 2024-03-16 23:29:05 +02:00
parent 6c1086d542
commit 4ca0629bf3

View File

@ -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";