Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix text place when the label and the coords are displayed #3423

Merged
merged 1 commit into from
Jan 19, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/services/featurehelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ ngeo.FeatureHelper.prototype.getPointStyle_ = function(feature) {
})
})
})];
//Label Style
// Label Style
const textLabelValues = [];
if (showMeasure) {
textLabelValues.push(this.getMeasure(feature));
Expand All @@ -262,10 +262,14 @@ ngeo.FeatureHelper.prototype.getPointStyle_ = function(feature) {
if (showLabel || showMeasure) {
// display both label using \n
const textLabelValue = textLabelValues.join('\n');
const font_size = 10;
// https://reeddesign.co.uk/test/points-pixels.html
const point_to_px = 1.3;
styles.push(new ol.style.Style({
text: this.createTextStyle_({
text: textLabelValue,
offsetY: -(size + 10 / 2 + 4)
size: font_size,
offsetY: -(size + (font_size / 2) * textLabelValues.length * point_to_px + 4)
})
}));
}
Expand Down