Skip to content

Commit

Permalink
Fix Allow Unselection in subgroups
Browse files Browse the repository at this point in the history
  • Loading branch information
FrsECM committed Apr 23, 2024
1 parent ec28ea6 commit 5062abe
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions web/libs/editor/src/tags/control/Label.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,17 @@ const Model = types.model({
}
break;
case 'subgroup':
const other_in_same_group = labels.selectedLabels.filter((label)=>label.subgroup==self.subgroup && label.alias!=self.alias)
const was_already_selected = self.selected
const label_in_samegroup = labels.selectedLabels.filter((label)=>label.subgroup==self.subgroup)
/** We unselect labels in the same group */
other_in_same_group.map((l)=>l.setSelected(false))
label_in_samegroup.map((l)=>l.setSelected(false))
if (was_already_selected && self.subgroup!=null){
// Allow Unselect in subgroup
self.setSelected(false)
} else
{
self.setSelected(!self.selected)
}
}
}

Expand Down

0 comments on commit 5062abe

Please sign in to comment.