Skip to content

Commit

Permalink
fix: transform overlay to make underneath of the signature help click…
Browse files Browse the repository at this point in the history
…able

Fixes
#49
  • Loading branch information
aminya committed Dec 25, 2020
1 parent 1674ed3 commit 999d089
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/signature-help-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,18 +309,22 @@ module.exports = class SignatureHelpManager {
// move box above the current editing line
// HACK: patch the decoration's style so it is shown above the current line
setTimeout(() => {
const overlay = view.element.parentElement
if (!overlay) {
return
}
const hight = view.element.getBoundingClientRect().height
const lineHight = editor.getLineHeightInPixels()
const availableHight = (position.row - editor.getFirstVisibleScreenRow()) * lineHight
if (hight < availableHight + 80) {
view.element.style.bottom = lineHight + hight + "px"
overlay.style.transform = `translateY(-${lineHight + hight}px)`
} else {
// move right so it does not overlap with auto-complete-list
const autoCompleteList = editor.getElement().querySelector("autocomplete-suggestion-list")
if (autoCompleteList) {
view.element.style.left = autoCompleteList.clientWidth + "px"
overlay.style.transform = `translateX(${autoCompleteList.clientWidth}px)`
} else {
view.element.style.left = "300px"
overlay.style.transform = "translateX(300px)"
}
}
view.element.style.visibility = "visible"
Expand Down

0 comments on commit 999d089

Please sign in to comment.