Refactoring 4 life
This commit is contained in:
parent
3a6c476833
commit
64f5b3f511
6 changed files with 52 additions and 43 deletions
31
app/assets/javascripts/leaflet.extend.js.erb
Normal file
31
app/assets/javascripts/leaflet.extend.js.erb
Normal file
|
@ -0,0 +1,31 @@
|
|||
L.extend(L.LatLngBounds.prototype, {
|
||||
getSize: function () {
|
||||
return (this._northEast.lat - this._southWest.lat) *
|
||||
(this._northEast.lng - this._southWest.lng);
|
||||
},
|
||||
|
||||
wrap: function () {
|
||||
return new L.LatLngBounds(this._southWest.wrap(), this._northEast.wrap());
|
||||
}
|
||||
});
|
||||
|
||||
L.extend(L.Map.prototype, {
|
||||
getLayersCode: function() {
|
||||
var layerConfig = '';
|
||||
for (var i in this._layers) { // TODO: map.eachLayer
|
||||
var layer = this._layers[i];
|
||||
if (layer.options && layer.options.code) {
|
||||
layerConfig += layer.options.code;
|
||||
}
|
||||
}
|
||||
return layerConfig;
|
||||
},
|
||||
getMapBaseLayerId: function() {
|
||||
for (var i in this._layers) { // TODO: map.eachLayer
|
||||
var layer = this._layers[i];
|
||||
if (layer.options && layer.options.keyid) return layer.options.keyid;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
L.Icon.Default.imagePath = <%= "#{asset_prefix}/images".to_json %>;
|
Loading…
Add table
Add a link
Reference in a new issue