mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-19 12:47:49 -06:00
Set min.-height and 'stage-awareness' for print-setup-UI. [CURA-6478]
This commit is contained in:
parent
194f01f840
commit
bd262ca6c4
3 changed files with 28 additions and 4 deletions
|
@ -79,7 +79,10 @@ Item
|
||||||
property int shadowOffset: 2
|
property int shadowOffset: 2
|
||||||
|
|
||||||
// Prefix used for the dragged position preferences. Preferences not used if empty. Don't translate!
|
// Prefix used for the dragged position preferences. Preferences not used if empty. Don't translate!
|
||||||
property var dragPreferencesNamePrefix: ""
|
property string dragPreferencesNamePrefix: ""
|
||||||
|
|
||||||
|
// Whether this component can remain when switchin from one stage to the other (for ex. 'Prepare' to 'Preview')
|
||||||
|
property bool isMultiStage: false
|
||||||
|
|
||||||
function toggleContent()
|
function toggleContent()
|
||||||
{
|
{
|
||||||
|
@ -325,6 +328,18 @@ Item
|
||||||
updateDragPosition();
|
updateDragPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections
|
||||||
|
{
|
||||||
|
target: UM.Controller
|
||||||
|
onActiveStageChanged:
|
||||||
|
{
|
||||||
|
if (isMultiStage)
|
||||||
|
{
|
||||||
|
updateDragPosition();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// DO NOT MOVE UP IN THE CODE: This connection has to be here, after the definition of the content item.
|
// DO NOT MOVE UP IN THE CODE: This connection has to be here, after the definition of the content item.
|
||||||
// Apparently the order in which these are handled matters and so the height is correctly updated if this is here.
|
// Apparently the order in which these are handled matters and so the height is correctly updated if this is here.
|
||||||
Connections
|
Connections
|
||||||
|
|
|
@ -12,6 +12,7 @@ Cura.ExpandableComponent
|
||||||
id: printSetupSelector
|
id: printSetupSelector
|
||||||
|
|
||||||
dragPreferencesNamePrefix: "view/settings"
|
dragPreferencesNamePrefix: "view/settings"
|
||||||
|
isMultiStage: true
|
||||||
|
|
||||||
property bool preSlicedData: PrintInformation.preSliced
|
property bool preSlicedData: PrintInformation.preSliced
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@ Item
|
||||||
{
|
{
|
||||||
id: content
|
id: content
|
||||||
|
|
||||||
|
property int absoluteMinimumHeight: 200 * screenScaleFactor
|
||||||
|
|
||||||
width: UM.Theme.getSize("print_setup_widget").width - 2 * UM.Theme.getSize("default_margin").width
|
width: UM.Theme.getSize("print_setup_widget").width - 2 * UM.Theme.getSize("default_margin").width
|
||||||
height: contents.height + buttonRow.height
|
height: contents.height + buttonRow.height
|
||||||
|
|
||||||
|
@ -86,8 +88,14 @@ Item
|
||||||
Math.min
|
Math.min
|
||||||
(
|
(
|
||||||
UM.Preferences.getValue("view/settings_list_height"),
|
UM.Preferences.getValue("view/settings_list_height"),
|
||||||
base.height - (customPrintSetup.mapToItem(null, 0, 0).y + buttonRow.height + UM.Theme.getSize("default_margin").height)
|
Math.max
|
||||||
|
(
|
||||||
|
absoluteMinimumHeight,
|
||||||
|
base.height - (customPrintSetup.mapToItem(null, 0, 0).y + buttonRow.height + UM.Theme.getSize("default_margin").height)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
updateDragPosition();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
visible: currentModeIndex == PrintSetupSelectorContents.Mode.Custom
|
visible: currentModeIndex == PrintSetupSelectorContents.Mode.Custom
|
||||||
|
@ -175,9 +183,9 @@ Item
|
||||||
// position of mouse relative to dropdown align vertical centre of mouse area to cursor
|
// position of mouse relative to dropdown align vertical centre of mouse area to cursor
|
||||||
// v------------------------------v v------------v
|
// v------------------------------v v------------v
|
||||||
var h = mouseY + buttonRow.y + content.y - height / 2 | 0;
|
var h = mouseY + buttonRow.y + content.y - height / 2 | 0;
|
||||||
if(h < 200 * screenScaleFactor) //Enforce a minimum size.
|
if(h < absoluteMinimumHeight) //Enforce a minimum size.
|
||||||
{
|
{
|
||||||
h = 200 * screenScaleFactor;
|
h = absoluteMinimumHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Absolute mouse Y position in the window, to prevent it from going outside the window.
|
//Absolute mouse Y position in the window, to prevent it from going outside the window.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue