Skip to content

Commit

Permalink
Merge pull request #7 from Arzte/selectable
Browse files Browse the repository at this point in the history
Prevent Non-Selectable objects from being selected
  • Loading branch information
ltouroumov authored Jul 2, 2024
2 parents 31ba1c1 + b06d59d commit 7178f09
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
18 changes: 16 additions & 2 deletions components/viewer/ViewProjectObj.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
<div :class="objClass">
<div
class="project-obj"
:class="{ selected: isSelected, disabled: !isEnabled }"
:class="{
selected: isSelected,
disabled: !isEnabled,
notSelectable: obj.isNotSelectable || row.isInfoRow,
}"
@click="toggle"
>
<div class="project-obj-content">
Expand Down Expand Up @@ -105,7 +109,12 @@ const maxSelectedAmount = computed(() =>
);
const toggle = () => {
if (isEnabled.value && !obj.isSelectableMultiple) {
if (
isEnabled.value &&
!obj.isSelectableMultiple &&
!obj.isNotSelectable &&
!row.isInfoRow
) {
if (obj.activateOtherChoice) {
R.split(',', obj.activateThisChoice).forEach((id) => {
store.setSelected(id, !isSelected.value);
Expand Down Expand Up @@ -156,6 +165,11 @@ const decrement = () => {
background-color: gray;
}
&.notSelectable {
border: none;
border-radius: none;
}
.obj-image {
width: 100%;
aspect-ratio: 5/3;
Expand Down
1 change: 1 addition & 0 deletions components/viewer/ViewProjectRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const isVisible = computed(() => condition(selectedIds.value));
.row-text {
padding: 5px;
text-align: center;
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions composables/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export type ProjectObj = HasId &
activateThisChoice: string;

isSelectableMultiple: boolean;
isNotSelectable: boolean;
numMultipleTimesMinus: string;
numMultipleTimesPluss: string;
};
Expand All @@ -62,6 +63,7 @@ export type ProjectRow = HasId &

resultGroupId: string;
allowedChoices: number;
isInfoRow: boolean;

objects: ProjectObj[];
};
Expand Down

0 comments on commit 7178f09

Please sign in to comment.