// @flow import React from "react"; import { Map, ImageOverlay, Marker, LayersControl } from "react-leaflet"; import Leaflet from "leaflet"; import R from "ramda"; import Config from "./config"; import { Actions } from "./state"; import { store } from "./state"; // convert width/height coordinates to -height/width coordinates const c = (p) => [-p[1], p[0]]; const color = (iconColor, state: State) => { // TODO: give iconColor not only internal but also actual values return iconColor == null ? "#000000" : iconColor( R.map((x) => (x.internal == null ? x.actual : x.internal), state.values == null ? {} : state.values) ); }; const iconHtml = (el, state: State) => "" + ""; const Markers = (props) => R.values(R.mapObjIndexed((el, key) => ( store.dispatch({ type: Actions.CHANGE_UI, payload: key, toggle: e.originalEvent.ctrlKey})}> ), R.propOr({}, "controls", Config))); type SpaceMapProps = { state: State, width: number, height: number, zoom: number, image: string }; class SpaceMap extends React.Component { constructor(props: SpaceMapProps) { super(props); } render() { const props = this.props; return ( {Markers(props)} {Config.layers.map((x) => this.renderLayer(x, [c([0, 0]), c([props.width, props.height])]))} ); } renderLayer(layer, bounds) { const LayersControlType = layer.baseLayer ? LayersControl.BaseLayer : LayersControl.Overlay; return ( ); } } export default SpaceMap;