add track casing + change color to magenta

This commit is contained in:
Norbert Renner 2015-04-25 16:19:30 +02:00
parent e822c9a21c
commit 7c2df94fe8
5 changed files with 37 additions and 4 deletions

View file

@ -13,8 +13,13 @@ BR.Routing = L.Routing.extend({
},
onAdd: function (map) {
this._segmentsCasing = new L.FeatureGroup().addTo(map);
var container = L.Routing.prototype.onAdd.call(this, map);
this._segments.on('layeradd', this._addSegmentCasing, this);
this._segments.on('layerremove', this._removeSegmentCasing, this);
// turn line mouse marker off while over waypoint marker
this.on('waypoint:mouseover', function(e) {
// L.Routing.Edit._segmentOnMouseout without firing 'segment:mouseout' (enables draw)
@ -86,6 +91,17 @@ BR.Routing = L.Routing.extend({
return container;
}
,_addSegmentCasing: function(e) {
var casing = L.polyline(e.layer.getLatLngs(), this.options.styles.trackCasing);
this._segmentsCasing.addLayer(casing);
e.layer._casing = casing;
this._segments.bringToFront();
}
,_removeSegmentCasing: function(e) {
this._segmentsCasing.removeLayer(e.layer._casing);
}
,_removeMarkerEvents: function(marker) {
marker.off('mouseover', this._fireWaypointEvent, this);
marker.off('mouseout' , this._fireWaypointEvent, this);