loleaflet: support mouse cursor calback

This commit is contained in:
Andrzej Hunt 2015-11-10 11:44:50 +01:00
parent 74edae8703
commit 72c407e0ed
2 changed files with 16 additions and 0 deletions

View file

@ -241,6 +241,9 @@ L.TileLayer = L.GridLayer.extend({
msg += 'height=' + this._docHeightTwips;
this._onInvalidateTilesMsg(msg);
}
else if (textMsg.startsWith('mousepointer:')) {
this._onMousePointerMsg(textMsg);
}
else if (textMsg.startsWith('partpagerectangles:')) {
this._onPartPageRectanglesMsg(textMsg);
}
@ -376,6 +379,11 @@ L.TileLayer = L.GridLayer.extend({
this._onUpdateCellCursor();
},
_onMousePointerMsg: function (textMsg) {
textMsg = textMsg.substring(14); // "mousepointer: "
this._map._container.style.cursor = textMsg;
},
_onHyperlinkClickedMsg: function (textMsg) {
var link = textMsg.substring(18);
window.open(link, '_blank');

View file

@ -157,6 +157,14 @@ L.Map.Mouse = L.Handler.extend({
this._map.fire('handleautoscroll', { pos: e.containerPoint, map: this._map });
}
}
else if (e.type === 'mousemove' && !this._mouseDown) {
clearTimeout(this._mouseOverTimeout);
mousePos = docLayer._latLngToTwips(e.latlng);
this._mouseOverTimeout = setTimeout(L.bind(function() {
docLayer._postMouseEvent('move', mousePos.x, mousePos.y, 1, 0, modifier);
}, this),
100);
}
else if (e.type === 'dblclick' || e.type === 'trplclick' || e.type === 'qdrplclick') {
mousePos = docLayer._latLngToTwips(e.latlng);
var clicks = {