Fixed minor issue for inheritance button

It didn't always reset to correct value. CURA-1278
This commit is contained in:
Jaime van Kessel 2016-06-09 09:59:06 +02:00
parent a21498c375
commit a070684ade

View File

@ -185,12 +185,22 @@ Item {
// Get the deepest entry of this setting that we can find. TODO: This is a bit naive, in some cases
// there might be multiple profiles saying something about the same setting. There is no strategy
// how to handle this as of yet.
var last_entry = propertyProvider.stackLevels.slice(-1)[0]
var last_entry = propertyProvider.stackLevels[propertyProvider.stackLevels.length]
for (var i = 1; i < base.stackLevels.length; i++)
{
var has_setting_function = typeof(propertyProvider.getPropertyValue("value", base.stackLevels[i])) == "object";
if(has_setting_function)
{
last_entry = propertyProvider.stackLevels[i]
break;
}
}
// Put that entry into the "top" instance container.
// This ensures that the value in any of the deeper containers need not be removed, which is
// needed for the reset button (which deletes the top value) to correctly go back to profile
// defaults.
if(last_entry == 4 && base.stackLevel == 0)
if(last_entry == 4 && base.stackLevel == 0 && base.stackLevels.length == 2)
{
// Special case of the inherit reset. If only the definition (4th container) and the first
// entry (user container) are set, we can simply remove the container.