-
Notifications
You must be signed in to change notification settings - Fork 268
Support customization of link text #287
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
Conversation
The link of the demo now redirects correctly in https.
Update of the formatting.
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.
Thanks for the pull request. Can you add a screenshot to the description?
src/L.Control.Locate.js
Outdated
|
||
if(options.strings.text !== undefined) { | ||
var text = L.DomUtil.create(options.textElementTag, 'leaflet-locate-text', link); | ||
text.textContent = '\xa0' + options.strings.text; |
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.
Why do you need to add \xa0
?
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.
Why do you need to add
\xa0
?
To make a space between the icon and the text, otherwise they are stuck together and it's ugly. I had the choice to do it by css or like this, i choosen this method. But thinking about, maybe I should make the space by css on the icon with a padding right, like this if the developer choose to use only the text without the icon there is no space for nothing. What do you think?
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.
Yep, let's do it in CSS.
src/L.Control.Locate.js
Outdated
if(options.strings.text !== undefined) { | ||
var text = L.DomUtil.create(options.textElementTag, 'leaflet-locate-text', link); | ||
text.textContent = '\xa0' + options.strings.text; | ||
link.classList.add('leaflet-locate-text-active'); |
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.
indentation?
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.
indentation?
Yes... In my side it's correctly indented, I don't know why the indentation on this preview is wrong. I will check about it for the next push.
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.
Make sure you use spaces.
src/L.Control.Locate.scss
Outdated
@@ -15,6 +15,15 @@ | |||
} | |||
} | |||
|
|||
.leaflet-touch .leaflet-bar .leaflet-locate-text-active { |
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.
What does this have to do with the proposed change?
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 allows to modify the css only if the text option is used, it will not impact the button if the option is not used. Also, I don't use the .leaflet-control-locate because otherwise I would have to use !important on the width property.
Modifications have been made on the css if the text option is displayed because of the default properties of leaflet which made it impossible to display the text correctly.
Sure, I will on the next push. Edite: The requested changes have been made. |
The way to start the project has been changed. Co-authored-by: Dominik Moritz <domoritz@gmail.com>
formatting changed Co-authored-by: Dominik Moritz <domoritz@gmail.com>
README.md updated: The new screenshot-text.png has been added A padding right has been added on the icon's selector (works only if the text option is activated to avoid an extra padding)
I meant a screenshot in the pull request description not the code. I just want some documentation for the feature here. Sorry for being ambiguous. |
My bad, I had misunderstood. Done 👌 |
Thank you for the addition! |
Description
Added functionality to add text to the location button.
It is activated with the "text" option and does not allow HTML characters.
Tested on Firefox, Chrome, Safari. ✔️
Example
Screenshot