From 9c869a2897c86752c55bc70cf9e9460d49d98338 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Tue, 18 Jun 2024 11:08:00 +0200 Subject: [PATCH] Fix correction panel size calculation --- service.js | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/service.js b/service.js index ae038aa..d95f793 100644 --- a/service.js +++ b/service.js @@ -323,24 +323,19 @@ class BesService { */ setCorrectionPanelSize() { const styles = window.getComputedStyle(this.textElement) - const totalWidth = - parseFloat(styles.paddingLeft) + - parseFloat(styles.marginLeft) + - parseFloat(styles.width) + - parseFloat(styles.marginRight) + - parseFloat(styles.paddingRight) - const totalHeight = - parseFloat(styles.paddingTop) + - parseFloat(styles.marginTop) + - parseFloat(styles.height) + - parseFloat(styles.marginBottom) + - parseFloat(styles.paddingBottom) - this.correctionPanel.style.width = `${totalWidth}px` - this.correctionPanel.style.height = `${totalHeight}px` + + this.correctionPanel.style.width = styles.width this.correctionPanel.style.marginLeft = styles.marginLeft this.correctionPanel.style.marginRight = styles.marginRight this.correctionPanel.style.paddingLeft = styles.paddingLeft this.correctionPanel.style.paddingRight = styles.paddingRight + this.scrollPanel.style.width = `${this.textElement.scrollWidth}px` + + this.correctionPanel.style.height = styles.height + this.correctionPanel.style.marginTop = styles.marginTop + this.correctionPanel.style.marginBottom = styles.marginBottom + this.correctionPanel.style.paddingTop = styles.paddingTop + this.correctionPanel.style.paddingBottom = styles.paddingBottom this.scrollPanel.style.height = `${this.textElement.scrollHeight}px` }