manups4e / ScaleformUI

ScaleformUI is a GTA menu styled API made with custom Scaleforms to be lighter, faster and visually better
Other
139 stars 49 forks source link

UIMenu:MouseControlsEnabled doesn't stop mouse clicks from activating items #170

Closed rxyyy closed 1 year ago

rxyyy commented 1 year ago

Issue

Using UIMenu:MouseControlsEnabled to disable the mouse input for a UIMenu instance doesn't stop mouse clicks from activating the currently highlighted item.

Steps to Reproduce

  1. Create a menu with at least 1 item in it.

    local menu = UIMenu.New('Menu', 'Subtitle')
    local testButton = UIMenuItem.New('Test', 'Description')
    
    testButton.Activated = function(menu, item)
        print('boom!')
    end
    
    menu:AddItem(testButton)
    
    menu:MouseControlsEnabled(false)
    menu:Visible(true)
  2. Once the menu is on screen and the option is highlighted, click the left mouse button.

  3. Observe boom! being printed in the F8 console.

Expected Behavior

UIMenu:MouseControlsEnabled should prevent mouse buttons from interacting with the menu.

Additional Notes

With mouse controls enabled, clicking menu items with the mouse might occasionally crash the game. This is best reproduced with at least 3 menu items to click between.

manups4e commented 1 year ago

fixed https://github.com/manups4e/ScaleformUI/commit/15e52400427d50d285b1f9ba96f43f7ae80c04c1