// import { useMapEvents } from 'react-leaflet/hooks'
import React, { Component } from "react";
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";
import ContainerDimensions from 'react-container-dimensions';
class OpenSeaMap extends Component {
state = {
EntityOnFocus: undefined,
}
updateDimensions() {
const height = window.innerWidth >= 992 ? window.innerHeight : 400
this.setState({ height: height })
}
componentWillMount() {
this.updateDimensions()
}
componentDidMount() {
window.addEventListener("resize", this.updateDimensions.bind(this))
}
componentWillUnmount() {
window.removeEventListener("resize", this.updateDimensions.bind(this))
}
handleClick(e)
{
// console.log(e.target)
// this.setState({ currentPos: e.latlng });
console.log(e.latlng);
console.log("hello world");
}
// MarkerEventHandler = useMemo(
// (e) => ({
// dragend() {
// // const marker = markerRef.current
// // if (marker != null) {
// // // setPosition(marker.getLatLng())
// // }
// console.log(e)
// },
// click: (e) =>
// {
// this.props.setEntityOnFocus(e.target.options.data);
// }
// }),
// [],
// )
makeIcon(index, entity)
{
var icon;
icon = createIcon(entity.Type,entity.Side)
return (