|
@@ -37,16 +37,16 @@ const MAP_MIN_ZOOM = 8;
|
|
* Extend leaflet hash for handling level value
|
|
* Extend leaflet hash for handling level value
|
|
*/
|
|
*/
|
|
|
|
|
|
-L.Hash.parseHash = function(hash) {
|
|
|
|
- if(hash.indexOf('#') === 0) {
|
|
|
|
|
|
+L.Hash.parseHash = function (hash) {
|
|
|
|
+ if (hash.indexOf('#') === 0) {
|
|
hash = hash.substr(1);
|
|
hash = hash.substr(1);
|
|
}
|
|
}
|
|
var args = hash.split("/");
|
|
var args = hash.split("/");
|
|
if (args.length >= 3 && args.length <= 4) {
|
|
if (args.length >= 3 && args.length <= 4) {
|
|
var zoom = parseInt(args[0], 10),
|
|
var zoom = parseInt(args[0], 10),
|
|
- lat = parseFloat(args[1]),
|
|
|
|
- lon = parseFloat(args[2]),
|
|
|
|
- level = args.length === 4 ? parseInt(args[3], 10) : 0;
|
|
|
|
|
|
+ lat = parseFloat(args[1]),
|
|
|
|
+ lon = parseFloat(args[2]),
|
|
|
|
+ level = args.length === 4 ? parseInt(args[3], 10) : 0;
|
|
|
|
|
|
if (isNaN(zoom) || isNaN(lat) || isNaN(lon)) {
|
|
if (isNaN(zoom) || isNaN(lat) || isNaN(lon)) {
|
|
return false;
|
|
return false;
|
|
@@ -63,7 +63,7 @@ L.Hash.parseHash = function(hash) {
|
|
};
|
|
};
|
|
L.Hash.prototype.parseHash = L.Hash.parseHash;
|
|
L.Hash.prototype.parseHash = L.Hash.parseHash;
|
|
|
|
|
|
-L.Hash.formatHash = function(map) {
|
|
|
|
|
|
+L.Hash.formatHash = function (map) {
|
|
var center = map.getCenter(),
|
|
var center = map.getCenter(),
|
|
zoom = map.getZoom(),
|
|
zoom = map.getZoom(),
|
|
precision = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
|
|
precision = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
|
|
@@ -76,8 +76,8 @@ L.Hash.formatHash = function(map) {
|
|
};
|
|
};
|
|
L.Hash.prototype.formatHash = L.Hash.formatHash;
|
|
L.Hash.prototype.formatHash = L.Hash.formatHash;
|
|
|
|
|
|
-L.Hash.prototype.setLevel = function(lvl) {
|
|
|
|
- if(this._level !== lvl) {
|
|
|
|
|
|
+L.Hash.prototype.setLevel = function (lvl) {
|
|
|
|
+ if (this._level !== lvl) {
|
|
this._level = lvl;
|
|
this._level = lvl;
|
|
var hash = this.formatHash(this.map);
|
|
var hash = this.formatHash(this.map);
|
|
window.location.replace(hash);
|
|
window.location.replace(hash);
|
|
@@ -85,7 +85,7 @@ L.Hash.prototype.setLevel = function(lvl) {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
-L.Hash.prototype.update = function() {
|
|
|
|
|
|
+L.Hash.prototype.update = function () {
|
|
var hash = window.location.hash;
|
|
var hash = window.location.hash;
|
|
if (hash === this.lastHash) {
|
|
if (hash === this.lastHash) {
|
|
return;
|
|
return;
|
|
@@ -123,8 +123,9 @@ class MyMap extends Component {
|
|
* Alert this component that its size has changed
|
|
* Alert this component that its size has changed
|
|
*/
|
|
*/
|
|
invalidateSize() {
|
|
invalidateSize() {
|
|
- if(this.elem && this.elem.leafletElement) {
|
|
|
|
|
|
+ if (this.elem && this.elem.leafletElement) {
|
|
this.elem.leafletElement.invalidateSize();
|
|
this.elem.leafletElement.invalidateSize();
|
|
|
|
+ this.map = this.elem.leafletElement;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -165,23 +166,23 @@ class MyMap extends Component {
|
|
* @private
|
|
* @private
|
|
*/
|
|
*/
|
|
async _loadData(bounds) {
|
|
async _loadData(bounds) {
|
|
- if(this.props.datalocked || (window.CONFIG.always_authenticated && !window.editor_user)) {
|
|
|
|
|
|
+ if (this.props.datalocked || (window.CONFIG.always_authenticated && !window.editor_user)) {
|
|
return new Promise(resolve => {
|
|
return new Promise(resolve => {
|
|
setTimeout(() => resolve(this._loadData(bounds)), 100);
|
|
setTimeout(() => resolve(this._loadData(bounds)), 100);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- else if(!this.props.draw && this.getBounds() && this.elem.leafletElement.getZoom() >= window.CONFIG.data_min_zoom) {
|
|
|
|
|
|
+ else if (!this.props.draw && this.getBounds() && this.elem.leafletElement.getZoom() >= window.CONFIG.data_min_zoom) {
|
|
let bbox = bounds || this.getBounds();
|
|
let bbox = bounds || this.getBounds();
|
|
|
|
|
|
// Only load data if bbox is valid and not in an already downloaded area
|
|
// Only load data if bbox is valid and not in an already downloaded area
|
|
- if(
|
|
|
|
|
|
+ if (
|
|
bbox
|
|
bbox
|
|
&& bbox.getSouth() !== bbox.getNorth()
|
|
&& bbox.getSouth() !== bbox.getNorth()
|
|
&& bbox.getWest() !== bbox.getEast()
|
|
&& bbox.getWest() !== bbox.getEast()
|
|
&& (!this.loadedArea || !this.loadedArea.contains(bbox))
|
|
&& (!this.loadedArea || !this.loadedArea.contains(bbox))
|
|
) {
|
|
) {
|
|
// Augment bbox size if too small (to avoid many data reloads)
|
|
// Augment bbox size if too small (to avoid many data reloads)
|
|
- while(bbox.getSouthWest().distanceTo(bbox.getNorthEast()) < 400) {
|
|
|
|
|
|
+ while (bbox.getSouthWest().distanceTo(bbox.getNorthEast()) < 400) {
|
|
bbox = bbox.pad(0.1);
|
|
bbox = bbox.pad(0.1);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -193,7 +194,7 @@ class MyMap extends Component {
|
|
const result = await window.vectorDataManager.loadOSMData(bbox);
|
|
const result = await window.vectorDataManager.loadOSMData(bbox);
|
|
this.setState({ loading: false, dataready: result });
|
|
this.setState({ loading: false, dataready: result });
|
|
}
|
|
}
|
|
- catch(e) {
|
|
|
|
|
|
+ catch (e) {
|
|
alert("Can't download data from OSM server. Please retry later.");
|
|
alert("Can't download data from OSM server. Please retry later.");
|
|
this.setState({ loading: false, dataready: false });
|
|
this.setState({ loading: false, dataready: false });
|
|
}
|
|
}
|
|
@@ -218,7 +219,7 @@ class MyMap extends Component {
|
|
// // .replace(/\{switch:.+?\}/g, "{s}")
|
|
// // .replace(/\{switch:.+?\}/g, "{s}")
|
|
// // .replace(/\{-y\}/g, "{y}");
|
|
// // .replace(/\{-y\}/g, "{y}");
|
|
// const url = "https://webrd04.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}";
|
|
// const url = "https://webrd04.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}";
|
|
-
|
|
|
|
|
|
+
|
|
// return <TileLayer
|
|
// return <TileLayer
|
|
// attribution="© 高德地图"
|
|
// attribution="© 高德地图"
|
|
// url={url}
|
|
// url={url}
|
|
@@ -269,7 +270,7 @@ class MyMap extends Component {
|
|
// // maxZoom={MAP_MAX_ZOOM}
|
|
// // maxZoom={MAP_MAX_ZOOM}
|
|
// // />;
|
|
// // />;
|
|
// const url = "https://webrd04.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}";
|
|
// const url = "https://webrd04.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}";
|
|
-
|
|
|
|
|
|
+
|
|
// return <TileLayer
|
|
// return <TileLayer
|
|
// attribution="© 高德地图"
|
|
// attribution="© 高德地图"
|
|
// url={url}
|
|
// url={url}
|
|
@@ -286,14 +287,14 @@ class MyMap extends Component {
|
|
// return null;
|
|
// return null;
|
|
// }
|
|
// }
|
|
const url = "https://webrd04.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}";
|
|
const url = "https://webrd04.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}";
|
|
-
|
|
|
|
|
|
+
|
|
return <TileLayer
|
|
return <TileLayer
|
|
attribution="© 高德地图"
|
|
attribution="© 高德地图"
|
|
url={url}
|
|
url={url}
|
|
// key={url}
|
|
// key={url}
|
|
minZoom={MAP_MIN_ZOOM} //{l.properties.min_zoom}
|
|
minZoom={MAP_MIN_ZOOM} //{l.properties.min_zoom}
|
|
- maxNativeZoom={18} //{l.properties.max_zoom}
|
|
|
|
maxZoom={MAP_MAX_ZOOM}
|
|
maxZoom={MAP_MAX_ZOOM}
|
|
|
|
+ maxNativeZoom={18} //{l.properties.max_zoom}
|
|
opacity={opacity}
|
|
opacity={opacity}
|
|
tms={l.properties.url.indexOf("{-y}") > 0}
|
|
tms={l.properties.url.indexOf("{-y}") > 0}
|
|
key='amap'
|
|
key='amap'
|
|
@@ -305,7 +306,7 @@ class MyMap extends Component {
|
|
* @private
|
|
* @private
|
|
*/
|
|
*/
|
|
_getFloorMapLayer(floormap) {
|
|
_getFloorMapLayer(floormap) {
|
|
- if(!floormap || !floormap.topleft) {
|
|
|
|
|
|
+ if (!floormap || !floormap.topleft) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
@@ -313,7 +314,7 @@ class MyMap extends Component {
|
|
data={floormap}
|
|
data={floormap}
|
|
key={floormap.id}
|
|
key={floormap.id}
|
|
opacity={floormap.opacity !== undefined && !isNaN(parseFloat(floormap.opacity)) ? floormap.opacity : 1}
|
|
opacity={floormap.opacity !== undefined && !isNaN(parseFloat(floormap.opacity)) ? floormap.opacity : 1}
|
|
- ref={"floormap_"+floormap.id}
|
|
|
|
|
|
+ ref={"floormap_" + floormap.id}
|
|
level={this.props.level}
|
|
level={this.props.level}
|
|
mode={this.props.mode}
|
|
mode={this.props.mode}
|
|
tool={this.props.floorImageryMode}
|
|
tool={this.props.floorImageryMode}
|
|
@@ -325,11 +326,11 @@ class MyMap extends Component {
|
|
const floorImgs = window.imageryManager.getFloorImages();
|
|
const floorImgs = window.imageryManager.getFloorImages();
|
|
let levelsList = null;
|
|
let levelsList = null;
|
|
|
|
|
|
- if(this.props.mode === Body.MODE_EXPLORE) {
|
|
|
|
|
|
+ if (this.props.mode === Body.MODE_EXPLORE) {
|
|
levelsList = window.vectorDataManager.getAllLevels(true);
|
|
levelsList = window.vectorDataManager.getAllLevels(true);
|
|
}
|
|
}
|
|
- else if(this.props.mode === Body.MODE_BUILDING) {
|
|
|
|
- if(this.props.building) {
|
|
|
|
|
|
+ else if (this.props.mode === Body.MODE_BUILDING) {
|
|
|
|
+ if (this.props.building) {
|
|
levelsList = this.props.building.properties.own.levels.slice(0);
|
|
levelsList = this.props.building.properties.own.levels.slice(0);
|
|
levelsList.sort();
|
|
levelsList.sort();
|
|
}
|
|
}
|
|
@@ -337,7 +338,7 @@ class MyMap extends Component {
|
|
levelsList = window.vectorDataManager.getAllLevels(false);
|
|
levelsList = window.vectorDataManager.getAllLevels(false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- else if([ Body.MODE_LEVELS, Body.MODE_FEATURES ].includes(this.props.mode) && this.props.building) {
|
|
|
|
|
|
+ else if ([Body.MODE_LEVELS, Body.MODE_FEATURES].includes(this.props.mode) && this.props.building) {
|
|
levelsList = this.props.building.properties.own.levels.slice(0);
|
|
levelsList = this.props.building.properties.own.levels.slice(0);
|
|
levelsList.sort();
|
|
levelsList.sort();
|
|
}
|
|
}
|
|
@@ -364,7 +365,7 @@ class MyMap extends Component {
|
|
<Map
|
|
<Map
|
|
minZoom={MAP_MIN_ZOOM}
|
|
minZoom={MAP_MIN_ZOOM}
|
|
maxZoom={MAP_MAX_ZOOM}
|
|
maxZoom={MAP_MAX_ZOOM}
|
|
- className={"app-map"+(this.props.draw ? " leaflet-clickable" : "")}
|
|
|
|
|
|
+ className={"app-map" + (this.props.draw ? " leaflet-clickable" : "")}
|
|
ref={elem => this.elem = elem}
|
|
ref={elem => this.elem = elem}
|
|
preferCanvas={false}
|
|
preferCanvas={false}
|
|
editable={true}
|
|
editable={true}
|
|
@@ -375,7 +376,8 @@ class MyMap extends Component {
|
|
boxZoom={false}
|
|
boxZoom={false}
|
|
>
|
|
>
|
|
<AttributionControl
|
|
<AttributionControl
|
|
- prefix={window.EDITOR_NAME+" v"+PACKAGE.version}
|
|
|
|
|
|
+ // prefix={window.EDITOR_NAME + " v" + PACKAGE.version}
|
|
|
|
+ prefix={PACKAGE.name + " v" + PACKAGE.version}
|
|
/>
|
|
/>
|
|
|
|
|
|
<ScaleControl
|
|
<ScaleControl
|
|
@@ -387,10 +389,6 @@ class MyMap extends Component {
|
|
position="bottomright"
|
|
position="bottomright"
|
|
/>
|
|
/>
|
|
|
|
|
|
- {/* <SidePanelButton
|
|
|
|
- position="topright"
|
|
|
|
- /> */}
|
|
|
|
-
|
|
|
|
{[Body.MODE_EXPLORE, Body.MODE_BUILDING, Body.MODE_LEVELS, Body.MODE_FEATURES].includes(this.props.mode) && !this.state.loading && this.state.dataready && levelsList &&
|
|
{[Body.MODE_EXPLORE, Body.MODE_BUILDING, Body.MODE_LEVELS, Body.MODE_FEATURES].includes(this.props.mode) && !this.state.loading && this.state.dataready && levelsList &&
|
|
<LevelSelector
|
|
<LevelSelector
|
|
position="topright"
|
|
position="topright"
|
|
@@ -399,10 +397,6 @@ class MyMap extends Component {
|
|
/>
|
|
/>
|
|
}
|
|
}
|
|
|
|
|
|
- {/* <PreviewButton
|
|
|
|
- position="topright"
|
|
|
|
- /> */}
|
|
|
|
-
|
|
|
|
{this.props.selectedBaseImagery && this._getLayer(this.props.selectedBaseImagery, this.props.baseImageryOpacity)}
|
|
{this.props.selectedBaseImagery && this._getLayer(this.props.selectedBaseImagery, this.props.baseImageryOpacity)}
|
|
|
|
|
|
{this.props.selectedOverlaysImagery && this.props.selectedOverlaysImagery.map(ol => this._getLayer(ol, this.props.overlaysImageryOpacity))}
|
|
{this.props.selectedOverlaysImagery && this.props.selectedOverlaysImagery.map(ol => this._getLayer(ol, this.props.overlaysImageryOpacity))}
|
|
@@ -470,57 +464,47 @@ class MyMap extends Component {
|
|
this._loadData();
|
|
this._loadData();
|
|
}, 500);
|
|
}, 500);
|
|
|
|
|
|
- window.mapUUID = this.props.uuid;
|
|
|
|
-
|
|
|
|
- //静态只读map
|
|
|
|
- Object.defineProperty(MyMap, 'map', {
|
|
|
|
- value: this.elem.leafletElement,
|
|
|
|
- writable: false,
|
|
|
|
- enumerable: false,
|
|
|
|
- configurable: false
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
// URL hash for map
|
|
// URL hash for map
|
|
this._mapHash = new L.Hash(this.elem.leafletElement);
|
|
this._mapHash = new L.Hash(this.elem.leafletElement);
|
|
|
|
|
|
// If no valid hash found, use default coordinates from config file or stored cookie
|
|
// If no valid hash found, use default coordinates from config file or stored cookie
|
|
- if(!window.location.hash || !window.location.hash.match(/^#\d+\/-?\d+(.\d+)?\/-?\d+(.\d+)?(\/(-?\d+(.\d+)?)?)?$/)) {
|
|
|
|
|
|
+ if (!window.location.hash || !window.location.hash.match(/^#\d+\/-?\d+(.\d+)?\/-?\d+(.\d+)?(\/(-?\d+(.\d+)?)?)?$/)) {
|
|
// Has cookie ?
|
|
// Has cookie ?
|
|
const cookieHash = document.cookie.replace(/(?:(?:^|.*;\s*)lasthash\s*=\s*([^;]*).*$)|^.*$/, "$1");
|
|
const cookieHash = document.cookie.replace(/(?:(?:^|.*;\s*)lasthash\s*=\s*([^;]*).*$)|^.*$/, "$1");
|
|
let newHash;
|
|
let newHash;
|
|
|
|
|
|
- if(cookieHash && L.Hash.parseHash(cookieHash)) {
|
|
|
|
|
|
+ if (cookieHash && L.Hash.parseHash(cookieHash)) {
|
|
newHash = cookieHash;
|
|
newHash = cookieHash;
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- newHash = "#"+window.CONFIG.map_initial_zoom+"/"+window.CONFIG.map_initial_latlng.join("/");
|
|
|
|
|
|
+ newHash = "#" + window.CONFIG.map_initial_zoom + "/" + window.CONFIG.map_initial_latlng.join("/");
|
|
}
|
|
}
|
|
|
|
|
|
window.history.pushState({}, "", window.location.href.split("#")[0] + newHash);
|
|
window.history.pushState({}, "", window.location.href.split("#")[0] + newHash);
|
|
}
|
|
}
|
|
|
|
|
|
L.DomEvent.addListener(window, "hashchange", () => {
|
|
L.DomEvent.addListener(window, "hashchange", () => {
|
|
- document.cookie = "lasthash="+window.location.hash;
|
|
|
|
|
|
+ document.cookie = "lasthash=" + window.location.hash;
|
|
});
|
|
});
|
|
|
|
|
|
this.elem.leafletElement.on("dblclick", e => {
|
|
this.elem.leafletElement.on("dblclick", e => {
|
|
- if(!this.props.draw && this.props.mode !== Body.MODE_EXPLORE) {
|
|
|
|
|
|
+ if (!this.props.draw && this.props.mode !== Body.MODE_EXPLORE) {
|
|
PubSub.publish("body.unselect.feature");
|
|
PubSub.publish("body.unselect.feature");
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
this.elem.leafletElement.on("zoomend moveend", () => {
|
|
this.elem.leafletElement.on("zoomend moveend", () => {
|
|
- if(this.elem && this.elem.leafletElement) {
|
|
|
|
|
|
+ if (this.elem && this.elem.leafletElement) {
|
|
this._loadData();
|
|
this._loadData();
|
|
|
|
|
|
const zoom = this.elem.leafletElement.getZoom();
|
|
const zoom = this.elem.leafletElement.getZoom();
|
|
|
|
|
|
- if(zoom < window.CONFIG.data_min_zoom && (!this._lastZoom || this._lastZoom >= window.CONFIG.data_min_zoom)) {
|
|
|
|
|
|
+ if (zoom < window.CONFIG.data_min_zoom && (!this._lastZoom || this._lastZoom >= window.CONFIG.data_min_zoom)) {
|
|
this.elem.container.classList.add("app-map-novector");
|
|
this.elem.container.classList.add("app-map-novector");
|
|
PubSub.publishSync("body.unselect.feature");
|
|
PubSub.publishSync("body.unselect.feature");
|
|
-// PubSub.publish("body.mode.set", { mode: Body.MODE_BUILDING });
|
|
|
|
|
|
+ // PubSub.publish("body.mode.set", { mode: Body.MODE_BUILDING });
|
|
}
|
|
}
|
|
- else if(zoom >= window.CONFIG.data_min_zoom && (!this._lastZoom || this._lastZoom < window.CONFIG.data_min_zoom)) {
|
|
|
|
|
|
+ else if (zoom >= window.CONFIG.data_min_zoom && (!this._lastZoom || this._lastZoom < window.CONFIG.data_min_zoom)) {
|
|
this.elem.container.classList.remove("app-map-novector");
|
|
this.elem.container.classList.remove("app-map-novector");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -538,7 +522,7 @@ class MyMap extends Component {
|
|
* @property {int} zoom The new zoom level
|
|
* @property {int} zoom The new zoom level
|
|
*/
|
|
*/
|
|
const alertZoom = () => {
|
|
const alertZoom = () => {
|
|
- if(this.elem && this.elem.leafletElement) {
|
|
|
|
|
|
+ if (this.elem && this.elem.leafletElement) {
|
|
PubSub.publish("map.zoom.changed", { zoom: this.elem.leafletElement.getZoom() });
|
|
PubSub.publish("map.zoom.changed", { zoom: this.elem.leafletElement.getZoom() });
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -553,11 +537,11 @@ class MyMap extends Component {
|
|
* @property {int} [zoom] The zoom level
|
|
* @property {int} [zoom] The zoom level
|
|
*/
|
|
*/
|
|
PubSub.subscribe("map.position.set", (msg, data) => {
|
|
PubSub.subscribe("map.position.set", (msg, data) => {
|
|
- if(data.bbox) {
|
|
|
|
|
|
+ if (data.bbox) {
|
|
const [minlat, maxlat, minlon, maxlon] = data.bbox;
|
|
const [minlat, maxlat, minlon, maxlon] = data.bbox;
|
|
this.elem.leafletElement.fitBounds([[minlat, minlon], [maxlat, maxlon]]);
|
|
this.elem.leafletElement.fitBounds([[minlat, minlon], [maxlat, maxlon]]);
|
|
}
|
|
}
|
|
- else if(data.zoom) {
|
|
|
|
|
|
+ else if (data.zoom) {
|
|
this.elem.leafletElement.setView(data.coordinates, data.zoom);
|
|
this.elem.leafletElement.setView(data.coordinates, data.zoom);
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
@@ -574,20 +558,20 @@ class MyMap extends Component {
|
|
}
|
|
}
|
|
|
|
|
|
componentDidUpdate(fromProps) {
|
|
componentDidUpdate(fromProps) {
|
|
- if(this.props.level !== fromProps.level) {
|
|
|
|
|
|
+ if (this.props.level !== fromProps.level) {
|
|
this._mapHash.setLevel(this.props.level);
|
|
this._mapHash.setLevel(this.props.level);
|
|
}
|
|
}
|
|
|
|
|
|
const floorImgs = window.imageryManager.getFloorImages();
|
|
const floorImgs = window.imageryManager.getFloorImages();
|
|
|
|
|
|
// Force update of floor imagery after mode change
|
|
// Force update of floor imagery after mode change
|
|
- if(fromProps.mode !== this.props.mode) {
|
|
|
|
|
|
+ if (fromProps.mode !== this.props.mode) {
|
|
this.invalidateSize();
|
|
this.invalidateSize();
|
|
|
|
|
|
floorImgs.forEach(img => {
|
|
floorImgs.forEach(img => {
|
|
// Check if we have a leaflet layer
|
|
// Check if we have a leaflet layer
|
|
- if(this.refs["floormap_"+img.id]) {
|
|
|
|
- this.refs["floormap_"+img.id].forceUpdate();
|
|
|
|
|
|
+ if (this.refs["floormap_" + img.id]) {
|
|
|
|
+ this.refs["floormap_" + img.id].forceUpdate();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -597,8 +581,8 @@ class MyMap extends Component {
|
|
this.elem.leafletElement.on("mousemove", this._followMouse, this);
|
|
this.elem.leafletElement.on("mousemove", this._followMouse, this);
|
|
|
|
|
|
// Load wider area if necessary
|
|
// Load wider area if necessary
|
|
- if(!this.props.draw && !this.state.loading && this.elem.leafletElement.getZoom() > 19) {
|
|
|
|
- this._loadData(this.getBounds().pad(0.5*(this.elem.leafletElement.getZoom()-19)));
|
|
|
|
|
|
+ if (!this.props.draw && !this.state.loading && this.elem.leafletElement.getZoom() > 19) {
|
|
|
|
+ this._loadData(this.getBounds().pad(0.5 * (this.elem.leafletElement.getZoom() - 19)));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|