From 54c0307d9b068d57eab77d36a3880b195a3e1d90 Mon Sep 17 00:00:00 2001 From: Aljaz Grilc Date: Thu, 27 Feb 2025 09:23:53 +0100 Subject: [PATCH] Adjust correctionPanel positioning --- service.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/service.js b/service.js index bb8b1ba..9eed155 100644 --- a/service.js +++ b/service.js @@ -365,7 +365,7 @@ class BesService { const ruleId = match.match.rule.id const scrollPanelRect = this.scrollPanel.getBoundingClientRect() const dpr = window.devicePixelRatio - const markerX = this.canvasPanel.width - 30 * dpr + const markerX = this.canvasPanel.width * dpr match.highlights = Array.from(range.getClientRects()) this.ctx.lineWidth = 2 * dpr // Use 2 for clearer visibility this.ctx.strokeStyle = ruleId.startsWith('MORFOLOGIK_RULE') @@ -637,14 +637,14 @@ class BesService { setCorrectionPanelSize() { this.disableMutationObserver() const styles = window.getComputedStyle(this.hostElement) + const hostRect = this.hostElement.getBoundingClientRect() this.correctionPanel.style.marginLeft = styles.marginLeft this.correctionPanel.style.marginTop = styles.marginTop this.correctionPanel.style.marginRight = styles.marginRight this.correctionPanel.style.marginBottom = styles.marginBottom - this.correctionPanel.style.paddingLeft = styles.paddingLeft - this.correctionPanel.style.paddingTop = styles.paddingTop - this.correctionPanel.style.paddingRight = styles.paddingRight - this.correctionPanel.style.paddingBottom = styles.paddingBottom + this.correctionPanel.style.boxSizing = styles.boxSizing + this.correctionPanel.style.scrollBehavior = styles.scrollBehavior + this.correctionPanel.style.overflow = 'hidden' this.scrollPanel.style.width = `${this.hostElement.scrollWidth}px` this.scrollPanel.style.height = `${this.hostElement.scrollHeight}px` this.canvasPanel.style.width = `${this.hostElement.scrollWidth}px` @@ -669,8 +669,8 @@ class BesService { this.correctionPanel.style.width = `${totalWidth}px` this.correctionPanel.style.height = styles.height } else { - this.correctionPanel.style.width = styles.width - this.correctionPanel.style.height = styles.height + this.correctionPanel.style.width = `${hostRect.width}px` + this.correctionPanel.style.height = `${hostRect.height}px` } this.enableMutationObserver() }