Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/BaseImageProperties.vue
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function setRange([min, max]: [number, number]) {
>
<template #label>
<span class="text-caption text-medium-emphasis text-no-wrap">
Base image
{{ displayView?.type === 'EnFace' ? 'En face image' : 'Base image' }}
</span>
</template>
<template #contrast="{ resetRangeDrafts }">
Expand Down
37 changes: 12 additions & 25 deletions src/components/EditableItemList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import { nextTick, ref, watch } from 'vue';
import { Maybe } from '@/src/types';
import ListItemRow from './ListItemRow.vue';

const emit = defineEmits<{
create: [];
Expand Down Expand Up @@ -121,20 +122,19 @@ const moveBy = async (id: string, offset: number, event: KeyboardEvent) => {
<!-- Selection is mandatory: clicking a row picks it, and nothing clears it
back to none. -->
<div ref="listElement" class="item-list-scroll">
<v-list-item
<list-item-row
v-for="item in items"
:key="item.id"
v-memo="[item, item.id === modelValue]"
class="item-row"
:name="item.name"
@dragover="dragOver($event, item.id)"
@drop="drop($event, item.id)"
@dragleave="leaveRow"
:active="item.id === modelValue"
:aria-label="item.name"
:aria-current="item.id === modelValue ? 'true' : undefined"
@click="emit('update:model-value', item.id)"
>
<div class="d-flex align-center flex-nowrap">
<template #prepend>
<button
type="button"
class="reorder-handle"
Expand All @@ -156,18 +156,11 @@ const moveBy = async (id: string, offset: number, event: KeyboardEvent) => {
/>
</button>
<slot name="item-prepend" :item="item"></slot>
<v-tooltip :eager="false" :text="item.name" location="end">
<template #activator="{ props: tooltip }">
<v-list-item-title v-bind="tooltip">{{
item.name
}}</v-list-item-title>
</template>
</v-tooltip>
<span class="ml-auto flex-shrink-0 d-flex align-center">
<slot name="item-append" :item="item"></slot>
</span>
</div>
</v-list-item>
</template>
<template #append>
<slot name="item-append" :item="item"></slot>
</template>
</list-item-row>
</div>

<div role="listitem" class="create-row-wrapper">
Expand Down Expand Up @@ -199,28 +192,22 @@ const moveBy = async (id: string, offset: number, event: KeyboardEvent) => {
cursor: grabbing;
}

/* Without it the title refuses to shrink and pushes the row controls off. */
.item-row .v-list-item-title {
min-width: 0;
}

.v-list-item.item-row,
.v-list-item.create-row {
border: 1px solid transparent;
border-radius: 4px;
/* The default inset would dwarf the gaps between the row's parts. */
padding-inline: 4px;
}

.item-row.v-list-item--active {
.v-list-item.item-row.v-list-item--active {
background-color: rgb(var(--v-theme-selection-bg-color));
border-color: rgb(var(--v-theme-selection-border-color));
}

.item-row[data-drop-position='before'] {
.v-list-item.item-row[data-drop-position='before'] {
border-top-color: rgb(var(--v-theme-primary));
}
.item-row[data-drop-position='after'] {
.v-list-item.item-row[data-drop-position='after'] {
border-bottom-color: rgb(var(--v-theme-primary));
}

Expand Down
33 changes: 33 additions & 0 deletions src/components/ListItemRow.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<script setup lang="ts">
defineProps<{ name: string }>();
</script>

<template>
<v-list-item class="item-row" :aria-label="name">
<div class="d-flex align-center flex-nowrap">
<slot name="prepend"></slot>
<v-tooltip :eager="false" :text="name" location="end">
<template #activator="{ props: tooltip }">
<v-list-item-title v-bind="tooltip">{{ name }}</v-list-item-title>
</template>
</v-tooltip>
<span class="ml-auto flex-shrink-0 d-flex align-center">
<slot name="append"></slot>
</span>
</div>
</v-list-item>
</template>

<style scoped>
/* Without it the title refuses to shrink and pushes the row controls off. */
.item-row .v-list-item-title {
min-width: 0;
}

.v-list-item.item-row {
border: 1px solid transparent;
border-radius: 4px;
/* The default inset would dwarf the gaps between the row's parts. */
padding-inline: 4px;
}
</style>
23 changes: 16 additions & 7 deletions src/enface/EnFaceControlPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ import { computed } from 'vue';
import type { Maybe } from '@/src/types';
import { useWindowingStore } from '@/src/store/view-configs/windowing';
import {
defaultSegmentProjection,
useEnFaceViewStore,
type EnFaceViewConfig,
type EnFaceViewControlState,
type SegmentProjection,
} from './store';
import EnFaceControls from './EnFaceControls.vue';

Expand All @@ -31,14 +33,10 @@ const controlState = computed(() => {
axes: [],
depthMaximum: 0,
projectionReason: reason,
thickness: {
thresholdMaximum: 1,
segmentationReason: reason,
highlightReason: reason,
thicknessReason: reason,
segmentControls: {
segments: [],
segmentId: null,
highlightThin: false,
segmentationReason: reason,
thinReason: reason,
},
} satisfies EnFaceViewControlState;
});
Expand All @@ -56,6 +54,16 @@ function patch(patchSettings: Partial<EnFaceViewConfig>) {
)
windowing.resetContrast(viewId, dataId);
}
function patchSegment(segmentId: string, change: Partial<SegmentProjection>) {
const { viewId, dataId } = props;
if (!dataId) return;
const projections = enFaceStore.configFor(viewId, dataId).segmentProjections;
projections[segmentId] = {
...defaultSegmentProjection(),
...projections[segmentId],
...change,
};
}
</script>

<template>
Expand All @@ -65,6 +73,7 @@ function patch(patchSettings: Partial<EnFaceViewConfig>) {
:settings="settings"
:embedded="embedded"
@patch="patch"
@segment="patchSegment"
/>
</div>
</template>
79 changes: 47 additions & 32 deletions src/enface/EnFaceControls.vue
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
<script setup lang="ts">
import { ref, watch } from 'vue';
import { computed, ref, watch } from 'vue';
import ReasonedAction from '@/src/components/ReasonedAction.vue';
import { rangeThumbLabels } from '@/src/utils/rangeThumbLabels';
import { SLAB_METHODS } from '@/src/core/slab/types';
import EnFaceThicknessControls from './EnFaceThicknessControls.vue';
import type { EnFaceViewConfig, EnFaceViewControlState } from './store';
import EnFaceSegmentControls from './EnFaceSegmentControls.vue';
import type {
EnFaceViewConfig,
EnFaceViewControlState,
SegmentProjection,
} from './store';

const props = defineProps<
EnFaceViewControlState & { settings: EnFaceViewConfig; embedded?: boolean }
>();
const emit = defineEmits<{
patch: [settings: Partial<EnFaceViewConfig>];
segment: [segmentId: string, patch: Partial<SegmentProjection>];
}>();
const expandedSections = ref([0, 1]);
const slabDraft = ref<number[] | null>(null);
const slabBounds = computed(
() =>
slabDraft.value ?? [
props.settings.depthStart,
props.settings.depthEnd ?? props.depthMaximum,
]
);
watch(
() => [
props.settings.axis,
Expand Down Expand Up @@ -54,7 +66,7 @@ function updateAxis(axis: number) {
<v-card
class="en-face-controls"
:class="{ embedded }"
:width="embedded ? '100%' : 300"
:width="embedded ? '100%' : 450"
:rounded="embedded ? 0 : 'lg'"
:flat="embedded"
data-testid="enface-rendering-panel"
Expand Down Expand Up @@ -111,15 +123,31 @@ function updateAxis(axis: number) {
data-testid="enface-projection-axis"
/>
</ReasonedAction>
<div class="slab-heading text-body-2">
<span class="d-inline-flex align-center">
Slab
<ReasonedAction
tooltip="First and last voxel indices along the chosen axis, both included in the projection."
class="ml-1"
>
<v-btn
icon="mdi-information-outline"
size="x-small"
variant="text"
aria-label="About slab range"
data-testid="enface-slab-help"
/>
</ReasonedAction>
</span>
<span>
{{ slabBounds[0] }} to {{ slabBounds[1] }} of
{{ depthMaximum }}
</span>
</div>
<ReasonedAction :reason="projectionReason ?? undefined" block>
<v-range-slider
v-slab-labels
:model-value="
slabDraft ?? [
settings.depthStart,
settings.depthEnd ?? depthMaximum,
]
"
:model-value="slabBounds"
@update:model-value="slabDraft = $event"
@end="updateSlab"
@keydown="applyKeyboardSlab"
Expand All @@ -131,33 +159,15 @@ function updateAxis(axis: number) {
hide-details
:disabled="!!projectionReason"
data-testid="enface-slab-range"
>
<template #label>
<span class="d-inline-flex align-center">
Slab
<ReasonedAction
tooltip="First and last voxel indices along the chosen axis, both included in the projection."
class="ml-1"
>
<v-btn
icon="mdi-information-outline"
size="x-small"
variant="text"
aria-label="About slab range"
data-testid="enface-slab-help"
/>
</ReasonedAction>
</span>
</template>
</v-range-slider>
/>
</ReasonedAction>
</v-expansion-panel-text>
</v-expansion-panel>
<EnFaceThicknessControls
v-bind="thickness"
<EnFaceSegmentControls
v-bind="segmentControls"
:settings="settings"
:embedded="embedded"
@patch="emit('patch', $event)"
@segment="(id, patch) => emit('segment', id, patch)"
/>
</v-expansion-panels>
</v-card-text>
Expand All @@ -181,6 +191,11 @@ function updateAxis(axis: number) {
padding: 0 4px;
font-size: 0.8125rem;
}
.slab-heading {
display: flex;
align-items: center;
justify-content: space-between;
}
.control-sections :deep(.v-expansion-panel-text__wrapper) {
padding: 8px 0 0;
}
Expand Down
Loading
Loading