clicking outside of right-click menu, get rid of it
This commit is contained in:
@@ -761,6 +761,9 @@
|
||||
// Handle mouse input
|
||||
(when mouseMode
|
||||
(let [mousePos (FlxG.mouse.getScreenPosition controlCamera)]
|
||||
// Click outside of right-click menu
|
||||
(when (and isRightClickMenu FlxG.mouse.justPressed !(.containsPoint (getScreenBounds) (FlxG.mouse.getScreenPosition)))
|
||||
(hide))
|
||||
// Click and hover on clickable text entries
|
||||
(controls.forEach ->text
|
||||
(let [onClick (dictGet _actions text)
|
||||
@@ -1101,6 +1104,7 @@
|
||||
(-= xText.x xText.width)))
|
||||
|
||||
(prop &mut :SimpleWindow rightClickMenu)
|
||||
(prop &mut isRightClickMenu false)
|
||||
|
||||
(method :Void showRightClickMenu [:FlxSprite control :Map<String,Action> altActions]
|
||||
(hideTooltipText)
|
||||
@@ -1124,6 +1128,8 @@
|
||||
->choice
|
||||
((dictGet altActions (dictGet keysWithoutNumberMap choice)) control)
|
||||
(objectWith [choiceColor textColor xButton true] bgColor))]
|
||||
(set choiceWindow.isRightClickMenu true)
|
||||
(set choiceWindow.mouseMode mouseMode)
|
||||
(set rightClickMenu choiceWindow)
|
||||
// set up choiceWindow with position where it should be etc
|
||||
(set choiceWindow.camera controlCamera)
|
||||
|
||||
Reference in New Issue
Block a user