diff --git a/app/components/HybridRenderingView.vue b/app/components/HybridRenderingView.vue index 5100f4d7..d019b0e3 100644 --- a/app/components/HybridRenderingView.vue +++ b/app/components/HybridRenderingView.vue @@ -55,6 +55,14 @@ function debounce(func, wait) { async function handleClick(event) { const { offsetX, offsetY, clientX, clientY } = event; + if (hybridViewerStore.is_ruler_active) { + const rect = container.value.$el.getBoundingClientRect(); + const x = event.clientX - rect.left; + const y = elementHeight.value - (event.clientY - rect.top); + await hybridViewerStore.handleRulerClick(x, y); + return; + } + if (viewerStore.picking_mode) { const rect = container.value.$el.getBoundingClientRect(); const x = event.clientX - rect.left; diff --git a/app/components/Ruler.vue b/app/components/Ruler.vue new file mode 100644 index 00000000..1501c4fb --- /dev/null +++ b/app/components/Ruler.vue @@ -0,0 +1,144 @@ + + + + + + + + + + Point 1 + + + + + + + Point 2 + + + + + + + + Apply + + + + + + Distance + + {{ hybridViewerStore.ruler_distance.toFixed(4) }} + + + + Click in the scene to set both points + + + + + + + Clear + + + + + diff --git a/app/components/ViewToolbar.vue b/app/components/ViewToolbar.vue index c6065cfd..c8178901 100644 --- a/app/components/ViewToolbar.vue +++ b/app/components/ViewToolbar.vue @@ -4,6 +4,7 @@ import CameraBookmarkIcon from "@ogw_front/assets/viewer_svgs/camera-bookmark.sv import CameraManager from "@ogw_front/components/CameraManager"; import CameraOrientation from "@ogw_front/components/CameraOrientation"; import ClippingPlanes from "@ogw_front/components/ClippingPlanes"; +import Ruler from "@ogw_front/components/Ruler"; import Screenshot from "@ogw_front/components/Screenshot"; import ShrinkFilter from "@ogw_front/components/ShrinkFilter"; import ZScaling from "@ogw_front/components/ZScaling"; @@ -19,6 +20,7 @@ const showCameraOrientation = ref(false); const showZScaling = ref(false); const showClippingPlanes = ref(false); const showShrinkFilter = ref(false); +const showRuler = ref(false); const grid_scale = ref(false); const zScale = ref(hybridViewerStore.zScale); @@ -173,6 +175,15 @@ const camera_options = computed(() => [ showShrinkFilter.value = !showShrinkFilter.value; }, }, + { + testId: "rulerButton", + tooltip: "Ruler", + icon: "mdi-ruler", + color: showRuler.value ? "primary" : undefined, + action: () => { + showRuler.value = !showRuler.value; + }, + }, ]); @@ -247,6 +258,7 @@ const camera_options = computed(() => [ /> +