Skip to content

Commit 0fc7df0

Browse files
committed
Fix the circle label in Draw & Measure
1 parent 305ff5d commit 0fc7df0

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

contribs/gmf/src/directives/partials/featurestyle.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class="form-control"/>
88
</div>
99
<div
10-
ng-if="fsCtrl.type !== 'Text' && fsCtrl.type !== 'Circle'"
10+
ng-if="fsCtrl.type !== 'Text'"
1111
class="form-group">
1212
<input
1313
id="gmf-featurestyle-showlabel"

src/services/featurehelper.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ ngeo.FeatureHelper.prototype.getPolygonStyle_ = function(feature) {
343343
})
344344
})];
345345
if (showMeasure || showLabel) {
346-
if (azimut !== undefined) {
346+
if (showMeasure && azimut !== undefined) {
347347
// Radius style:
348348
const line = this.getRadiusLine(feature, azimut);
349349
const length = ngeo.interaction.Measure.getFormattedLength(
@@ -374,6 +374,17 @@ ngeo.FeatureHelper.prototype.getPolygonStyle_ = function(feature) {
374374
offsetY: Math.sin((azimut - 90) * Math.PI / 180) * 20
375375
})
376376
}));
377+
378+
//Label Style
379+
if (showLabel) {
380+
styles.push(new ol.style.Style({
381+
text: this.createTextStyle_({
382+
text: this.getNameProperty(feature),
383+
offsetY: -8,
384+
exceedLength: true
385+
})
386+
}));
387+
}
377388
} else {
378389
//Label Style
379390
const textLabelValues = [];
@@ -389,7 +400,6 @@ ngeo.FeatureHelper.prototype.getPolygonStyle_ = function(feature) {
389400
styles.push(new ol.style.Style({
390401
text: this.createTextStyle_({
391402
text: textLabelValue,
392-
offsetY: -(8 / 2 + 4),
393403
exceedLength: true
394404
})
395405
}));

0 commit comments

Comments
 (0)