Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | 4x 705x 27x 3860x 3860x 4x 4x 626x 4x 69x 69x 1x 1x 1x 1x 1x 69x 69x 69x 69x 69x 69x 69x 69x 69x 472x 1310x 178x 393x 69x 324x 324x 69x 109x 59x 50x 2x 2x 2x 69x | <template>
<v-navigation-drawer
:border="drawer ? 1 : 0"
color="background"
permanent
rail
rail-width="80"
>
<template #prepend>
<div class="d-flex justify-center">
<v-hover>
<template #default="{ isHovering, props: hover }">
<v-tooltip
open-delay="1000"
location="right"
>
<template #activator="{ props: tooltip }">
<v-btn
data-testid="nav-btn"
v-bind="mergeProps(hover, tooltip)"
:icon="true"
variant="text"
color="minsk_500"
size="large"
@click="close"
>
<v-img
v-if="!isHovering"
src="@/assets/logos/3dicom/colour/colour_single.svg"
width="40"
height="40"
/>
<v-icon
v-else
icon="west"
/>
</v-btn>
</template>
<span>{{ t('labels.backToPortal') }}</span>
</v-tooltip>
</template>
</v-hover>
</div>
</template>
<v-list
data-testid="nav-list"
:selected="[activeDrawer]"
class="px-1"
density="compact"
nav
@update:selected="activeDrawer = $event[0]"
>
<template
v-for="item in items"
:key="item.value"
>
<template v-if="item.visible">
<v-tooltip
open-delay="1000"
location="right"
>
<template #activator="{ props }">
<v-list-item
v-bind="props"
class="mx-auto py-0"
width="42px"
:data-testid="`listitem-${item.value}`"
min-height="30px"
color="primary"
:prepend-icon="item.icon"
:value="item.value"
@click="item.listItemProps.onClick"
/>
<div
class="text-center text-xs-semibold mb-4"
:data-testid="`title-${item.value}`"
>{{ item.title }}</div
>
</template>
<span>{{ item.tooltip }}</span>
<span class="pl-2">{{ item.tooltipShortcut }}</span>
</v-tooltip>
</template>
</template>
</v-list>
<template #append>
<div class="d-flex flex-column align-center">
<v-list
density="compact"
nav
>
<HelpMenu />
</v-list>
<span class="pb-2 text-xs-regular">{{ version }}</span>
</div>
</template>
</v-navigation-drawer>
<v-navigation-drawer
:border="0"
color="background"
:model-value="drawer"
:width="width"
:elevation="canDrag ? 4 : 0"
style="min-width: 264px; max-width: 512px"
permanent
class="resizable-drawer"
>
<v-fade-transition hide-on-leave>
<template
v-for="item in items"
:key="item.value"
>
<template v-if="activeDrawer == item.value">
<Component
v-bind="item.props"
:is="item.component"
/>
</template>
</template>
</v-fade-transition>
</v-navigation-drawer>
</template>
<script setup lang="ts">
import {
ComponentInstance,
computed,
inject,
mergeProps,
onMounted,
ref,
watch,
} from 'vue';
import DisplayPanel from '@/components/navigation/display/DisplayPanel.vue';
import AnnotationPanel from '@/components/navigation/annotation/AnnotationPanel.vue';
import MeasurementPanel from '@/components/navigation/measurement/MeasurementPanel.vue';
import McadPanel from '@/components/navigation/mcad/McadPanel.vue';
import { useDataOverlayStore } from '@/stores/data-overlay.store';
import { useMcadStore } from '@/stores/mcad.store';
import { useViewerStore } from '@/stores/viewer.store';
import { storeToRefs } from 'pinia';
import {
defaultHotkeys,
defineHotkeys,
Hotkeys,
HotkeyScope,
resetScope,
} from '@/functions/HotkeyScope';
import interact from 'interactjs';
import { useI18n } from 'vue-i18n';
import { useDrawerStore } from '@/stores/drawer.store';
import {
SHORTCUT_TEXT,
translateTooltipShortcut,
} from '@/functions/translateTooltipShortcut';
import { VERSION } from '@/plugins/version';
onMounted(() => {
defaultHotkeys({
[Hotkeys.ALT_D]: async () => {
activeDrawer.value = 'display';
},
[Hotkeys.ALT_H]: async () => {
activeDrawer.value = 'home';
},
[Hotkeys.ALT_A]: async () => {
activeDrawer.value = 'annotation';
},
[Hotkeys.ALT_M]: async () => {
activeDrawer.value = 'measure';
},
[Hotkeys.ALT_E]: async () => {
activeDrawer.value = 'design';
},
});
});
interface NavigationDrawerItem {
icon: string;
title: string;
tooltip: string;
tooltipShortcut: string;
value: string;
visible: boolean;
component: ComponentInstance<any>;
props: Record<string, any>;
listItemProps: Record<string, any>;
}
type Emits = {
close: [void];
};
const emit = defineEmits<Emits>();
const { t } = useI18n();
const { annotations, measurements } = storeToRefs(useDataOverlayStore());
const { activeDrawer } = storeToRefs(useDrawerStore());
const { mcads } = storeToRefs(useMcadStore());
const { options } = storeToRefs(useViewerStore());
const version = inject(VERSION)!;
const width = ref<number>(264);
const drawer = computed(() => {
return (
!!activeDrawer.value &&
!!items.value.find((x) => activeDrawer.value === x.value)?.component
);
});
const items = computed<NavigationDrawerItem[]>(() => [
{
value: 'home',
icon: options.value.home?.icon ?? 'home',
tooltip: options.value.home?.title ?? t('labels.home'),
tooltipShortcut: translateTooltipShortcut(SHORTCUT_TEXT.altH),
title: options.value.home?.title ?? t('labels.home'),
visible: true,
component: undefined,
props: {},
listItemProps: {},
},
{
value: 'display',
icon: options.value.display?.icon ?? 'visibility',
tooltip: options.value.display?.title ?? t('labels.display'),
tooltipShortcut: translateTooltipShortcut(SHORTCUT_TEXT.altD),
title: options.value.display?.title ?? t('labels.display'),
visible: options.value.display?.visible ?? true,
component: DisplayPanel,
props: {},
listItemProps: {},
},
{
value: 'annotation',
icon: options.value.annotations?.icon ?? 'stylus_note',
tooltip: options.value.annotations?.title ?? t('labels.annotation'),
tooltipShortcut: translateTooltipShortcut(SHORTCUT_TEXT.altA),
title: options.value.annotations?.title ?? t('labels.annotation'),
visible: options.value.annotations?.visible ?? true,
component: AnnotationPanel,
props: {
items: annotations.value,
},
listItemProps: {},
},
{
value: 'measure',
icon: options.value.measure?.icon ?? 'design_services',
tooltip: options.value.measure?.title ?? t('labels.measure'),
tooltipShortcut: translateTooltipShortcut(SHORTCUT_TEXT.altM),
title: options.value.measure?.title ?? t('labels.measure'),
visible: options.value.measure?.visible ?? true,
component: MeasurementPanel,
props: {
items: measurements.value,
},
listItemProps: {},
},
{
value: 'design',
icon: options.value.design?.icon ?? 'view_in_ar',
tooltip: options.value.design?.title ?? t('labels.design'),
tooltipShortcut: translateTooltipShortcut(SHORTCUT_TEXT.altE),
title: options.value.design?.title ?? t('labels.design'),
visible: options.value.design?.visible ?? true,
component: McadPanel,
listItemProps: {},
props: {
items: mcads.value,
},
},
]);
const canDrag = computed(() => activeDrawer.value === 'mcad');
watch(activeDrawer, () => {
width.value = 264;
interact('.resizable-drawer').resizable({
edges: { top: false, left: false, bottom: false, right: canDrag.value },
listeners: {
/* v8 ignore next 3 */
move: function (event) {
width.value = Math.min(Math.max(event.rect.width, 264), 512);
},
},
});
});
// Some issue with coverage not recognising the watch for drawer.
/* v8 ignore start */
watch(drawer, (isOpen: boolean) => {
if (isOpen) {
defineHotkeys(HotkeyScope.PRIMARY, {
[Hotkeys.ALT_D]: async () => {
activeDrawer.value = 'display';
},
[Hotkeys.ALT_H]: async () => {
activeDrawer.value = 'home';
},
[Hotkeys.ALT_A]: async () => {
activeDrawer.value = 'annotations';
},
[Hotkeys.ALT_M]: async () => {
activeDrawer.value = 'measure';
},
[Hotkeys.ALT_E]: async () => {
activeDrawer.value = 'design';
},
});
} else {
resetScope(HotkeyScope.PRIMARY);
}
});
/* v8 ignore start */
async function close(): Promise<void> {
Eif (options.value.onExit) {
await options.value.onExit();
}
emit('close');
}
defineExpose({
drawer,
});
</script>
|