ADD: the api call to create a new Entity
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
|
||||
// import { useMapEvents } from 'react-leaflet/hooks'
|
||||
import React, { Component } from "react";
|
||||
import { MapContainer, TileLayer,Marker, Popup, Tooltip } from 'react-leaflet'
|
||||
import { MapContainer, TileLayer,Marker, Popup, Tooltip,useMapEvents } from 'react-leaflet'
|
||||
import { friend,Hostile, iconShip,createIcon } from "./icon";
|
||||
import "./OpenSeaMap.scss";
|
||||
import {w3cwebsocket as W3CWebSocket} from "websocket";
|
||||
@@ -11,7 +11,7 @@ import ContainerDimensions from 'react-container-dimensions';
|
||||
class OpenSeaMap extends Component {
|
||||
|
||||
state = {
|
||||
EntityOnFocus: undefined
|
||||
EntityOnFocus: undefined,
|
||||
}
|
||||
updateDimensions() {
|
||||
const height = window.innerWidth >= 992 ? window.innerHeight : 400
|
||||
@@ -36,9 +36,13 @@ class OpenSeaMap extends Component {
|
||||
handleClick(e)
|
||||
{
|
||||
// console.log(e.target)
|
||||
// this.setState({ currentPos: e.latlng });
|
||||
console.log(e.latlng);
|
||||
|
||||
console.log("hello world");
|
||||
}
|
||||
|
||||
|
||||
// MarkerEventHandler = useMemo(
|
||||
// (e) => ({
|
||||
// dragend() {
|
||||
@@ -115,7 +119,24 @@ class OpenSeaMap extends Component {
|
||||
);
|
||||
}
|
||||
|
||||
setPos(props)
|
||||
{
|
||||
console.log(props);
|
||||
|
||||
this.props.setFocusPosition([1,2])
|
||||
}
|
||||
|
||||
render() {
|
||||
const LocationFinderDummy = (props) => {
|
||||
const map = useMapEvents({
|
||||
click(e) {
|
||||
|
||||
props.props.setFocusPosition(e.latlng)
|
||||
// console.log(e.latlng);
|
||||
},
|
||||
});
|
||||
return null;
|
||||
};
|
||||
// const positions = this.props.Positions.map((pos, index) => (
|
||||
// <Marker name={"test"} key={index} position={pos.position} icon= {ship} />
|
||||
// ));
|
||||
@@ -123,6 +144,8 @@ class OpenSeaMap extends Component {
|
||||
return (
|
||||
<div className='map' style={{ height: this.state.height }} >
|
||||
<MapContainer MapContainer center={[54, 11]} zoom={6} scrollWheelZoom={true}>
|
||||
<LocationFinderDummy props ={this.props} />
|
||||
|
||||
<TileLayer
|
||||
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" />
|
||||
<TileLayer
|
||||
|
||||
Reference in New Issue
Block a user