From 41e64c6bcf884971027530e18234059b6484034a Mon Sep 17 00:00:00 2001 From: Rafael Araujo Lehmkuhl Date: Wed, 24 Apr 2024 15:38:22 -0300 Subject: [PATCH 01/48] widget-hugger: Make widget attributes reactive --- src/components/WidgetHugger.vue | 46 ++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/components/WidgetHugger.vue b/src/components/WidgetHugger.vue index 58f9f9f11..f7667d2e6 100644 --- a/src/components/WidgetHugger.vue +++ b/src/components/WidgetHugger.vue @@ -66,7 +66,7 @@ const props = withDefaults(defineProps(), { hideOverflow: false, }) -const widget = toRefs(props).widget +const { size, position, managerVars } = toRefs(props.widget) const allowMoving = toRefs(props).allowMoving const allowResizing = toRefs(props).allowResizing const outerWidgetRef = ref() @@ -85,7 +85,7 @@ const hoveringWidgetOrOverlay = computed(() => hoveringOverlay.value || hovering // Put the widget into highlighted state when in edit-mode and hovering over it watch([hoveringWidgetOrOverlay, allowMoving], () => { - widget.value.managerVars.highlighted = hoveringWidgetOrOverlay.value && allowMoving.value + managerVars.value.highlighted = hoveringWidgetOrOverlay.value && allowMoving.value }) const draggingWidget = ref(false) @@ -103,7 +103,7 @@ const handleDragStart = (event: MouseEvent): void => { if (!allowMoving.value || isResizing.value || !outerWidgetRef.value) return draggingWidget.value = true initialMousePos.value = { x: event.clientX, y: event.clientY } - initialWidgetPos.value = widget.value.position + initialWidgetPos.value = position.value outerWidgetRef.value.style.cursor = 'grabbing' event.stopPropagation() event.preventDefault() @@ -114,8 +114,8 @@ const handleResizeStart = (event: MouseEvent): void => { isResizing.value = true resizeHandle.value = event.target initialMousePos.value = { x: event.clientX, y: event.clientY } - initialWidgetPos.value = widget.value.position - initialWidgetSize.value = widget.value.size + initialWidgetPos.value = position.value + initialWidgetSize.value = size.value event.stopPropagation() event.preventDefault() } @@ -126,9 +126,9 @@ const handleDrag = (event: MouseEvent): void => { const dx = (event.clientX - initialMousePos.value.x) / viewSize.value.width const dy = (event.clientY - initialMousePos.value.y) / viewSize.value.height - widget.value.position = { - x: constrain(initialWidgetPos.value.x + dx, 0, 1 - widget.value.size.width), - y: constrain(initialWidgetPos.value.y + dy, 0, 1 - widget.value.size.height), + position.value = { + x: constrain(initialWidgetPos.value.x + dx, 0, 1 - size.value.width), + y: constrain(initialWidgetPos.value.y + dy, 0, 1 - size.value.height), } } @@ -171,11 +171,11 @@ const handleResize = (event: MouseEvent): void => { newHeight += dy } - widget.value.position = { - x: constrain(newLeft, 0, 1 - widget.value.size.width), - y: constrain(newTop, 0, 1 - widget.value.size.height), + position.value = { + x: constrain(newLeft, 0, 1 - size.value.width), + y: constrain(newTop, 0, 1 - size.value.height), } - widget.value.size = { + size.value = { width: constrain(newWidth, 0.01, 1), height: constrain(newHeight, 0.01, 1), } @@ -197,11 +197,11 @@ const resizeWidgetToMinimalSize = (): void => { if (innerWidgetRef.value === undefined) return const { clientHeight, clientWidth, scrollWidth, scrollHeight } = innerWidgetRef.value if (scrollWidth > 1.05 * clientWidth) { - widget.value.size.width = (1.1 * scrollWidth) / windowWidth.value + size.value.width = (1.1 * scrollWidth) / windowWidth.value stillAutoResizing = true } if (scrollHeight > 1.05 * clientHeight) { - widget.value.size.height = (1.1 * scrollHeight) / windowHeight.value + size.value.height = (1.1 * scrollHeight) / windowHeight.value stillAutoResizing = true } @@ -209,11 +209,11 @@ const resizeWidgetToMinimalSize = (): void => { } onMounted(async () => { - if (widget.value.managerVars.timesMounted === 0) { + if (managerVars.value.timesMounted === 0) { resizeWidgetToMinimalSize() } makeWidgetRespectWalls() - widget.value.managerVars.timesMounted += 1 + managerVars.value.timesMounted += 1 if (widgetResizeHandles.value) { for (let i = 0; i < widgetResizeHandles.value.length; i++) { @@ -248,24 +248,24 @@ const outerBounds = useElementBounding(outerWidgetRef) const makeWidgetRespectWalls = (): void => { for (const bound of [outerBounds.left.value, outerBounds.right.value]) { if (bound < 0 || bound > windowWidth.value) { - widget.value.position.x = 1 - widget.value.size.width + position.value.x = 1 - size.value.width } } for (const bound of [outerBounds.top.value, outerBounds.bottom.value]) { if (bound < 0 || bound > windowHeight.value) { - widget.value.position.y = 1 - widget.value.size.height + position.value.y = 1 - size.value.height } } } const sizeStyle = computed(() => ({ - width: `${100 * widget.value.size.width}%`, - height: `${100 * widget.value.size.height}%`, + width: `${100 * size.value.width}%`, + height: `${100 * size.value.height}%`, })) const positionStyle = computed(() => ({ - left: `${100 * widget.value.position.x}%`, - top: `${100 * widget.value.position.y}%`, + left: `${100 * position.value.x}%`, + top: `${100 * position.value.y}%`, })) const overlayDisplayStyle = computed(() => { @@ -288,7 +288,7 @@ const cursorStyle = computed(() => { const devInfoBlurLevel = computed(() => `${devStore.widgetDevInfoBlurLevel}px`) -const highlighted = computed(() => widget.value.managerVars.highlighted) +const highlighted = computed(() => managerVars.value.highlighted) From 64e5084fc12ca47445959cb1c8f439591a227c48 Mon Sep 17 00:00:00 2001 From: Rafael Araujo Lehmkuhl Date: Tue, 4 Jun 2024 18:07:49 -0300 Subject: [PATCH 06/48] ardupilot: Populate array of available generic variables with the `NAMED_VALUE_FLOATs` --- src/libs/vehicle/ardupilot/ardupilot.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libs/vehicle/ardupilot/ardupilot.ts b/src/libs/vehicle/ardupilot/ardupilot.ts index fedd3d441..58acf793f 100644 --- a/src/libs/vehicle/ardupilot/ardupilot.ts +++ b/src/libs/vehicle/ardupilot/ardupilot.ts @@ -456,6 +456,9 @@ export abstract class ArduPilotVehicle extends Vehicle.AbstractVehicle Date: Mon, 10 Jun 2024 13:59:04 -0300 Subject: [PATCH 07/48] video: Show proper error when failing to process video --- src/components/VideoLibraryModal.vue | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/components/VideoLibraryModal.vue b/src/components/VideoLibraryModal.vue index 5e99ac9fd..b0b4280d7 100644 --- a/src/components/VideoLibraryModal.vue +++ b/src/components/VideoLibraryModal.vue @@ -630,11 +630,9 @@ const processVideos = async (): Promise => { isMultipleSelectionMode.value = false await fetchVideosAndLogData() } catch (error) { - if (error instanceof Error) { - console.error('Video processing failed:', error.message) - } else { - console.error('Processing failed with non-Error type:', error) - } + const errorMsg = `Video processing failed: ${(error as Error).message ?? error!.toString()}` + console.error(errorMsg) + snackbarMessage.value = errorMsg openSnackbar.value = true errorProcessingVideos.value = true } @@ -771,7 +769,7 @@ const openDownloadInfoDialog = (): void => { ? 'You are downloading both processed and unprocessed videos' : 'You are downloading unprocessed video chunks', message: hasProcessedVideos - ? `One of the .zip files contains unprocessed video chunks, which are not playable. + ? `One of the .zip files contains unprocessed video chunks, which are not playable. For a playable video, you need to process it first.` : 'For a playable video, you need to process it first.', variant: 'info', From 00b01616e87a66f426062919a3bd16544a543eb8 Mon Sep 17 00:00:00 2001 From: Rafael Araujo Lehmkuhl Date: Mon, 10 Jun 2024 14:10:32 -0300 Subject: [PATCH 08/48] video: Remove unused `v-on` directive This raises an warning everytime the modal is open. --- src/components/VideoLibraryModal.vue | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/components/VideoLibraryModal.vue b/src/components/VideoLibraryModal.vue index b0b4280d7..6222ba564 100644 --- a/src/components/VideoLibraryModal.vue +++ b/src/components/VideoLibraryModal.vue @@ -325,11 +325,7 @@ transition="slide-x-reverse-transition" >