From d2ff62485d915d8b8bffd8f3a64288f6828eb4fe Mon Sep 17 00:00:00 2001 From: Joey de l'Arago Date: Mon, 5 Dec 2022 16:18:03 +0100 Subject: [PATCH] Fix popups not maxing height at top of parent CURA-9793 --- resources/qml/Menus/MaterialBrandMenu.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/resources/qml/Menus/MaterialBrandMenu.qml b/resources/qml/Menus/MaterialBrandMenu.qml index f4f2fb5458..e096847016 100644 --- a/resources/qml/Menus/MaterialBrandMenu.qml +++ b/resources/qml/Menus/MaterialBrandMenu.qml @@ -106,7 +106,8 @@ Cura.MenuItem // The popup is longer than the distance between the hovered item and the bottom of the item list. // This pushes the popup upwards until the bottom lines up with the parent bottom. // Only when popup is longer than the parent, the popup will flow out below the parent. - return -Math.max(parent.y - (materialBrandMenu.parent.height - popupHeight), 0) + (3 * UM.Theme.getSize("default_lining").height) + var topOfParent = parent.y + (3 * UM.Theme.getSize("default_lining").height) + return -Math.min(parent.y - (materialBrandMenu.parent.height - popupHeight ), topOfParent) } } @@ -259,7 +260,8 @@ Cura.MenuItem // The popup is longer than the distance between the hovered item and the bottom of the item list. // This pushes the popup upwards until the bottom lines up with the parent bottom. // Only when popup is longer than the parent, the popup will flow out below the parent. - return -Math.max(parent.y - (materialTypesList.height - popupHeight), 0) + var topOfParent = parent.y + (3 * UM.Theme.getSize("default_lining").height) + return -Math.min(parent.y - (materialTypesList.height - popupHeight), parent.y) } }