diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2017-07-25 23:43:18 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-07-28 07:31:11 -0700 |
commit | f2a8bab01e57ac28c01e71e4ee6affceacce96c1 (patch) | |
tree | c90fa3d3bc6bb01fe59c17e2ffc4dddd638905a0 /mobile-widgets/qml | |
parent | be0d5133240f6113cced1df43b5a5f58c3eff6ed (diff) | |
download | subsurface-f2a8bab01e57ac28c01e71e4ee6affceacce96c1.tar.gz |
mapwidget.qml: include map location text
The MapItemView delegate now includes a white Text element.
It uses the MapLocation "name" property as text.
This text is only visible if the map zoom is above "textVisibleZoom".
For hundreds of dives, using the DropShadow effect for the text
makes it laggy. Instead, using a fake drop shadow (duplicate black
Text under the default text) makes it much better.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'mobile-widgets/qml')
-rw-r--r-- | mobile-widgets/qml/MapWidget.qml | 51 |
1 files changed, 35 insertions, 16 deletions
diff --git a/mobile-widgets/qml/MapWidget.qml b/mobile-widgets/qml/MapWidget.qml index 4794533be..128423285 100644 --- a/mobile-widgets/qml/MapWidget.qml +++ b/mobile-widgets/qml/MapWidget.qml @@ -31,6 +31,7 @@ Item { readonly property var defaultCenter: QtPositioning.coordinate(0, 0) readonly property real defaultZoomIn: 17.0 readonly property real defaultZoomOut: 1.0 + readonly property real textVisibleZoom: 8.0 readonly property real zoomStep: 2.0 property var newCenter: defaultCenter property real newZoom: 1.0 @@ -50,25 +51,43 @@ Item { anchorPoint.y: mapItemImage.height coordinate: model.coordinate z: mapHelper.model.selectedUuid === model.uuid ? mapHelper.model.count - 1 : 0 - sourceItem: Image { - id: mapItemImage - source: "qrc:///mapwidget-marker" + (mapHelper.model.selectedUuid === model.uuid ? "-selected" : "") - - SequentialAnimation { - id: mapItemImageAnimation - PropertyAnimation { - target: mapItemImage; property: "scale"; from: 1.0; to: 0.7; duration: 120 + sourceItem: Item { + Image { + id: mapItemImage + source: "qrc:///mapwidget-marker" + (mapHelper.model.selectedUuid === model.uuid ? "-selected" : "") + SequentialAnimation { + id: mapItemImageAnimation + PropertyAnimation { + target: mapItemImage; property: "scale"; from: 1.0; to: 0.7; duration: 120 + } + PropertyAnimation { + target: mapItemImage; property: "scale"; from: 0.7; to: 1.0; duration: 80 + } } - PropertyAnimation { - target: mapItemImage; property: "scale"; from: 0.7; to: 1.0; duration: 80 + MouseArea { + anchors.fill: parent + onClicked: mapHelper.model.setSelectedUuid(model.uuid, true) + onDoubleClicked: map.doubleClickHandler(model.coordinate) + } + } + Item { + // Text with a duplicate for shadow. DropShadow as layer effect is kind of slow here. + y: mapItemImage.y + mapItemImage.height + visible: map.zoomLevel > map.textVisibleZoom + Text { + id: mapItemTextShadow + x: mapItemText.x + 2; y: mapItemText.y + 2 + text: mapItemText.text + font.pointSize: mapItemText.font.pointSize + color: "black" + } + Text { + id: mapItemText + text: model.name + font.pointSize: 11.0 + color: "white" } } - } - - MouseArea { - anchors.fill: parent - onClicked: mapHelper.model.setSelectedUuid(model.uuid, true) - onDoubleClicked: map.doubleClickHandler(model.coordinate) } } } |