From 0257429df4feb3923ca593d450fa404599c4cb67 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Mon, 23 Mar 2020 13:49:07 -0400 Subject: [PATCH] improve readability --- .../styles/vector/properties/dynamic_style_property.js | 4 ---- .../maps/public/layers/styles/vector/vector_style.js | 7 ++++++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/dynamic_style_property.js b/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/dynamic_style_property.js index a5dadbcb6acbb..ea521f8749d80 100644 --- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/dynamic_style_property.js +++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/dynamic_style_property.js @@ -278,10 +278,6 @@ export class DynamicStyleProperty extends AbstractStyleProperty { } } - getFormattedValue(value) { - return this.isOrdinal() ? this.getNumericalMbFeatureStateValue(value) : this.formatField(value); - } - getNumericalMbFeatureStateValue(value) { const valueAsFloat = parseFloat(value); return isNaN(valueAsFloat) ? null : valueAsFloat; diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style.js b/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style.js index fc240f03e6f4a..ae5d148e43cfd 100644 --- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style.js +++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style.js @@ -510,7 +510,12 @@ export class VectorStyle extends AbstractStyle { //in practice, a new system property will only be created for: // - label text: this requires the value to be formatted first. // - icon orientation: this is a lay-out property which do not support feature-state (but we're still coercing to a number) - feature.properties[computedName] = dynamicStyleProp.getFormattedValue(rawValue); + + const formattedValue = dynamicStyleProp.isOrdinal() + ? dynamicStyleProp.getNumericalMbFeatureStateValue(rawValue) + : dynamicStyleProp.formatField(rawValue); + + feature.properties[computedName] = formattedValue; } } tmpFeatureIdentifier.source = mbSourceId;