diff options
author | Arseniy Movshev <dodoradio@outlook.com> | 2023-01-07 02:49:45 +0000 |
---|---|---|
committer | Arseniy Movshev <dodoradio@outlook.com> | 2023-01-07 15:46:48 +0000 |
commit | ddff93dee672a3e78259a96f086017ff7b4fea75 (patch) | |
tree | cc78011eba141ab90fb60961ee6b466ad11bbdb7 | |
parent | 452a1a4d5784cfc191485f4e77133ef3090ee693 (diff) |
add borders to waypoints and make them clickable
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/MainMapView.qml | 6 | ||||
-rw-r--r-- | src/MapWaypoint.qml | 13 | ||||
-rw-r--r-- | waypoint.svg | 54 |
4 files changed, 70 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index dc8cba6..e2f3c5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,5 +21,6 @@ add_subdirectory(src) build_translations(i18n) generate_desktop(${CMAKE_SOURCE_DIR} asteroid-map) +install(FILES waypoint.svg DESTINATION /usr/share/icons/asteroid/) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/src/MainMapView.qml b/src/MainMapView.qml index 00f0ef2..3254611 100644 --- a/src/MainMapView.qml +++ b/src/MainMapView.qml @@ -30,7 +30,10 @@ Item { id: waypointSource key: "/map/waypointList" defaultValue: "" - onValueChanged: mapView.updateWaypoints() + onValueChanged: { + mapView.updateWaypoints() + console.log("value changed") + } Component.onCompleted: mapView.updateWaypoints() } @@ -66,6 +69,7 @@ Item { } property MapQuickItem mapItem function updateWaypoints() { + console.log("waypoints updated") var waypointsList = waypointSource.value.split(">") for(var i = 0, size = waypointsList.length-1; i < size ; i++){ var currWaypointData = waypointsList[i].split(";") diff --git a/src/MapWaypoint.qml b/src/MapWaypoint.qml index 1300cb0..3a56dcc 100644 --- a/src/MapWaypoint.qml +++ b/src/MapWaypoint.qml @@ -11,10 +11,17 @@ MapQuickItem { autoFadeIn: false property string iconName property color iconColor - sourceItem: Asteroid.Icon { + sourceItem: Asteroid.IconButton { width: Asteroid.Dims.w(12) + iconName: "waypoint" height: width - name: root.iconName - color: root.iconColor + iconColor: root.iconColor.hsvValue < 0.5 ? "white" : "black" + Asteroid.Icon { + anchors.centerIn: parent + width: parent.width*0.9 + height: width + name: root.iconName + color: root.iconColor + } } } diff --git a/waypoint.svg b/waypoint.svg new file mode 100644 index 0000000..bc6195e --- /dev/null +++ b/waypoint.svg @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + width="20" + height="20" + viewBox="0 0 5.2916668 5.2916666" + version="1.1" + id="svg5" + inkscape:version="1.2.2 (b0a8486541, 2022-12-01)" + sodipodi:docname="waypoint.svg" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg"> + <sodipodi:namedview + id="namedview7" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:showpageshadow="2" + inkscape:pageopacity="0.0" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1" + inkscape:document-units="mm" + showgrid="false" + inkscape:zoom="64" + inkscape:cx="9.5078125" + inkscape:cy="10.578125" + inkscape:window-width="3840" + inkscape:window-height="2122" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:current-layer="layer1" /> + <defs + id="defs2" /> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <circle + style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:9.00087;stroke-linecap:square" + id="path794" + cx="2.6458333" + cy="2.6458333" + r="2.4976666" /> + <path + style="fill:#ffffff;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1" + d="M 1.8217392,5.0036304 2.6458333,5.2916667 3.4699274,5.0036304" + id="path956" + sodipodi:nodetypes="ccc" /> + </g> +</svg> |