3434 <v-btn
3535 v-if =" showButtons"
3636 v-bind =" tooltipProps"
37- class =" absolute right-[194px ] w-[140px] mb-[13px] bottom-button bg-slate-50 text-[12px] font-bold"
37+ class =" absolute right-[235px ] w-[140px] mb-[13px] bottom-button bg-slate-50 text-[12px] font-bold"
3838 elevation =" 4"
3939 text =" Edit mission"
4040 append-icon =" mdi-map-marker-radius-outline"
8686 </template >
8787 </v-tooltip >
8888 </div >
89+ <div v-show =" showButtons" >
90+ <MeasurementTool ref =" measurementToolRef" v-model:is-active =" isMeasurementMode" :zoom =" zoom" />
91+ </div >
8992 </div >
9093 <ContextMenu
9194 ref =" contextMenuRef"
@@ -201,9 +204,11 @@ import blueboatMarkerImage from '@/assets/blueboat-marker.png'
201204import brov2MarkerImage from ' @/assets/brov2-marker.png'
202205import genericVehicleMarkerImage from ' @/assets/generic-vehicle-marker.png'
203206import GlobalOriginDialog from ' @/components/GlobalOriginDialog.vue'
207+ import MeasurementTool from ' @/components/mission-planning/MeasurementTool.vue'
204208import MissionChecklist from ' @/components/MissionChecklist.vue'
205209import PoiManager from ' @/components/poi/PoiManager.vue'
206210import { useInteractionDialog } from ' @/composables/interactionDialog'
211+ import { setMapLayer } from ' @/composables/map/useMapLayer'
207212import { openSnackbar } from ' @/composables/snackbar'
208213import { MavCmd , MavType } from ' @/libs/connection/m2r/messages/mavlink2rest-enum'
209214import { datalogger , DatalogVariable } from ' @/libs/sensors-logging'
@@ -262,6 +267,8 @@ let seamarksSaveBtn: HTMLAnchorElement | undefined
262267const downloadMenuOpen = ref (false )
263268const missionItemsInVehicle = ref <Waypoint []>([])
264269const missionSeqToMarkerSeq = shallowRef <Record <number , number >>({})
270+ const isMeasurementMode = ref (false )
271+ const measurementToolRef = ref <InstanceType <typeof MeasurementTool > | null >(null )
265272
266273const glassMenuCssVars = computed (() => ({
267274 ' --glass-background' : interfaceStore .globalGlassMenuStyles .backgroundColor ,
@@ -626,6 +633,15 @@ onMounted(async () => {
626633
627634 map .value .on (' click' , (event : LeafletMouseEvent ) => {
628635 clickedLocation .value = [event .latlng .lat , event .latlng .lng ]
636+ if (isMeasurementMode .value && measurementToolRef .value ) {
637+ measurementToolRef .value .handleMapClick (event )
638+ }
639+ })
640+
641+ map .value .on (' mousemove' , (event : LeafletMouseEvent ) => {
642+ if (isMeasurementMode .value && measurementToolRef .value ) {
643+ measurementToolRef .value .handleMapMouseMove (event )
644+ }
629645 })
630646
631647 // Update center value after panning
@@ -733,6 +749,7 @@ onMounted(async () => {
733749 }
734750
735751 mapReady .value = true
752+ setMapLayer (map .value )
736753
737754 if (missionStore .followVehicleOnMap === true ) {
738755 targetFollower .follow (WhoToFollow .VEHICLE )
@@ -995,6 +1012,12 @@ watch(
9951012 }
9961013)
9971014
1015+ watch (isMeasurementMode , (isActive ) => {
1016+ if (! map .value ) return
1017+ const container = map .value .getContainer ()
1018+ container .style .cursor = isActive ? ' crosshair' : ' '
1019+ })
1020+
9981021// - disable auto update for target follower
9991022// - remove event listeners
10001023onBeforeUnmount (() => {
@@ -1016,6 +1039,7 @@ onBeforeUnmount(() => {
10161039 downloadMissionFromVehicle : async () => Promise .resolve (),
10171040 clearMapDrawing : async () => Promise .resolve (),
10181041 })
1042+ setMapLayer (undefined )
10191043})
10201044
10211045// Pan when variables change
@@ -1561,6 +1585,9 @@ const onGlobalOriginSet = (latitude: number, longitude: number): void => {
15611585
15621586const onKeydown = (event : KeyboardEvent ): void => {
15631587 if (event .key === ' Escape' ) {
1588+ if (isMeasurementMode .value ) {
1589+ isMeasurementMode .value = false
1590+ }
15641591 hideContextMenuAndMarker ()
15651592 return
15661593 }
@@ -2000,7 +2027,7 @@ watch(
20002027 position : absolute ;
20012028 bottom : v-bind(' bottomButtonsDisplacement' );
20022029 margin-bottom : 12px ;
2003- right : 340 px ; /* Position to the left of the buttons */
2030+ right : 378 px ; /* Position to the left of the buttons */
20042031 background : rgba (255 , 255 , 255 , 0.8 );
20052032 border-radius : 1px ;
20062033 padding : 6px 6px ;
0 commit comments