diff --git a/src/AnalyzeView/LogViewer/LogViewerAltChart.qml b/src/AnalyzeView/LogViewer/LogViewerAltChart.qml index e49c07536c56..e797e7a390dc 100644 --- a/src/AnalyzeView/LogViewer/LogViewerAltChart.qml +++ b/src/AnalyzeView/LogViewer/LogViewerAltChart.qml @@ -256,9 +256,10 @@ Item { z: 10 } - // Mouse area — drag to zoom, right-click to reset, click/move to set cursor + // Mouse area — drag to zoom, right-click to reset, hover/click to set cursor MouseArea { anchors.fill: parent + hoverEnabled: !ScreenTools.isMobile acceptedButtons: Qt.LeftButton | Qt.RightButton z: 11 @@ -275,6 +276,7 @@ Item { _zoomRect.width = 0 _zoomRect.height = _altChart.plotArea.height _zoomRect.visible = true + root._updateCursor(mouse.x) } onPositionChanged: (mouse) => { @@ -283,6 +285,10 @@ Item { const right = Math.max(_dragStartX, mouse.x) _zoomRect.x = left _zoomRect.width = Math.max(0, right - left) + return + } + if (!pressed) { + root._updateCursor(mouse.x) } } @@ -291,12 +297,17 @@ Item { const dragW = _zoomRect.width _zoomRect.visible = false if (dragW < ScreenTools.defaultFontPixelWidth * 0.5) { - root._updateCursor(mouse.x) return } const leftX = root._pixelToAxisX(_zoomRect.x) const rightX = root._pixelToAxisX(_zoomRect.x + _zoomRect.width) root._applyZoom(Math.min(leftX, rightX), Math.max(leftX, rightX)) + root._updateCursor(mouse.x) + } + + onExited: { + _markerVisible = false + root.markerCleared() } } diff --git a/src/AnalyzeView/LogViewer/LogViewerChart.qml b/src/AnalyzeView/LogViewer/LogViewerChart.qml index 207ec00aa32f..558637c79419 100644 --- a/src/AnalyzeView/LogViewer/LogViewerChart.qml +++ b/src/AnalyzeView/LogViewer/LogViewerChart.qml @@ -564,6 +564,7 @@ ColumnLayout { id: _chartZoomArea anchors.fill: parent enabled: _binXAxis.max > _binXAxis.min + hoverEnabled: !ScreenTools.isMobile acceptedButtons: Qt.LeftButton | Qt.RightButton z: 1001 @@ -580,6 +581,7 @@ ColumnLayout { _zoomSelectionRect.width = 0 _zoomSelectionRect.height = _binChart.plotArea.height _zoomSelectionRect.visible = true + _updateCursorInfo(mouse.x, mouse.y, width, height) } onPositionChanged: (mouse) => { @@ -588,6 +590,10 @@ ColumnLayout { const right = Math.max(_dragStartX, mouse.x) _zoomSelectionRect.x = left _zoomSelectionRect.width = Math.max(0, right - left) + return + } + if (!pressed) { + _updateCursorInfo(mouse.x, mouse.y, width, height) } } @@ -596,12 +602,16 @@ ColumnLayout { const dragWidth = _zoomSelectionRect.width _zoomSelectionRect.visible = false if (dragWidth < ScreenTools.defaultFontPixelWidth * 0.5) { - _updateCursorInfo(mouse.x, mouse.y, width, height) return } const leftX = _pixelToAxisX(_zoomSelectionRect.x) const rightX = _pixelToAxisX(_zoomSelectionRect.x + _zoomSelectionRect.width) applyZoomRange(Math.min(leftX, rightX), Math.max(leftX, rightX)) + _updateCursorInfo(mouse.x, mouse.y, width, height) + } + + onExited: { + _positionMarkerVisible = false } } @@ -614,6 +624,15 @@ ColumnLayout { height: _binChart.plotArea.height color: qgcPal.text z: 1002 + + Connections { + target: _binChart + function onPlotAreaChanged() { + if (_positionMarkerVisible) { + _refreshCursorPixelPos() + } + } + } } // Value popup