From 8b9a2bfe649d1136513b57d8d7828486228ccf1e Mon Sep 17 00:00:00 2001 From: Paola De Bartolo Date: Tue, 24 Oct 2023 17:00:08 -0300 Subject: [PATCH] fix: update width calcutation on resize Close #12 --- .../META-INF/resources/frontend/src/fc-badge-list.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/META-INF/resources/frontend/src/fc-badge-list.ts b/src/main/resources/META-INF/resources/frontend/src/fc-badge-list.ts index 43aa44e..1498b5e 100644 --- a/src/main/resources/META-INF/resources/frontend/src/fc-badge-list.ts +++ b/src/main/resources/META-INF/resources/frontend/src/fc-badge-list.ts @@ -141,9 +141,9 @@ export class BadgeList extends ResizeMixin(ThemableMixin(LitElement)) { const element = badges[i]; let elementStyle = getComputedStyle(element); - let elementWidth = element.offsetWidth + parseInt(elementStyle.marginInline); - - if (elementWidth < remainingWidth) { + let elementWidth = element.offsetWidth + parseInt(elementStyle.marginInlineStart) + parseInt(elementStyle.marginInlineEnd); + + if (elementWidth <= remainingWidth) { remainingWidth = remainingWidth - elementWidth; } else { removeFromIndex = i;