Skip to content

Commit

Permalink
Change default image path to leaflet depended, remove unneccessary im…
Browse files Browse the repository at this point in the history
…ages
  • Loading branch information
kuzkok committed Jun 22, 2017
1 parent 5d2b5e4 commit 051650a
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 37 deletions.
24 changes: 24 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2

[*.js]
indent_style = space
indent_size = 2

[*.css]
indent_style = space
indent_size = 2

[*.{diff,md}]
trim_trailing_whitespace = false
Binary file removed images/leaf-orange.png
Binary file not shown.
Binary file removed images/leaf-shadow.png
Binary file not shown.
Binary file removed images/marker-icon-2x.png
Binary file not shown.
Binary file removed images/marker-icon.png
Binary file not shown.
Binary file removed images/marker-shadow.png
Binary file not shown.
39 changes: 2 additions & 37 deletions src/leaflet_measure.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,6 @@
return new L.Measure(map, options);
};

L.Measure.imagePath = (function () {
var scripts = document.getElementsByTagName('script'),
leafletRe = /[\/^]leaflet_measure\.js\??/;


var i, len, src, path;

for (i = 0, len = scripts.length; i < len; i++) {
src = scripts[i].src || '';

if (src.indexOf('ember') >= 0) {
return '/assets/images';
} else {
if (src.match(leafletRe)) {
path = src.split(leafletRe)[0];
return (path ? path + '../../' : '') + 'images';
}
}
}
}());

/**
* Примесь, переопределяющая базовые методы инструментов плагина Leaflet.Editable, превращая их в инструменты измерений.
*/
Expand Down Expand Up @@ -104,9 +83,8 @@
pane: 'popupPane',
className: 'leaflet-draw-tooltip'
};
var imagePath = L.Measure.imagePath;
var popupMarkerIcon = L.icon({
iconUrl: imagePath + '/popupMarker.png',
iconUrl: L.Icon.Default.imagePath + '/popupMarker.png',
iconSize: [1, 1]
});
this._map._mouseMarker = L.marker(this._map.getCenter());
Expand Down Expand Up @@ -692,19 +670,6 @@
*/
startMeasure: function (options) {
this._setMouseMarker();
var imagePath = L.Measure.imagePath;
this.options = {
icon: L.icon({
iconUrl: imagePath + '/marker-icon.png',
iconRetinaUrl: imagePath + '/marker-icon-2x.png',
iconSize: [25, 41],
iconAnchor: [12, 41],
popupAnchor: [1, -34],
shadowUrl: imagePath + '/marker-shadow.png',
shadowSize: [41, 41]
})
};

options = options ? L.setOptions(this, options) : this.options;
this.measureLayer = this._map.editTools.startMarker(undefined, options);
this.eventsOn('editable:', this.editableEventTree, true);
Expand Down Expand Up @@ -1602,4 +1567,4 @@
});
});

})(L);
})(L);

0 comments on commit 051650a

Please sign in to comment.