Skip to content

Commit

Permalink
Fixes to double and triple clicks
Browse files Browse the repository at this point in the history
  • Loading branch information
GabeContra committed Jan 9, 2023
1 parent 076c8fe commit 11e7b6a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Quorum/Library/Standard/Libraries/Game/StandardInput.quorum
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class StandardInput is GameInput
if table:HasKey(set) or table:HasKey(anySet)
if recentInput not= undefined
recentInput:timer = 0
if seeker not= recentInput:item
if seeker not= recentInput:item and not ItemsAreRelated(recentInput:item, seeker)
recentInput:item = seeker
recentInput:count = 1
mouseEvent:clickCount = 1
Expand Down Expand Up @@ -686,7 +686,7 @@ class StandardInput is GameInput

RecentInputTimer timer
timer:inputValue = button
timer:count = 0
timer:count = 1
recentClicks:Add(timer)

return timer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ class TextFieldDoubleClickSelectWordBehavior is Behavior
integer beginIndex = caretPosition
boolean selectionIsSpecialCharacter = false

if caretPosition >= textField:GetSize() - 1
return now
end

/* find the index of the beginning of the selection determined by whitespace, begininning of the textField, or a special character,
if the selection is a special character, then set the flag to determine the number of special characters to
include in the selection */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ class TextField is Control, MouseListener, MouseMovementListener, FocusListener
highlight:SetSize(glyph:horizontalAdvance, lineHeight)
highlight:SetColor(selectionColor)
highlight:SetX(x)
highlight:SetAcceptsMouseInput(false)
background:Add(highlight)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1134,11 +1134,11 @@ shared class DefaultInputSets
textFieldTable:Add(GetTextInputSet(), fieldInsertBehavior)

InputSet doubleClick
doubleClick:SetMouseInput(mouse:CLICKED_MOUSE)
doubleClick:SetMouseInput(mouse:LEFT)
doubleClick:SetEventCount(2)

InputSet tripleClick
tripleClick:SetMouseInput(mouse:CLICKED_MOUSE)
tripleClick:SetMouseInput(mouse:LEFT)
tripleClick:SetEventCount(3)

InputSet homeSet
Expand All @@ -1155,6 +1155,9 @@ shared class DefaultInputSets
shiftEndSet:SetKeyboardInput(keys:END)
shiftEndSet = AddShiftModifier(shiftEndSet)

Behavior emptyBehavior
textFieldTable:Add(GetLeftClick(), emptyBehavior)

TextFieldDoubleClickSelectWordBehavior textFieldDoubleClickSelectWordBehavior
textFieldTable:Add(doubleClick, textFieldDoubleClickSelectWordBehavior)

Expand Down

0 comments on commit 11e7b6a

Please sign in to comment.