mirror of
https://gitlab.com/cc-ru/ocelot/ocelot-desktop.git
synced 2025-12-20 02:59:19 +01:00
Fix cursor movement when mouse is pressed
This commit is contained in:
parent
7316baa390
commit
b17efa3aa2
@ -139,12 +139,6 @@ class TextInput(val initialText: String = "") extends Widget with MouseHandler w
|
||||
if (button != MouseEvent.Button.Right || !selection.active || clamped < selection.from || clamped > selection.to) {
|
||||
setCursorAndSelectionPosition(clamped)
|
||||
}
|
||||
// more special logic: keep `selection.from` updated even if there is no selection active
|
||||
// in case there will be a follow-up drag event, which usually has some lag between initial click and following drag,
|
||||
// and we would not want our mouse selection to lag
|
||||
if (!selection.active) {
|
||||
selection.from = clamped
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -295,6 +289,8 @@ class TextInput(val initialText: String = "") extends Widget with MouseHandler w
|
||||
cursor.position = position
|
||||
if (selection.active) {
|
||||
selection.to = cursor.position
|
||||
} else {
|
||||
selection.from = cursor.position
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user