From 64185f9b98731e84dd08db36b0b15c5d5e6de5a3 Mon Sep 17 00:00:00 2001 From: Ismail Sunni Date: Tue, 18 Jun 2024 17:45:13 +0700 Subject: [PATCH 1/2] PB-646: Fix logic to set value in style from literal. --- .../map/components/openlayers/utils/styleFromLiterals.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/map/components/openlayers/utils/styleFromLiterals.js b/src/modules/map/components/openlayers/utils/styleFromLiterals.js index 57f282a48..e48786446 100644 --- a/src/modules/map/components/openlayers/utils/styleFromLiterals.js +++ b/src/modules/map/components/openlayers/utils/styleFromLiterals.js @@ -274,8 +274,8 @@ OlStyleForPropertyValue.prototype.setOlRotation_ = function ( } OlStyleForPropertyValue.prototype.getOlStyle_ = function (feature, resolution, properties) { - // A value can be 0 - const value = properties[this.key] ? properties[this.key] : this.defaultVal + // Use default value if key is not found in properties + const value = properties[this.key] !== undefined ? properties[this.key] : this.defaultVal const geomType = getGeomTypeFromGeometry(feature.getGeometry()) let olStyles = null From 0aadc331aad97ba8281ab9132b8fe52dbb9e6148 Mon Sep 17 00:00:00 2001 From: Ismail Sunni Date: Wed, 19 Jun 2024 08:16:41 +0700 Subject: [PATCH 2/2] PB-464: if value is null, also use default value. --- .../map/components/openlayers/utils/styleFromLiterals.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/map/components/openlayers/utils/styleFromLiterals.js b/src/modules/map/components/openlayers/utils/styleFromLiterals.js index e48786446..998925720 100644 --- a/src/modules/map/components/openlayers/utils/styleFromLiterals.js +++ b/src/modules/map/components/openlayers/utils/styleFromLiterals.js @@ -275,7 +275,7 @@ OlStyleForPropertyValue.prototype.setOlRotation_ = function ( OlStyleForPropertyValue.prototype.getOlStyle_ = function (feature, resolution, properties) { // Use default value if key is not found in properties - const value = properties[this.key] !== undefined ? properties[this.key] : this.defaultVal + const value = properties[this.key] ?? this.defaultVal const geomType = getGeomTypeFromGeometry(feature.getGeometry()) let olStyles = null