loleaflet: Hide the hat after 1.5s of inactivity in cursor

This commit is contained in:
Pranav Kant 2016-08-25 19:02:21 +05:30
parent 3ff170a194
commit 79aa4d5e06
2 changed files with 6 additions and 1 deletions

View file

@ -51,6 +51,10 @@ L.Cursor = L.Layer.extend({
this._container = L.DomUtil.create('div', 'leaflet-cursor-container');
if (this.options.header) {
this._cursorHeader = L.DomUtil.create('div', 'leaflet-cursor-header', this._container);
setTimeout(L.bind(function() {
L.DomUtil.setStyle(this._cursorHeader, 'visibility', 'hidden');
}, this), this.options.headerTimeout);
}
this._cursor = L.DomUtil.create('div', 'leaflet-cursor', this._container);
if (this.options.blink) {

View file

@ -1111,7 +1111,8 @@ L.TileLayer = L.GridLayer.extend({
var viewCursorOptions = {
color: L.LOUtil.getViewIdHexColor(viewId),
blink: false,
header: true // we want a 'hat' to our view cursors (which will contain view user names)
header: true, // we want a 'hat' to our view cursors (which will contain view user names)
headerTimeout: 1500 // hide after some interval
};
viewCursorMarker = L.cursor(viewCursorPos, viewCursorOptions);
this._map.addLayer(viewCursorMarker);