added loader

This commit is contained in:
muerwre 2018-08-29 14:11:44 +07:00
parent f7e8da1f1f
commit b35a063cd7
3 changed files with 28 additions and 6 deletions

View file

@ -31,7 +31,17 @@ export class App extends React.Component {
mapInit = () => {
const path = getPath();
if (path) getStoredMap({ name: path, callback: this.editor.setData });
if (path) getStoredMap({ name: path, callback: this.setDataOnLoad });
};
setDataOnLoad = data => {
this.editor.setData(data);
this.hideLoader();
};
hideLoader = () => {
document.getElementById('loader').style.opacity = 0;
document.getElementById('loader').style.pointerEvents = 'none';
};
setMode = mode => {
@ -101,9 +111,7 @@ export class App extends React.Component {
storeData('user', this.state.user);
};
getUserData = () => {
return getData('user') || null;
};
getUserData = () => getData('user') || null;
userLogout = () => {
this.setState({

View file

@ -9,9 +9,21 @@
<link rel="shortcut icon" href="/favicon.png?wd" type="image/png">
<meta property="og:image" content="/misc/vk_preview.png" />
<meta content="/misc/vk_preview.png">
<style>
#loader {
position: fixed;
background: #576066;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 10;
transition: opacity 1s;
}
</style>
</head>
<body>
<section id="loader"></section>
<section id="index"></section>
<div id="map" />
<section id="map"></section>
</body>

View file

@ -127,6 +127,8 @@ export class Poly {
setPoints = latlngs => {
if (!latlngs || latlngs.length <= 1) return;
this.poly.setLatLngs(latlngs);
this.updateMarks();
};
pushPoints = latlngs => {