Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,5 @@ Checkout the [Demo](https://marcchasse.github.io/leaflet.ScaleFactor/)
|----------------|---------|--------------|-------------------------------------------------------------------------------------------------|
| position | String | 'bottomleft' | The position of the control (one of the map corners). See control positions. |
| updateWhenIdle | Boolean | false | If true, the control is updated on moveend, otherwise it's always up-to-date (updated on move). |
| thousand_separator | String | "," | The thousand separator. |
| scale_separator | String | ":" | The scale separator. |
7 changes: 5 additions & 2 deletions leaflet.scalefactor.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
var ScaleFactor = L.Control.extend({
options: {
position: 'bottomleft',
updateWhenIdle: true
updateWhenIdle: true,
thousand_separator: ",",
scale_separator: ':'
},

onAdd: function (map) {
Expand Down Expand Up @@ -71,7 +73,8 @@
var scaleFactor = RealWorlMetersPer100Pixels / ScreenMetersPer100Pixels;

//.replace formats the scale with commas 50000 -> 50,000
this._mScale.innerHTML = '1:' + Math.round(scaleFactor).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
this._mScale.innerHTML = '1' + this.options.scale_separator
+ Math.round(scaleFactor).toString().replace(/\B(?=(\d{3})+(?!\d))/g, this.options.thousand_separator);
}

});
Expand Down
8 changes: 1 addition & 7 deletions leaflet.scalefactor.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.