mirror of
https://github.com/DominikDoom/a1111-sd-webui-tagcomplete.git
synced 2026-02-09 17:50:14 +00:00
Fix SDNext ModernUI by following the cursor (#327)
This commit is contained in:
@@ -31,7 +31,7 @@ const autocompleteCSS = `
|
||||
position: absolute;
|
||||
z-index: 999;
|
||||
max-width: calc(100% - 1.5rem);
|
||||
margin: 5px 0 0 0;
|
||||
flex-direction: column; /* Ensure children stack vertically */
|
||||
}
|
||||
.autocompleteResults {
|
||||
background-color: var(--results-bg) !important;
|
||||
@@ -44,6 +44,7 @@ const autocompleteCSS = `
|
||||
overflow-y: var(--results-overflow-y);
|
||||
overflow-x: hidden;
|
||||
word-break: break-word;
|
||||
margin-top: 10px; /* Margin to create space below the cursor */
|
||||
}
|
||||
.sideInfo {
|
||||
display: none;
|
||||
@@ -362,10 +363,12 @@ function showResults(textArea) {
|
||||
parentDiv.style.display = "flex";
|
||||
|
||||
if (TAC_CFG.slidingPopup) {
|
||||
let caretPosition = getCaretCoordinates(textArea, textArea.selectionEnd).left;
|
||||
let offset = Math.min(textArea.offsetLeft - textArea.scrollLeft + caretPosition, textArea.offsetWidth - parentDiv.offsetWidth);
|
||||
let caretPosition = getCaretCoordinates(textArea, textArea.selectionEnd);
|
||||
let offsetTop = textArea.offsetTop + caretPosition.top - textArea.scrollTop + 10; // Adjust this value for desired distance below cursor
|
||||
let offsetLeft = Math.min(textArea.offsetLeft - textArea.scrollLeft + caretPosition.left, textArea.offsetWidth - parentDiv.offsetWidth);
|
||||
|
||||
parentDiv.style.left = `${offset}px`;
|
||||
parentDiv.style.top = `${offsetTop}px`; // Position below the cursor
|
||||
parentDiv.style.left = `${offsetLeft}px`;
|
||||
} else {
|
||||
if (parentDiv.style.left)
|
||||
parentDiv.style.removeProperty("left");
|
||||
|
||||
Reference in New Issue
Block a user