leaflet: process the most common message first
The 'tile:' message is the most common and most latency sensitive message, so give it priority. Change-Id: Id5790369cd493423a47acab8a3d5107ce91b0d39 Reviewed-on: https://gerrit.libreoffice.org/71071 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
parent
c7ac68e8e3
commit
c45dfe194b
2 changed files with 22 additions and 19 deletions
|
@ -810,20 +810,22 @@ L.Socket = L.Class.extend({
|
|||
this._map.fire('docloaded', {status: true});
|
||||
}
|
||||
|
||||
// these can arrive very early during the startup
|
||||
if (textMsg.startsWith('statusindicatorstart:')) {
|
||||
this._map.fire('statusindicator', {statusType : 'start'});
|
||||
return;
|
||||
}
|
||||
else if (textMsg.startsWith('statusindicatorsetvalue:')) {
|
||||
var value = textMsg.match(/\d+/g)[0];
|
||||
this._map.fire('statusindicator', {statusType : 'setvalue', value : value});
|
||||
return;
|
||||
}
|
||||
else if (textMsg.startsWith('statusindicatorfinish:')) {
|
||||
this._map.fire('statusindicator', {statusType : 'finish'});
|
||||
this._map._fireInitComplete('statusindicatorfinish');
|
||||
return;
|
||||
// These can arrive very early during the startup, and never again.
|
||||
if (textMsg.startsWith('statusindicator')) {
|
||||
if (textMsg.startsWith('statusindicatorstart:')) {
|
||||
this._map.fire('statusindicator', {statusType : 'start'});
|
||||
return;
|
||||
}
|
||||
else if (textMsg.startsWith('statusindicatorsetvalue:')) {
|
||||
var value = textMsg.match(/\d+/g)[0];
|
||||
this._map.fire('statusindicator', {statusType : 'setvalue', value : value});
|
||||
return;
|
||||
}
|
||||
else if (textMsg.startsWith('statusindicatorfinish:')) {
|
||||
this._map.fire('statusindicator', {statusType : 'finish'});
|
||||
this._map._fireInitComplete('statusindicatorfinish');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (this._map._docLayer) {
|
||||
|
|
|
@ -359,7 +359,11 @@ L.TileLayer = L.GridLayer.extend({
|
|||
},
|
||||
|
||||
_onMessage: function (textMsg, img) {
|
||||
if (textMsg.startsWith('commandvalues:')) {
|
||||
// 'tile:' is the most common message type; keep this the first.
|
||||
if (textMsg.startsWith('tile:')) {
|
||||
this._onTileMsg(textMsg, img);
|
||||
}
|
||||
else if (textMsg.startsWith('commandvalues:')) {
|
||||
this._onCommandValuesMsg(textMsg);
|
||||
}
|
||||
else if (textMsg.startsWith('cursorvisible:')) {
|
||||
|
@ -447,9 +451,6 @@ L.TileLayer = L.GridLayer.extend({
|
|||
else if (textMsg.startsWith('textselectionstart:')) {
|
||||
this._onTextSelectionStartMsg(textMsg);
|
||||
}
|
||||
else if (textMsg.startsWith('tile:')) {
|
||||
this._onTileMsg(textMsg, img);
|
||||
}
|
||||
else if (textMsg.startsWith('windowpaint:')) {
|
||||
this._onDialogPaintMsg(textMsg, img);
|
||||
}
|
||||
|
@ -812,7 +813,7 @@ L.TileLayer = L.GridLayer.extend({
|
|||
//first time document open, set last cursor position
|
||||
if (this.lastCursorPos.lat === 0 && this.lastCursorPos.lng === 0)
|
||||
this.lastCursorPos = cursorPos;
|
||||
|
||||
|
||||
var updateCursor = false;
|
||||
if ((this.lastCursorPos.lat !== cursorPos.lat) || (this.lastCursorPos.lng !== cursorPos.lng)) {
|
||||
updateCursor = true;
|
||||
|
|
Loading…
Reference in a new issue