-
Notifications
You must be signed in to change notification settings - Fork 88
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
Display label drawing #3269
Display label drawing #3269
Conversation
f16c03b
to
cd81f45
Compare
1a9fa35
to
77d9790
Compare
77d9790
to
03d9610
Compare
src/services/featurehelper.js
Outdated
text: this.getNameProperty(feature), | ||
offsetY: -(offset / 2 + 4) | ||
}) | ||
})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fredj is this offset calculation correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This 25 looks to be a magic number, shouln't we use multiline from OpenLayers: openlayers/openlayers#4512?
src/services/featurehelper.js
Outdated
text: this.getNameProperty(feature), | ||
offsetY: -(offset / 2 + 4) | ||
}) | ||
})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
src/services/featurehelper.js
Outdated
size: 10, | ||
offsetY: -(offset / 2 + 4) | ||
}) | ||
})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again :-)
In this case we only have the one style for the label, and use the multiline ('/n' option) if both (measure & label are checked)? |
Yes :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just come code can be simplified (2 times) :-)
src/services/featurehelper.js
Outdated
if (showLabel && showMeasure){ | ||
// display both label using \n | ||
textLabelValue = textProperty + '\n' +textMeasure; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usely do like this:
cost textLabelValues = [];
textLabelValues.push(this.getNameProperty(feature));
textLabelValues.push(this.getMeasure(feature));
cost textLabelValue = textLabelValues.join('\n');
=> shorter and no if :-)
ab841e1
to
448a4c6
Compare
448a4c6
to
2160812
Compare
Enable the user to display the feature label.
As it is done for the measurement label.
cf