Fix updateLegend function. CURA-3321

This commit is contained in:
Jack Ha 2017-03-06 13:20:14 +01:00
parent 1c40c94c44
commit 1f61017946

View file

@ -107,17 +107,16 @@ Item
currentIndex: layer_view_type // index matches type_id currentIndex: layer_view_type // index matches type_id
onActivated: { onActivated: {
// Combobox selection // Combobox selection
var type_id = index; // layerViewTypes.get(index).type_id; var type_id = index;
UM.Preferences.setValue("layerview/layer_view_type", type_id); UM.Preferences.setValue("layerview/layer_view_type", type_id);
updateLegend(); updateLegend(type_id);
} }
onModelChanged: { onModelChanged: {
updateLegend(); updateLegend(UM.Preferences.getValue("layerview/layer_view_type"));
} }
// Update visibility of legend. // Update visibility of legend.
function updateLegend() { function updateLegend(type_id) {
var type_id = model.get(currentIndex).type_id;
if (UM.LayerView.compatibilityMode || (type_id == 1)) { if (UM.LayerView.compatibilityMode || (type_id == 1)) {
// Line type // Line type
view_settings.show_legend = true; view_settings.show_legend = true;