loleaflet: Don't create the message if not necessary.

This commit is contained in:
Jan Holesovsky 2016-04-20 19:34:14 +02:00
parent d8741d5ec3
commit 538c1f571d

View file

@ -817,16 +817,16 @@ L.GridLayer = L.Layer.extend({
}
if (!this._tileCache[key]) {
var twips = this._coordsToTwips(coords);
var msg = 'tile ' +
'part=' + coords.part + ' ' +
'width=' + this._tileSize + ' ' +
'height=' + this._tileSize + ' ' +
'tileposx=' + twips.x + ' ' +
'tileposy=' + twips.y + ' ' +
'tilewidth=' + this._tileWidthTwips + ' ' +
'tileheight=' + this._tileHeightTwips;
if (coords.part === this._selectedPart) {
var twips = this._coordsToTwips(coords);
var msg = 'tile ' +
'part=' + coords.part + ' ' +
'width=' + this._tileSize + ' ' +
'height=' + this._tileSize + ' ' +
'tileposx=' + twips.x + ' ' +
'tileposy=' + twips.y + ' ' +
'tilewidth=' + this._tileWidthTwips + ' ' +
'tileheight=' + this._tileHeightTwips;
this._map._socket.sendMessage(msg, key);
}
}