|
@@ -8,6 +8,8 @@ import PresetsManager from '../ctrl/PresetsManager';
|
|
|
import PubSub from 'pubsub-js';
|
|
|
import VectorDataManager from '../ctrl/VectorDataManager';
|
|
|
import LocationCard from './common/LocationCard';
|
|
|
+import { LatLng } from 'leaflet';
|
|
|
+import MapUtil from './utils/MapUtil';
|
|
|
// import request from 'request-promise-native';
|
|
|
|
|
|
|
|
@@ -20,6 +22,19 @@ export default class App {
|
|
|
this.el = params.el
|
|
|
this.id = params.id
|
|
|
this.url = params.url
|
|
|
+ if(params.center){
|
|
|
+ this.center = new LatLng(params.center[0], params.center[1])
|
|
|
+ }else{
|
|
|
+ this.center = new LatLng(0, 0)
|
|
|
+ }
|
|
|
+
|
|
|
+ //静态只读m
|
|
|
+ Object.defineProperty(App, 'center', {
|
|
|
+ value: this.center,
|
|
|
+ writable: false,
|
|
|
+ enumerable: false,
|
|
|
+ configurable: false
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
init() {
|
|
@@ -48,7 +63,7 @@ export default class App {
|
|
|
* @private
|
|
|
*/
|
|
|
_initView() {
|
|
|
- ReactDOM.render(<Body uuid={this.id} />, document.getElementById(this.el));
|
|
|
+ ReactDOM.render(<Body uuid={this.id} center={this.center}/>, document.getElementById(this.el));
|
|
|
document.title = window.EDITOR_NAME;
|
|
|
|
|
|
// Disabling context menu
|