Skip to content

Commit

Permalink
feat(docs): add polygone docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Dongkyuuuu committed Sep 29, 2021
1 parent 772c880 commit c537240
Show file tree
Hide file tree
Showing 5 changed files with 242 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/.vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ const config = {
text: "Rectangle",
link: "/guide/Rectangle",
},
{
text: "Polygon",
link: "/guide/Polygon",
},
],
},
{
Expand Down
3 changes: 2 additions & 1 deletion docs/.vitepress/theme/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import NaverInfoWindow from "../../example/InfoWindow.vue";
import NaverCircle from "../../example/Circle.vue";
import NaverEllipse from "../../example/Ellipse.vue";
import NaverRectangle from "../../example/Rectangle.vue";
import NaverPolygon from "../../example/Polygon.vue";

export default {
...theme,
Expand All @@ -15,6 +16,6 @@ export default {
app.component("naver-info-window", NaverInfoWindow);
app.component("naver-circle", NaverCircle);
app.component("naver-ellipse", NaverEllipse);
app.component("naver-rectangle", NaverRectangle);
app.component("naver-polygon", NaverPolygon);
},
};
73 changes: 73 additions & 0 deletions docs/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,3 +338,76 @@ const bounds = {
- **선택**
- **λ°˜ν™˜νƒ€μž…:** `naver.maps.Rectangle`
- **상세:**
-

## NaverPolygon

폴리곀 μ»΄ν¬λ„ŒνŠΈμ—μ„œ μ‚¬μš©λ˜λŠ” Props μž…λ‹ˆλ‹€.

### paths

- **ν•„μˆ˜**
- **νƒ€μž…:** `naver.maps.ArrayOfCoords`| `naver.maps.KVOArrayOfCoords` | `naver.maps ArrayOfCoordsLiteral`
- **상세:**

μ—°κ²° 될 각 μ’Œν‘œλ“€μ„ μ„€μ •ν•©λ‹ˆλ‹€.

```js
// naver.maps.ArrayOfCoords νƒ€μž…
const paths = [
new naver.maps.LatLng(38, 127),
new naver.maps.LatLng(39, 128),
new naver.maps.LatLng(39, 128),
];
```

```js
// naver.maps.KVOArrayOfCoords νƒ€μž…
const paths = [
{
south: 37.566616443521745,
north: 38.566616443521745,
west: 126.97837068565364,
east: 127.97837068565364,
},
{
south: 37.566616443521745,
north: 38.566616443521745,
west: 126.97837068565364,
east: 127.97837068565364,
},
];
```

```js
// naver.maps ArrayOfCoordsLiteral νƒ€μž…
const paths = [
[126.9797895, 37.5670131],
[126.979215, 37.5649555],
[126.9766789, 37.5649082],
[126.9789515, 37.5637645],
[126.9785598, 37.5614914],
[126.9804949, 37.5632666],
[126.9827689, 37.5619065],
[126.9818039, 37.5639213],
[126.9837414, 37.5653719],
[126.9811162, 37.5651081],
];
```

μœ„μ™€ 같은 예제둜 pathsλ₯Ό 지정할 수 μžˆμŠ΅λ‹ˆλ‹€.

### options

- **선택**
- **νƒ€μž…:** `naver.maps.PolygonOptions`
- **κΈ°λ³Έκ°’:** `{}`
- **상세:**

폴리곀 μ»΄ν¬λ„ŒνŠΈμ—μ„œ μ‚¬μš© κ°€λŠ₯ν•œ 좔가적인 μ˜΅μ…˜μ„ μž…λ ₯ν•©λ‹ˆλ‹€.

### @onLoad

- **선택**
- **λ°˜ν™˜νƒ€μž…:** `naver.maps.Polygon`
- **상세:**
66 changes: 66 additions & 0 deletions docs/example/Polygon.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<template>
<naver-maps
width="100%"
height="400px"
:mapOptions="mapOptions"
:initLayers="initLayers"
@onLoad="onLoadMap($event)"
>
<naver-polygon :paths="paths" @onLoad="onLoadPolygon($event)" />
</naver-maps>
</template>

<script>
import { ref } from "vue";
import { NaverMaps, NaverPolygon } from "../../dist/vue3-naver-maps";
export default {
components: { NaverMaps, NaverPolygon },
setup: () => {
const map = ref();
const polygon = ref();
const paths = ref([
[126.9797895, 37.5670131],
[126.979215, 37.5649555],
[126.9766789, 37.5649082],
[126.9789515, 37.5637645],
[126.9785598, 37.5614914],
[126.9804949, 37.5632666],
[126.9827689, 37.5619065],
[126.9818039, 37.5639213],
[126.9837414, 37.5653719],
[126.9811162, 37.5651081],
]);
const mapOptions = {
latitude: 37.56663888630603, // 지도 쀑앙 μœ„λ„
longitude: 126.97838310403904, // 지도 쀑앙 경도
zoom: 15,
zoomControl: false,
zoomControlOptions: { position: "TOP_RIGHT" },
};
const initLayers = [
"BACKGROUND",
"BACKGROUND_DETAIL",
"POI_KOREAN",
"TRANSIT",
"ENGLISH",
];
const onLoadMap = (mapObject) => {
map.value = mapObject;
};
const onLoadPolygon = (polygonObject) => {
polygon.value = polygonObject;
};
return {
map,
mapOptions,
initLayers,
onLoadMap,
onLoadPolygon,
paths,
};
},
};
</script>
97 changes: 97 additions & 0 deletions docs/guide/Polygon.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Polygon

`NaverPolygon`λŠ” 폴리곀을 μƒμ„±ν•˜λŠ” μ»΄ν¬λ„ŒνŠΈ μž…λ‹ˆλ‹€. `NaverMaps` 생성 이후에 μ‚¬μš© κ°€λŠ₯ν•©λ‹ˆλ‹€.

## μ˜ˆμ‹œ

\
<naver-polygon />

```vue
<template>
<naver-maps
width="100%"
height="400px"
:mapOptions="mapOptions"
:initLayers="initLayers"
@onLoad="onLoadMap($event)"
>
<naver-polygon :paths="paths" @onLoad="onLoadPolygon($event)" />
</naver-maps>
</template>
<script>
import { ref } from "vue";
import { NaverMaps, NaverPolygon } from "../../dist/vue3-naver-maps";
export default {
components: { NaverMaps, NaverPolygon },
setup: () => {
const map = ref();
const polygon = ref();
const paths = ref([
[126.9797895, 37.5670131],
[126.979215, 37.5649555],
[126.9766789, 37.5649082],
[126.9789515, 37.5637645],
[126.9785598, 37.5614914],
[126.9804949, 37.5632666],
[126.9827689, 37.5619065],
[126.9818039, 37.5639213],
[126.9837414, 37.5653719],
[126.9811162, 37.5651081],
]);
const mapOptions = {
latitude: 37.56663888630603, // 지도 쀑앙 μœ„λ„
longitude: 126.97838310403904, // 지도 쀑앙 경도
zoom: 15,
zoomControl: false,
zoomControlOptions: { position: "TOP_RIGHT" },
};
const initLayers = [
"BACKGROUND",
"BACKGROUND_DETAIL",
"POI_KOREAN",
"TRANSIT",
"ENGLISH",
];
const onLoadMap = (mapObject) => {
map.value = mapObject;
};
const onLoadPolygon = (polygonObject) => {
polygon.value = polygonObject;
};
return {
map,
mapOptions,
initLayers,
onLoadMap,
onLoadPolygon,
paths,
};
},
};
</script>
```

μžμ„Έν•œ Props, Emit μ˜΅μ…˜μ€ [NaverPolygon](../api/#naverpolygon)μ—μ„œ 확인 κ°€λŠ₯ν•©λ‹ˆλ‹€.

## μ„€μ •

`paths`λŠ” ν•„μˆ˜μ μœΌλ‘œ μž…λ ₯ν•΄ μ£Όμ…”μ•Ό ν•©λ‹ˆλ‹€. μ—°κ²°ν•  각 μ’Œν‘œλ₯Ό 의미 ν•©λ‹ˆλ‹€.

## UI 이벀트

μ΄λ²€νŠΈμ— λŒ€ν•œ μžμ„Έν•œ μ„€λͺ…은 [이벀트 상세섀λͺ…](https://navermaps.github.io/maps.js.ncp/docs/naver.maps.Polygon.html#toc28__anchor)μ—μ„œ 확인 κ°€λŠ₯ν•©λ‹ˆλ‹€.

- click
- clickable_changed
- dblclick
- mousedown
- mouseout
- mouseover
- mouseup
- visible_changed
- zIndex_changed

0 comments on commit c537240

Please sign in to comment.