From b75ec0be4dc0ca44d8e8f573a00b9a8da39dfe3e Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Thu, 8 Jun 2017 13:44:54 +0200 Subject: Fix MapQuickItems w/o zoomLevel sticking around when behind the camera This patch fixes the case when rendering a map with MapQuickItems in it that have the zoomLevel property not set and using a tilting angle. Without the patch, in some scenarios the items may stick around on the screen while they should simply go away. Change-Id: Ic485ecf5851d27a0248ff1745ae552bbb81423ba Reviewed-by: Thiago Marcos P. Santos Reviewed-by: Alex Blasche Reviewed-by: Paolo Angelelli --- .../declarativemaps/qdeclarativegeomapquickitem.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/location/declarativemaps/qdeclarativegeomapquickitem.cpp') diff --git a/src/location/declarativemaps/qdeclarativegeomapquickitem.cpp b/src/location/declarativemaps/qdeclarativegeomapquickitem.cpp index cb5cce9a..86d67cf8 100644 --- a/src/location/declarativemaps/qdeclarativegeomapquickitem.cpp +++ b/src/location/declarativemaps/qdeclarativegeomapquickitem.cpp @@ -393,9 +393,20 @@ void QDeclarativeGeoMapQuickItem::updatePolish() matrix_->setMatrix(map()->geoProjection().quickItemTransformation(coordinate(), anchorPoint_, zoomLevel_)); setPosition(QPointF(0,0)); } else { - if (matrix_) - matrix_->setMatrix(QMatrix4x4()); - setPositionOnMap(coordinate(), anchorPoint_); + // if the coordinate is behind the camera, we use the transformation to get the item out of the way + if (map()->cameraData().tilt() > 0.0 + && !map()->geoProjection().isProjectable(map()->geoProjection().geoToWrappedMapProjection(coordinate()))) { + if (!matrix_) { + matrix_ = new QMapQuickItemMatrix4x4(this); + matrix_->appendToItem(opacityContainer_); + } + matrix_->setMatrix(map()->geoProjection().quickItemTransformation(coordinate(), anchorPoint_, map()->cameraData().zoomLevel())); + setPosition(QPointF(0,0)); + } else { + if (matrix_) + matrix_->setMatrix(QMatrix4x4()); + setPositionOnMap(coordinate(), anchorPoint_); + } } } -- cgit v1.2.1