From 8e9a40e24660e006364afe139e7d50dd5894c34e Mon Sep 17 00:00:00 2001 From: VitorVieiraZ Date: Mon, 21 Oct 2024 10:26:45 -0300 Subject: [PATCH] checking if points are equal before adding and enabling map label mouse area only if canCloseShape --- app/maptools/measurementmaptool.cpp | 4 ++++ app/qml/map/components/MMMeasureCrosshair.qml | 6 ++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/maptools/measurementmaptool.cpp b/app/maptools/measurementmaptool.cpp index 3aad186bf..dcaad908b 100644 --- a/app/maptools/measurementmaptool.cpp +++ b/app/maptools/measurementmaptool.cpp @@ -23,6 +23,10 @@ void MeasurementMapTool::addPoint() if ( mapSettings() ) { QgsPoint transformedPoint = mapSettings()->screenToCoordinate( mCrosshairPoint ); + + if ( !mPoints.empty() && transformedPoint == mPoints.back() ) + return; + mPoints.push_back( transformedPoint ); rebuildGeometry(); } diff --git a/app/qml/map/components/MMMeasureCrosshair.qml b/app/qml/map/components/MMMeasureCrosshair.qml index 366c8ea2b..3102def00 100644 --- a/app/qml/map/components/MMMeasureCrosshair.qml +++ b/app/qml/map/components/MMMeasureCrosshair.qml @@ -99,10 +99,8 @@ Item { MouseArea { anchors.fill: parent - onClicked: { - if ( root.canCloseShape ) - root.closeShapeClicked() - } + enabled: root.canCloseShape + onClicked: root.closeShapeClicked() } } }