Don't allow to enter incorrect state with dark overlay

Change-Id: Idda18b8ba916bdb421a205290fd4569fb11d203b
This commit is contained in:
Szymon Kłos 2019-05-31 19:23:38 +02:00 committed by Michael Meeks
parent d14b7ef811
commit f092160814

View file

@ -822,7 +822,7 @@ L.TileLayer = L.GridLayer.extend({
this._resetSelectionRanges();
}
else if (textMsg.match('INPLACE EXIT')) {
if (this._map.hasLayer(this._map.focusLayer)) {
if (this._map.focusLayer) {
this._map.removeLayer(this._map.focusLayer);
this._map.focusLayer = null;
}
@ -830,17 +830,17 @@ L.TileLayer = L.GridLayer.extend({
else if (textMsg.match('INPLACE')) {
if (!this._map.focusLayer) {
this._map.focusLayer = new L.ObjectFocusDarkOverlay().addTo(this._map);
var xTwips = this._map._docLayer._latLngToTwips(this._graphicSelection.getNorthWest()).x;
var yTwips = this._map._docLayer._latLngToTwips(this._graphicSelection.getNorthWest()).y;
var wTwips = this._map._docLayer._latLngToTwips(this._graphicSelection.getSouthEast()).x - xTwips;
var hTwips = this._map._docLayer._latLngToTwips(this._graphicSelection.getSouthEast()).y - yTwips;
this._map.focusLayer.show({x: xTwips, y: yTwips, w: wTwips, h: hTwips});
this._graphicSelection = null;
this._onUpdateGraphicSelection();
}
var xTwips = this._map._docLayer._latLngToTwips(this._graphicSelection.getNorthWest()).x;
var yTwips = this._map._docLayer._latLngToTwips(this._graphicSelection.getNorthWest()).y;
var wTwips = this._map._docLayer._latLngToTwips(this._graphicSelection.getSouthEast()).x - xTwips;
var hTwips = this._map._docLayer._latLngToTwips(this._graphicSelection.getSouthEast()).y - yTwips;
this._map.focusLayer.show({x: xTwips, y: yTwips, w: wTwips, h: hTwips});
this._graphicSelection = null;
this._onUpdateGraphicSelection();
}
else {
textMsg = '[' + textMsg.substr('graphicselection:'.length) + ']';