Improve popup positioning based on rect's postion and not on click's X,Y coordiantes.
Closes #3
This commit is contained in:
@@ -1145,8 +1145,14 @@ class BesService {
|
|||||||
hits.forEach(({ el, match }) => {
|
hits.forEach(({ el, match }) => {
|
||||||
popup.setContent(el, match, this, this.isContentEditable())
|
popup.setContent(el, match, this, this.isContentEditable())
|
||||||
this.highlightMistake(match)
|
this.highlightMistake(match)
|
||||||
|
const containerRect = this.hostElement.getBoundingClientRect()
|
||||||
|
match.highlights.forEach(rect => {
|
||||||
|
const clientX = rect.x + containerRect.left
|
||||||
|
const clientY =
|
||||||
|
rect.y + containerRect.top + rect.height - this.hostElement.scrollTop
|
||||||
|
popup.show(clientX, clientY, this)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
popup.show(source.clientX, source.clientY, this)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user