mirror of
https://github.com/1j01/textual-paint.git
synced 2024-12-22 06:11:37 +03:00
Dynamically position menus instead of guessing
I must've missed this property when looking through the properties in the debugger before.
This commit is contained in:
parent
d2ab602ff5
commit
365eb6e4c7
7
menus.py
7
menus.py
@ -80,12 +80,7 @@ class Menu(Container):
|
||||
self.parent_menu = parent_menu
|
||||
self.parent_menu_item = parent_menu_item
|
||||
self.add_class("menu_popup")
|
||||
# I don't see any way to get the position of widgets on screen.
|
||||
# self.style.offset = (parent_menu.x, parent_menu.y + parent_menu.height)
|
||||
# So, guess it based on the position in the list of items, works for one level.
|
||||
menu_bar_height = 3
|
||||
menu_bar_item_width = 8
|
||||
self.styles.offset = (menu_bar_item_width * parent_menu.items.index(self.parent_menu_item), menu_bar_height)
|
||||
self.styles.offset = (parent_menu_item.region.x, parent_menu_item.region.y + parent_menu_item.region.height)
|
||||
|
||||
def close(self):
|
||||
for item in self.items:
|
||||
|
Loading…
Reference in New Issue
Block a user