stickers with ability to drag them

This commit is contained in:
Fedor Katurov 2018-08-15 16:18:49 +07:00
parent 5f30df6f48
commit b8434c32e7
19 changed files with 460 additions and 39 deletions

View file

@ -1,16 +1,50 @@
import React from 'react';
import { Map } from '$modules/map';
import { MapScreen } from "$styles/mapScreen";
import { Editor } from '$modules/Editor';
import { MapScreen } from '$styles/mapScreen';
import { ControlsScreen } from '$styles/controlsScreen';
import { MODES } from '$constants/modes';
export class App extends React.Component {
state = {
mode: 'none',
};
componentDidMount() {
this.map = new Map('map');
const container = 'map';
const { mode } = this.state;
this.editor = new Editor({
container,
mode,
setMode: this.setMode,
});
}
setMode = mode => {
this.setState({ mode });
};
startPolyMode = () => this.editor.changeMode(MODES.POLY);
startStickerMode = () => this.editor.changeMode(MODES.STICKERS);
render() {
const { mode } = this.state;
return (
<MapScreen />
<div>
<MapScreen />
<ControlsScreen>
<button onClick={this.startPolyMode}>
{mode === MODES.POLY && '-->'}{MODES.POLY}
</button>
<button onClick={this.startStickerMode}>
{mode === MODES.STICKERS && '-->'}{MODES.STICKERS}
</button>
</ControlsScreen>
</div>
);
}
};
}