Closed codejet closed 3 years ago
@codejet hi! Make sure that you add "geoObject.addon.editor"
to modules
:
import "./styles.css";
import { YMaps, Map, Polygon } from "react-yandex-maps";
export default function App() {
const mapState = {
center: [30, 50],
zoom: 4
};
const polygonCoords = [
[
[30, 40],
[30, 50],
[40, 50],
[40, 40],
[30, 40]
]
];
return (
<div className="App">
<YMaps>
<Map state={mapState}>
<Polygon
modules={["geoObject.addon.editor"]}
geometry={polygonCoords}
instanceRef={(ref) => ref.editor.startFraming()}
/>
</Map>
</YMaps>
</div>
);
}
Thanks a lot, @mmarkelov, that worked!
Hi,
in issue 122 (https://github.com/gribnoysup/react-yandex-maps/issues/122) I saw that you mentioned an
editor
property on theinstanceRef
which has a method namedstartFraming
. But when I access theinstanceRef
of my geo object (currently a circle) in my code, it doesn't have aneditor
property. Did something in your library change or is this an issue on my end?Relevant snippet from my code:
When adding
myCircle.editor.startFraming();
in the example in https://yandex.ru/dev/maps/jsbox/2.1/circle/, I get the expected result.Thanks! Oliver