Adjust correctionPanel positioning

This commit is contained in:
Aljaž Grilc 2025-02-27 09:23:53 +01:00
parent 5d8b620abc
commit 54c0307d9b

View File

@ -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()
}