Skip to content

Commit

Permalink
Convert pixels to point for fontSize
Browse files Browse the repository at this point in the history
  • Loading branch information
adube committed May 3, 2016
1 parent bc0af7b commit 69874d4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/ol-ext/format/featurehash.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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'];
Expand All @@ -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]) {
Expand Down

0 comments on commit 69874d4

Please sign in to comment.