improve and customize line-mouse-marker:

- negative zIndexOffset to have line marker under waypoint markers
- turn line marker off when over waypoint marker
- consider border width in iconAnchor (fix offset from line)
- same border color and width as line (instead of black)
This commit is contained in:
Norbert Renner 2014-08-26 17:36:49 +02:00
parent eb50eae909
commit d007c45734
2 changed files with 14 additions and 3 deletions

View file

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

View file

@ -8,12 +8,23 @@ BR.Routing = L.Routing.extend({
*/ */
draw: false draw: false
}, },
snapping: null snapping: null,
zIndexOffset: -2000
}, },
onAdd: function (map) { onAdd: function (map) {
var container = L.Routing.prototype.onAdd.call(this, map); var container = L.Routing.prototype.onAdd.call(this, map);
// turn line mouse marker off while over waypoint marker
this.on('waypoint:mouseover', this._edit._segmentOnMouseout, this._edit);
this.on('waypoint:mouseout', this._edit._segmentOnMouseover, this._edit);
this._edit._mouseMarker.setIcon(L.divIcon({
className: 'line-mouse-marker'
,iconAnchor: [8, 8] // size/2 + border/2
,iconSize: [8, 8]
}));
this._draw.on('enabled', function() { this._draw.on('enabled', function() {
// crosshair cursor // crosshair cursor
L.DomUtil.addClass(map.getContainer(), 'routing-draw-enabled'); L.DomUtil.addClass(map.getContainer(), 'routing-draw-enabled');