Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with moving items between popup menus #615

Closed
Capybara121 opened this issue Sep 21, 2024 · 2 comments · Fixed by #619 or #631
Closed

Issue with moving items between popup menus #615

Capybara121 opened this issue Sep 21, 2024 · 2 comments · Fixed by #619 or #631

Comments

@Capybara121
Copy link
Contributor

Description

When attempting to move items between different popup menus, items do not move back correctly (exact nature of behaviour unknown)

Code

test.lua
item1 = sbar.add("item","item1",{
    popup = {drawing = true}
})
item2 = sbar.add("item","item2",{
    popup = {drawing = true}
})

member1 = sbar.add("item","member1",{
    label = "member1",
    position = "popup.item1"
})

member2 = sbar.add("item","member2",{
    label = "member2",
    position = "popup.item2"
})

member1:set({position = "popup.item2"})
member1:set({position = "popup.item1"})

Behaviour

Expected behaviour: Item should move to one menu, then move back to its original menu.

Screenshot 2024-09-21 at 7 17 54 PM

Actual behaviour: Item is moved to one menu and remains in said menu.

Screenshot 2024-09-21 at 7 16 46 PM

@Capybara121
Copy link
Contributor Author

Turns out the issue was that when an item has its position changed via bar_item_set_position, it never actually removes itself from the popup that it was added in, meaning that when you attempt to move it back it will not be able to be moved back due to the condition of popup_add_item not allowing an item to be added if the item already exists. Will be posting a PR shortly.

@Capybara121
Copy link
Contributor Author

Not entirely sure whether this warrants a reopening of this issue or a new issue to be made, but I found some more potential problems as follows:

  • When moving an item into a popup for the first time outside of the initial configuration, the popup itself won't render properly
  • When moving the last item out of a popup, the popup won't stop rendering
2024-09-25.09-35-58.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants