Closed YummyTi closed 2 years ago
@YummyTi hey. Sorry, I just don't know if the Ruler or map can handle this action. If you have working example with yandex maps api, could you send it? I tried something like this, but it's not quite right:
import React, { useRef } from "react";
import ReactDOM from "react-dom";
import { YMaps, Map, RulerControl } from "react-yandex-maps";
import "./styles.css";
function App() {
const map = useRef(null);
return (
<div className="App">
<YMaps>
<Map
onMouseUp={(e) =>
console.log(
map.current.behaviors.get("ruler").geometry.getCoordinates()
)
}
defaultState={{
center: [55.751574, 37.573856],
zoom: 9
}}
instanceRef={map}
>
<RulerControl options={{ float: "right" }} />
</Map>
</YMaps>
</div>
);
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
How can I get RulerControl selected locations latatiude and longitude after selections?