diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2017-06-08 13:44:54 +0200 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2017-06-14 20:05:15 +0000 |
commit | b75ec0be4dc0ca44d8e8f573a00b9a8da39dfe3e (patch) | |
tree | 78382219aa9f56f46346091d3bbaa8387c8e8936 /src/location/declarativemaps | |
parent | 32548b85a9f75997e23cbd100210fa3c8a199b4d (diff) | |
download | qtlocation-b75ec0be4dc0ca44d8e8f573a00b9a8da39dfe3e.tar.gz |
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 <tmpsantos@gmail.com>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
Diffstat (limited to 'src/location/declarativemaps')
-rw-r--r-- | src/location/declarativemaps/qdeclarativegeomapquickitem.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
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_); + } } } |