fix text selection in immediate mode

This commit is contained in:
Michael Freno
2025-12-06 11:59:00 -05:00
parent 63c31aed16
commit b790fb1d32
3 changed files with 55 additions and 27 deletions

View File

@@ -1500,14 +1500,14 @@ end
---@param mouseX number
---@param mouseY number
function TextEditor:handleTextDrag(element, mouseX, mouseY)
if not self._focused or not self._mouseDownPosition then
if not self._focused or not element._mouseDownPosition then
return
end
local currentPos = self:mouseToTextPosition(element, mouseX, mouseY)
if currentPos ~= self._mouseDownPosition then
self:setSelection(element, self._mouseDownPosition, currentPos)
if currentPos ~= element._mouseDownPosition then
self:setSelection(element, element._mouseDownPosition, currentPos)
self._cursorPosition = currentPos
self._textDragOccurred = true
else