manups4e / ScaleformUI

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

ScaleformUI_Lua Bug UIMenuGridPanel:CirclePosition not working after scroll items #223

Closed dev-drozd closed 2 months ago

dev-drozd commented 2 months ago

I found a menu bug that prevents me from implementing my plan, after scrolling, UIMenuGridPanel:CirclePosition stops working on all elements. Let’s say the page shows only 7 elements by default, UIMenuGridPanel:CirclePosition works on all of these elements, but as soon as you go down to the 8th menu element, UIMenuGridPanel:CirclePosition stops working on all of them.

Use ScaleformUI Version: v5.3.5

Code example:

`function randomFloat(lower, greater) return lower + math.random() * (greater - lower); end

function newItem(name)

local Item = UIMenuListItem.New(name, {"One","Two", "Three"}, 0)

local Grid = UIMenuGridPanel.New("TOP", "LEFT", "RIGHT", "BOTTOM", vector2(0.5,0.5), 0)

Grid.OnGridPanelChanged = function(menu, item, pos)
    Item:ChangeList({"Individually"})
end

Item.OnListChanged = function(menu, item, index)
    Item:ChangeList({"One","Two", "Three"})
    Grid:CirclePosition(vector2(randomFloat(0.1, 1.0),randomFloat(0.1, 1.0)))
end

Item:AddPanel(Grid)

return Item

end

RegisterCommand("getBug", function(source, args)

MenuHandler:CloseAndClearHistory()

local Menu = UIMenu.New("Bug test", "Items", 10, 50, false, "commonmenu", "interaction_bgd")

Menu:AddItem(newItem("Test item 1"))
Menu:AddItem(newItem("Test item 2"))
Menu:AddItem(newItem("Test item 3"))
Menu:AddItem(newItem("Test item 4"))
Menu:AddItem(newItem("Test item 5"))
Menu:AddItem(newItem("Test item 6"))
Menu:AddItem(newItem("Test item 7"))
Menu:AddItem(newItem("Test item 8")) -- From the moment we see the element after the scroll, all the others will no longer do Grid:CirclePosition until we return the scroll to its place
Menu:AddItem(newItem("Test item 9"))
Menu:AddItem(newItem("Test item 0"))

Menu:Visible(true)

end, false)`

manups4e commented 2 months ago

fixed in https://github.com/manups4e/ScaleformUI/commit/61a50598cfff417ebe1457629b61e81785bb0f29