|
|
@ -25,6 +25,7 @@ export class EditorAction { |
|
|
|
mapEditor: IMapEditor | null = null; |
|
|
|
mapEditor: IMapEditor | null = null; |
|
|
|
store: IStore; |
|
|
|
store: IStore; |
|
|
|
id: string; |
|
|
|
id: string; |
|
|
|
|
|
|
|
autoSaveTimer: number = -1; |
|
|
|
|
|
|
|
|
|
|
|
constructor(store: IStore) { |
|
|
|
constructor(store: IStore) { |
|
|
|
this.store = store; |
|
|
|
this.store = store; |
|
|
@ -60,9 +61,7 @@ export class EditorAction { |
|
|
|
this._openProject(JSON.parse(cached)); |
|
|
|
this._openProject(JSON.parse(cached)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
setInterval(() => { |
|
|
|
this.autoSaveTimer = setTimeout(() => this.saveTemp(), AutoCacheInterval); |
|
|
|
this.saveTemp(); |
|
|
|
|
|
|
|
}, AutoCacheInterval); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ---------- public methods -------------
|
|
|
|
// ---------- public methods -------------
|
|
|
@ -125,8 +124,10 @@ export class EditorAction { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async saveTemp() { |
|
|
|
async saveTemp() { |
|
|
|
|
|
|
|
clearTimeout(this.autoSaveTimer); |
|
|
|
await setItem(this.id, JSON.stringify(this._getMapOptions())); |
|
|
|
await setItem(this.id, JSON.stringify(this._getMapOptions())); |
|
|
|
message.success("暂存成功~"); |
|
|
|
message.success("暂存成功~"); |
|
|
|
|
|
|
|
this.autoSaveTimer = setTimeout(() => this.saveTemp(), AutoCacheInterval); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
clearOverlays() { |
|
|
|
clearOverlays() { |
|
|
@ -209,6 +210,7 @@ export class EditorAction { |
|
|
|
|
|
|
|
|
|
|
|
private _bindActions() { |
|
|
|
private _bindActions() { |
|
|
|
this.saveGeoJSON = this.saveGeoJSON.bind(this); |
|
|
|
this.saveGeoJSON = this.saveGeoJSON.bind(this); |
|
|
|
|
|
|
|
this.saveTemp = this.saveTemp.bind(this); |
|
|
|
this.saveProject = this.saveProject.bind(this); |
|
|
|
this.saveProject = this.saveProject.bind(this); |
|
|
|
this.openGeoJSON = this.openGeoJSON.bind(this); |
|
|
|
this.openGeoJSON = this.openGeoJSON.bind(this); |
|
|
|
this.openProject = this.openProject.bind(this); |
|
|
|
this.openProject = this.openProject.bind(this); |
|
|
|