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

@ -1,5 +1,5 @@
div.line-mouse-marker { div.line-mouse-marker {
background-color: #ffffff; background-color: white;
border: 4px solid rgba(0, 51, 255, 0.6); border: 4px solid magenta;
border-radius: 8px; border-radius: 8px;
} }

View file

@ -3,6 +3,7 @@ BR.TrackMessages = L.Class.extend({
options: { options: {
edgeStyle: { edgeStyle: {
color: 'yellow', color: 'yellow',
opacity: 0.8,
weight: 8 weight: 8
} }
}, },

View file

@ -207,9 +207,18 @@
styles: { styles: {
trailer: { trailer: {
dashArray: [10, 10], dashArray: [10, 10],
opacity: 0.4 opacity: 0.6,
color: 'magenta'
},
track: {
color: 'magenta',
opacity: 1
},
trackCasing: {
weight: 8,
color: 'white',
opacity: 1
}, },
track: {},
nodata: { nodata: {
color: 'darkred' color: 'darkred'
} }

View file

@ -13,6 +13,13 @@ BR.Elevation = L.Control.Elevation.extend({
update: function(track, layer) { update: function(track, layer) {
this.clear(); this.clear();
// bring height indicator to front, because of track casing in BR.Routing
if (this._mouseHeightFocus) {
var g = this._mouseHeightFocus[0][0].parentNode;
g.parentNode.appendChild(g);
}
if (track && track.getLatLngs().length > 0) { if (track && track.getLatLngs().length > 0) {
this.addData(track.toGeoJSON(), layer); this.addData(track.toGeoJSON(), layer);
} }

View file

@ -13,8 +13,13 @@ BR.Routing = L.Routing.extend({
}, },
onAdd: function (map) { onAdd: function (map) {
this._segmentsCasing = new L.FeatureGroup().addTo(map);
var container = L.Routing.prototype.onAdd.call(this, 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 // turn line mouse marker off while over waypoint marker
this.on('waypoint:mouseover', function(e) { this.on('waypoint:mouseover', function(e) {
// L.Routing.Edit._segmentOnMouseout without firing 'segment:mouseout' (enables draw) // L.Routing.Edit._segmentOnMouseout without firing 'segment:mouseout' (enables draw)
@ -86,6 +91,17 @@ BR.Routing = L.Routing.extend({
return container; 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) { ,_removeMarkerEvents: function(marker) {
marker.off('mouseover', this._fireWaypointEvent, this); marker.off('mouseover', this._fireWaypointEvent, this);
marker.off('mouseout' , this._fireWaypointEvent, this); marker.off('mouseout' , this._fireWaypointEvent, this);