From 66d261c68069dbac8b759c73a6564438177324b8 Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Thu, 3 Aug 2023 23:20:23 -0500 Subject: [PATCH] Respect alpha channel value for warning boxes using line-opacity property --- scwx-qt/source/scwx/qt/map/alert_layer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scwx-qt/source/scwx/qt/map/alert_layer.cpp b/scwx-qt/source/scwx/qt/map/alert_layer.cpp index 02740b02..f769231c 100644 --- a/scwx-qt/source/scwx/qt/map/alert_layer.cpp +++ b/scwx-qt/source/scwx/qt/map/alert_layer.cpp @@ -413,11 +413,14 @@ static void AddAlertLayer(std::shared_ptr map, map->removeLayer(fgLayerId); } + const float opacity = outlineColor[3] / 255.0f; + map->addLayer({{"id", bgLayerId}, {"type", "line"}, {"source", sourceId}}, beforeLayer); map->setLayoutProperty(bgLayerId, "line-join", "round"); map->setLayoutProperty(bgLayerId, "line-cap", "round"); map->setPaintProperty(bgLayerId, "line-color", "rgba(0, 0, 0, 255)"); + map->setPaintProperty(bgLayerId, "line-opacity", QString("%1").arg(opacity)); map->setPaintProperty(bgLayerId, "line-width", "5"); map->addLayer({{"id", fgLayerId}, {"type", "line"}, {"source", sourceId}}, @@ -431,6 +434,7 @@ static void AddAlertLayer(std::shared_ptr map, .arg(outlineColor[1]) .arg(outlineColor[2]) .arg(outlineColor[3])); + map->setPaintProperty(fgLayerId, "line-opacity", QString("%1").arg(opacity)); map->setPaintProperty(fgLayerId, "line-width", "3"); }