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

@ -8,12 +8,23 @@ BR.Routing = L.Routing.extend({
*/
draw: false
},
snapping: null
snapping: null,
zIndexOffset: -2000
},
onAdd: function (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() {
// crosshair cursor
L.DomUtil.addClass(map.getContainer(), 'routing-draw-enabled');