Skip to content

Commit 2cec497

Browse files
committed
Added mouse click debouncing.
1 parent 8f35cf4 commit 2cec497

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

input_menu.go

+3
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ func GetSelectionFromProportionalHorizontalMenuByIndex(layerAlias string, styleE
225225

226226
}
227227
clearMouseMenuItemIdentifiers(layerAlias, xLocation, yLocation, layerEntry.Width, 1)
228+
memory.MouseMemory.WaitForClickRelease()
228229
return returnValue
229230
}
230231

@@ -322,6 +323,7 @@ func GetSelectionFromHorizontalMenuByIndex(layerAlias string, styleEntry memory.
322323

323324
}
324325
clearMouseMenuItemIdentifiers(layerAlias, xLocation, yLocation, layerEntry.Width, 1)
326+
memory.MouseMemory.WaitForClickRelease()
325327
return returnValue
326328
}
327329

@@ -457,6 +459,7 @@ func GetSelectionFromVerticalMenuByIndex(layerAlias string, styleEntry memory.Tu
457459
}
458460
}
459461
clearMouseMenuItemIdentifiers(layerAlias, xLocation, yLocation, menuWidth, menuHeight)
462+
memory.MouseMemory.WaitForClickRelease()
460463
return returnValue
461464
}
462465

internal/memory/memory_mouse.go

+5
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ func (shared *mouseMemoryType) GetMouseStatus() (int, int, uint, string) {
4040
return currentXLocation, currentYLocation, currentButtonPressed, currentWheelState
4141
}
4242

43+
func (shared *mouseMemoryType) WaitForClickRelease() {
44+
for shared.buttonPressed != 0 {
45+
}
46+
}
47+
4348
func (shared *mouseMemoryType) IsMouseInBoundingBox(xLocation int, yLocation int, width int, height int) bool {
4449
mouseXLocation, mouseYLocation, _, _ := shared.GetMouseStatus()
4550
if mouseXLocation >= xLocation && mouseXLocation <= xLocation+width {

0 commit comments

Comments
 (0)