Skip to content

Commit 470d465

Browse files
committed
docs(ol-control-bar): add documentation
1 parent 23ff80c commit 470d465

File tree

5 files changed

+120
-4
lines changed

5 files changed

+120
-4
lines changed

docs/.vitepress/config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,10 @@ export default defineConfig({
333333
text: "Map Controls",
334334
collapsed: true,
335335
items: [
336+
{
337+
text: "ol-control-bar",
338+
link: "/componentsguide/mapcontrols/controlbar/",
339+
},
336340
{
337341
text: "ol-attribution-control",
338342
link: "/componentsguide/mapcontrols/attribution/",
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# ol-control-bar
2+
3+
> A group of controls
4+
5+
<script setup>
6+
import ControlBarDemo from "@demos/ControlBarDemo.vue"
7+
</script>
8+
<ClientOnly>
9+
<ControlBarDemo />
10+
</ClientOnly>
11+
12+
## Usage
13+
14+
::: code-group
15+
16+
<<< ../../../../src/demos/ControlBarDemo.vue
17+
18+
:::
19+
20+
## Properties

docs/public/sitemap.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,11 @@
307307
<lastmod>2021-08-15T21:05:05+00:00</lastmod>
308308
<priority>0.80</priority>
309309
</url>
310+
<url>
311+
<loc>https://vue3openlayers.netlify.app/componentsguide/mapcontrols/controlbar/</loc>
312+
<lastmod>2023-09-19T23:00:00+00:00</lastmod>
313+
<priority>0.80</priority>
314+
</url>
310315
<url>
311316
<loc>https://vue3openlayers.netlify.app/componentsguide/mapcontrols/contextmenu/</loc>
312317
<lastmod>2021-08-15T21:05:05+00:00</lastmod>

src/demos/AppDemo.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,25 +42,25 @@
4242

4343
<ol-control-bar>
4444
<ol-toggle-control
45-
html="<i class='fas fa-map-marker'></i>"
45+
html="🔘"
4646
className="edit"
4747
title="Point"
4848
:onToggle="(active) => changeDrawType(active, 'Point')"
4949
/>
5050
<ol-toggle-control
51-
html="<i class='fas fa-draw-polygon'></i>"
51+
html="🔹"
5252
className="edit"
5353
title="Polygon"
5454
:onToggle="(active) => changeDrawType(active, 'Polygon')"
5555
/>
5656
<ol-toggle-control
57-
html="<i class='fas fa-circle'></i>"
57+
html="🟢"
5858
className="edit"
5959
title="Circle"
6060
:onToggle="(active) => changeDrawType(active, 'Circle')"
6161
/>
6262
<ol-toggle-control
63-
html="<i class='fas fa-grip-lines'></i>"
63+
html="〰️"
6464
className="edit"
6565
title="LineString"
6666
:onToggle="(active) => changeDrawType(active, 'LineString')"

src/demos/ControlBarDemo.vue

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<template>
2+
<ol-map
3+
ref="map"
4+
:loadTilesWhileAnimating="true"
5+
:loadTilesWhileInteracting="true"
6+
style="height: 800px"
7+
>
8+
<ol-view
9+
ref="view"
10+
:center="center"
11+
:rotation="rotation"
12+
:zoom="zoom"
13+
:projection="projection"
14+
/>
15+
<ol-tile-layer ref="osmLayer" title="OSM">
16+
<ol-source-osm />
17+
</ol-tile-layer>
18+
19+
<ol-control-bar>
20+
<ol-toggle-control
21+
html="🔘"
22+
className="edit"
23+
title="Point"
24+
:onToggle="(active) => changeDrawType(active, 'Point')"
25+
/>
26+
<ol-toggle-control
27+
html="🔹"
28+
className="edit"
29+
title="Polygon"
30+
:onToggle="(active) => changeDrawType(active, 'Polygon')"
31+
/>
32+
<ol-toggle-control
33+
html="🟢"
34+
className="edit"
35+
title="Circle"
36+
:onToggle="(active) => changeDrawType(active, 'Circle')"
37+
/>
38+
<ol-toggle-control
39+
html="〰️"
40+
className="edit"
41+
title="LineString"
42+
:onToggle="(active) => changeDrawType(active, 'LineString')"
43+
/>
44+
<ol-videorecorder-control @stop="videoStopped" />
45+
<ol-printdialog-control />
46+
</ol-control-bar>
47+
48+
<ol-interaction-draw
49+
:type="drawType"
50+
@drawend="drawend"
51+
@drawstart="drawstart"
52+
>
53+
</ol-interaction-draw>
54+
</ol-map>
55+
</template>
56+
57+
<script setup>
58+
import { ref } from "vue";
59+
60+
const center = ref([34, 39.13]);
61+
const projection = ref("EPSG:4326");
62+
const zoom = ref(6);
63+
const rotation = ref(0);
64+
const view = ref(null);
65+
66+
const drawEnable = ref(false);
67+
const drawType = ref("Point");
68+
69+
const changeDrawType = (active, draw) => {
70+
drawEnable.value = active;
71+
drawType.value = draw;
72+
};
73+
74+
const drawstart = (event) => {
75+
console.log(event);
76+
};
77+
78+
const drawend = (event) => {
79+
console.log(event);
80+
};
81+
82+
const videoStopped = (event) => {
83+
console.log(event);
84+
};
85+
86+
const osmLayer = ref(null);
87+
</script>

0 commit comments

Comments
 (0)