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 = () => { mapInit = () => {
const path = getPath(); 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 => { setMode = mode => {
@ -101,9 +111,7 @@ export class App extends React.Component {
storeData('user', this.state.user); storeData('user', this.state.user);
}; };
getUserData = () => { getUserData = () => getData('user') || null;
return getData('user') || null;
};
userLogout = () => { userLogout = () => {
this.setState({ this.setState({

View file

@ -9,9 +9,21 @@
<link rel="shortcut icon" href="/favicon.png?wd" type="image/png"> <link rel="shortcut icon" href="/favicon.png?wd" type="image/png">
<meta property="og:image" content="/misc/vk_preview.png" /> <meta property="og:image" content="/misc/vk_preview.png" />
<meta 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> </head>
<body> <body>
<section id="loader"></section>
<section id="index"></section> <section id="index"></section>
<div id="map" /> <section id="map"></section>
</body> </body>

View file

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