@h4wldev/react-naver-maps
Version:
React Navermaps API integration for modern development.
58 lines (56 loc) • 1.4 kB
JavaScript
import {
omitUndefined
} from "./chunk-SOBCLIXD.mjs";
import {
useNavermaps
} from "./chunk-VVUNPVHD.mjs";
import {
HandleEvents
} from "./chunk-D77WM3Z3.mjs";
import {
Overlay
} from "./chunk-P2HFB547.mjs";
// src/overlays/polygon.tsx
import pick from "lodash.pick";
import { forwardRef, useEffect, useImperativeHandle, useState } from "react";
import { jsx } from "react/jsx-runtime";
var kvoKeys = [
"paths",
"strokeWeight",
"strokeOpacity",
"strokeColor",
"strokeStyle",
"strokeLineCap",
"strokeLineJoin",
"fillColor",
"fillOpacity",
"clickable",
"visible",
"zIndex"
];
var kvoEvents = kvoKeys.map((key) => `${key}_changed`);
var uiEvents = [
"mousedown",
"mouseup",
"click",
"dblclick",
"rightclick",
"mouseover",
"mouseout",
"mousemove"
];
var events = [...uiEvents, ...kvoEvents];
var Polygon = forwardRef(function Polygon2(props, ref) {
const options = pick(props, [...kvoKeys]);
const navermaps = useNavermaps();
const [polygon] = useState(() => new navermaps.Polygon(options));
useImperativeHandle(ref, () => polygon);
useEffect(() => {
polygon.setOptions(omitUndefined(options));
}, kvoKeys.map((key) => options[key]));
return /* @__PURE__ */ jsx(Overlay, { element: polygon, children: /* @__PURE__ */ jsx(HandleEvents, { events, listeners: props }) });
});
export {
Polygon
};
//# sourceMappingURL=chunk-OFQ2ANDZ.mjs.map