mirror of
https://github.com/1j01/textual-paint.git
synced 2024-08-17 03:40:26 +03:00
Make submenu positioning more reliable
This commit is contained in:
parent
9e2be988af
commit
ec718cac81
@ -137,7 +137,8 @@ cat samples/ship.ans
|
||||
- Pressing both mouse buttons stops the current tool, but doesn't undo the current action.
|
||||
- Due to limitations of the terminal, shortcuts using Shift or Alt might not work.
|
||||
- Menus are not keyboard navigable.
|
||||
- Clicking the Zoom submenu doesn't always work. You just have to click it a few times before it opens. <!--It tries to position itself based on its size, but its size isn't known until it's opened — at least, not reliably.-->
|
||||
- The Zoom submenu flickers as it opens, and may not always open in the right place.
|
||||
- The canvas flickers when zooming in with the Magnifier tool.
|
||||
- Some languages don't display correctly.
|
||||
- Large files can make the program very slow, as can magnifying the canvas.
|
||||
- The program may crash or freeze up randomly, and there's no auto-save feature.
|
||||
|
@ -123,6 +123,17 @@ class Menu(Container):
|
||||
else:
|
||||
self.styles.max_height = self.screen.size.height
|
||||
|
||||
# Needed to recompute self.region
|
||||
# This makes it much more reliable to open and open in the correct spot,
|
||||
# but unfortunately none of these things work to avoid flickering:
|
||||
# self.styles.offset = (0, 0)
|
||||
# self.refresh(layout=True)
|
||||
# self.styles.visibility = "hidden"
|
||||
# self.hidden = True
|
||||
self.app.refresh(layout=True)
|
||||
# self.styles.visibility = "visible"
|
||||
# self.hidden = False
|
||||
# I also tried call_after_refresh for the below.
|
||||
rect = parent_menu_item.region
|
||||
self.styles.offset = (
|
||||
rect.x - self.region.width if get_direction() == "rtl" else rect.x + rect.width,
|
||||
|
Loading…
Reference in New Issue
Block a user