summaryrefslogtreecommitdiff
path: root/src/location/maps
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2017-03-09 14:42:38 +0100
committerPaolo Angelelli <paolo.angelelli@qt.io>2017-03-22 11:13:32 +0000
commit53b8d29733d912ce25dd45a6ceb9d1f20c4a998a (patch)
treeec4a6073d1bc1d21ab6fca0003608d888d1ec9fa /src/location/maps
parent5c7e6ead198af76022df2bc9ecfb88e727b26bc5 (diff)
downloadqtlocation-53b8d29733d912ce25dd45a6ceb9d1f20c4a998a.tar.gz
Fix for disappearing MapQuickItems with tilted camera
This patch fixes a bug that makes MapQuickItem disappear when the zoomLevel property is set, the camera is tilted and zoomed in very close to the item, causing the coordinate of the map quick item to end behind the camera. Task-number: QTBUG-59397 Change-Id: Iae92204917729eb9daaf8592db318613bf57b966 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/location/maps')
-rw-r--r--src/location/maps/qgeoprojection.cpp16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/location/maps/qgeoprojection.cpp b/src/location/maps/qgeoprojection.cpp
index 1a9981d3..81f3a947 100644
--- a/src/location/maps/qgeoprojection.cpp
+++ b/src/location/maps/qgeoprojection.cpp
@@ -258,11 +258,6 @@ QMatrix4x4 QGeoProjectionWebMercator::quickItemTransformation(const QGeoCoordina
const QDoubleVector2D anchorScaled = QDoubleVector2D(anchorPoint.x(), anchorPoint.y()) * scale;
const QDoubleVector2D anchorMercator = anchorScaled / mapWidth();
- // Check for coord OOB, only coordinate is going to be projected to item position, so
- // testing also coordAnchored might be superfluous
- if (!isProjectable(coordWrapped))
- return QMatrix4x4();
-
const QDoubleVector2D coordAnchored = coordWrapped - anchorMercator;
const QDoubleVector2D coordAnchoredScaled = coordAnchored * m_sideLength;
QDoubleMatrix4x4 matTranslateScale;
@@ -272,21 +267,18 @@ QMatrix4x4 QGeoProjectionWebMercator::quickItemTransformation(const QGeoCoordina
(std::floor(zoomLevel) - std::floor(m_cameraData.zoomLevel())));
matTranslateScale.scale(scale);
- const QDoubleVector2D coordOnScreen = wrappedMapProjectionToItemPosition(coordWrapped);
- QDoubleMatrix4x4 matTransformation;
- matTransformation.translate(-coordOnScreen.x(), -coordOnScreen.y(), 0);
- matTransformation *= m_quickItemTransformation;
-
/*
- * The full transformation chain for quickItemTransformation() is:
+ * The full transformation chain for quickItemTransformation() would be:
* matScreenShift * m_quickItemTransformation * matTranslate * matScale
* where:
* matScreenShift = translate(-coordOnScreen.x(), -coordOnScreen.y(), 0)
* matTranslate = translate(coordAnchoredScaled.x(), coordAnchoredScaled.y(), 0.0)
* matScale = scale(scale)
+ *
+ * However, matScreenShift is removed, as setPosition(0,0) is used in place of setPositionOnScreen.
*/
- return toMatrix4x4(matTransformation * matTranslateScale);
+ return toMatrix4x4(m_quickItemTransformation * matTranslateScale);
}
bool QGeoProjectionWebMercator::isProjectable(const QDoubleVector2D &wrappedProjection) const