From 69874d496c26059535afcd34ec30bb2fd698e9ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Dub=C3=A9?= Date: Wed, 27 Apr 2016 09:10:03 -0400 Subject: [PATCH] Convert pixels to point for fontSize --- src/ol-ext/format/featurehash.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/ol-ext/format/featurehash.js b/src/ol-ext/format/featurehash.js index 191770db2823..0814d7093d41 100644 --- a/src/ol-ext/format/featurehash.js +++ b/src/ol-ext/format/featurehash.js @@ -651,7 +651,6 @@ ngeo.format.FeatureHash.setStyleProperties_ = function(text, feature) { var properties = ngeo.format.FeatureHash.getStyleProperties_(text, feature); var geometry = feature.getGeometry(); - var clone = {}; // Deal with legacy properties if (geometry instanceof ol.geom.Point) { @@ -661,6 +660,7 @@ ngeo.format.FeatureHash.setStyleProperties_ = function(text, feature) { delete properties['fillColor']; } else { delete properties['fontColor']; + delete properties['fontSize']; } } else { delete properties['fontColor']; @@ -671,7 +671,17 @@ ngeo.format.FeatureHash.setStyleProperties_ = function(text, feature) { } } + // Convert font size from px to pt + if (properties['fontSize']) { + var fontSize = parseFloat(properties['fontSize']); + if (properties['fontSize'].indexOf('px') !== -1) { + fontSize = Math.round(fontSize / 1.333333); + } + properties['fontSize'] = fontSize; + } + // Convert legacy properties + var clone = {}; for (var key in properties) { var value = properties[key]; if (ngeo.format.FeatureHashLegacyProperties_[key]) {