mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-29 07:14:24 +08:00
Ensure that menu items for extruder are added to right spot in context menu
Fixes CURA-10649
This commit is contained in:
parent
bba1362bad
commit
d8a88739a6
@ -44,8 +44,19 @@ Cura.Menu
|
||||
onTriggered: CuraActions.setExtruderForSelection(model.id)
|
||||
shortcut: "Ctrl+" + (model.index + 1)
|
||||
}
|
||||
// Add it to the fifth position (and above) as we want it to be added after the extruder header.
|
||||
onObjectAdded: function(index, object) { base.insertItem(index + 5, object) }
|
||||
|
||||
onObjectAdded: function(index, object) {
|
||||
var extruder_header_location = 5;
|
||||
// Find the location of the extruder header and insert it below that.
|
||||
for (var i = 0; i < base.count; i++)
|
||||
{
|
||||
if(base.itemAt(i) === extruderHeader)
|
||||
{
|
||||
extruder_header_location = i + 1;
|
||||
}
|
||||
}
|
||||
base.insertItem(extruder_header_location + index, object)
|
||||
}
|
||||
onObjectRemoved: function(index, object) { base.removeItem(object) }
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user