Skip to content

Commit

Permalink
fix(demo): use correct component names for controls
Browse files Browse the repository at this point in the history
  • Loading branch information
d-koppenhagen committed Jun 13, 2023
1 parent 56a1601 commit 5622d23
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 25 deletions.
2 changes: 1 addition & 1 deletion docs/componentsguide/mapcontrols/contextmenu/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ol-context-menu
# ol-context-menu-control

> A contextmenu extension for OpenLayers.
Expand Down
80 changes: 68 additions & 12 deletions docs/componentsguide/mapcontrols/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ aside: false

# Map Controls

A control is a visible widget with a DOM element in a fixed position on the screen. They can involve user input (buttons), or be informational only; the position is determined using CSS. By default these are placed in the container with CSS class name ol-overlaycontainer-stopevent, but can use any outside DOM element.
A control is a visible widget with a DOM element in a fixed position on the screen.
They can involve user input (buttons), or be informational only;
the position is determined using CSS.
By default these are placed in the container with CSS class name ol-overlaycontainer-stopevent, but can use any outside DOM element.

<script setup>
import MapControlDemo from "@demos/MapControlDemo.vue"
Expand All @@ -15,17 +18,7 @@ import MapControlDemo from "@demos/MapControlDemo.vue"

## Control List

- `ol-attribution-control`
- `ol-context-menu`
- `ol-fullscreen-control`
- `ol-mouseposition-control`
- `ol-overviewmap-control`
- `ol-rotate-control`
- `ol-scaleline-control`
- `ol-swipe-control`
- `ol-zoom-control`
- `ol-zoomslider-control`
- `ol-zoomtoextent-control`
See menu items on the left.

## Usage

Expand Down Expand Up @@ -81,6 +74,43 @@ import MapControlDemo from "@demos/MapControlDemo.vue"
<input type="checkbox" id="swipecontrol" v-model="showSwipeControl" />
<label for="swipecontrol">swipe-control</label>
</li>
<li>
<input
type="checkbox"
id="layerswitchercontrol"
v-model="showLayerSwitcherControl"
/>
<label for="layerswitchercontrol">layerswitcher-control</label>
</li>
<li>
<input
type="checkbox"
id="layerswitcherimagecontrol"
v-model="showLayerSwitcherImageControl"
/>
<label for="layerswitcherimagecontrol">layerswitcherimage-control</label>
</li>
<li>
<input
type="checkbox"
id="printdialogcontrol"
v-model="showPrintDialogControl"
/>
<label for="printdialogcontrol">printdialog-control</label>
</li>
<li>
<input type="checkbox" id="togglecontrol" v-model="showToggleControl" />
<label for="togglecontrol">toggle-control</label>
</li>
<li>
<input
type="checkbox"
id="videorecordercontrol"
v-model="showVideoRecorderControl"
/>
<label for="videorecordercontrol">videorecorder-control</label>
</li>
</ul>
<ol-map
Expand Down Expand Up @@ -123,6 +153,23 @@ import MapControlDemo from "@demos/MapControlDemo.vue"
:layerList="layerList"
/>
<ol-layerswitcher-control
v-if="showLayerSwitcherControl && layerList.length > 0"
/>
<ol-layerswitcherimage-control
v-if="showLayerSwitcherImageControl && layerList.length > 0"
/>
<ol-printdialog-control v-if="showPrintDialogControl" />
<ol-toggle-control v-if="showToggleControl" />
<ol-videorecorder-control
v-if="showVideoRecorderControl"
@stop="videoStopped"
/>
<ol-tile-layer ref="jawgLayer" title="JAWG">
<ol-source-xyz
crossOrigin="anonymous"
Expand Down Expand Up @@ -157,6 +204,15 @@ const overviewmapcontrol = ref(true);
const mousepositioncontrol = ref(true);
const rotatecontrol = ref(true);
const showSwipeControl = ref(true);
const showLayerSwitcherControl = ref(true);
const showLayerSwitcherImageControl = ref(true);
const showPrintDialogControl = ref(true);
const showToggleControl = ref(true);
const showVideoRecorderControl = ref(true);
const videoStopped = (event) => {
console.log(event);
};
onMounted(() => {
layerList.value.push(jawgLayer.value.tileLayer);
Expand Down
12 changes: 6 additions & 6 deletions docs/demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,33 +59,33 @@ import AppDemo from "@demos/AppDemo.vue"
</ol-tile-layer>
<ol-control-bar>
<ol-control-toggle
<ol-toggle-control
html="<i class='fas fa-map-marker'></i>"
className="edit"
title="Point"
:onToggle="(active) => changeDrawType(active, 'Point')"
/>
<ol-control-toggle
<ol-toggle-control
html="<i class='fas fa-draw-polygon'></i>"
className="edit"
title="Polygon"
:onToggle="(active) => changeDrawType(active, 'Polygon')"
/>
<ol-control-toggle
<ol-toggle-control
html="<i class='fas fa-circle'></i>"
className="edit"
title="Circle"
:onToggle="(active) => changeDrawType(active, 'Circle')"
/>
<ol-control-toggle
<ol-toggle-control
html="<i class='fas fa-grip-lines'></i>"
className="edit"
title="LineString"
:onToggle="(active) => changeDrawType(active, 'LineString')"
/>
<ol-videorecorder-control @stop="videoStopped">
</ol-videorecorder-control>
<ol-control-printdialog />
<ol-printdialog-control />
</ol-control-bar>
<ol-mouseposition-control />
Expand All @@ -105,7 +105,7 @@ import AppDemo from "@demos/AppDemo.vue"
tipLabel="Fit to Turkey"
/>
<ol-context-menu :items="contextMenuItems" />
<ol-context-menu-control :items="contextMenuItems" />
<ol-interaction-clusterselect @select="featureSelected" :pointRadius="20">
<ol-style>
Expand Down
12 changes: 6 additions & 6 deletions src/demos/AppDemo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,33 +41,33 @@
</ol-tile-layer>

<ol-control-bar>
<ol-control-toggle
<ol-toggle-control
html="<i class='fas fa-map-marker'></i>"
className="edit"
title="Point"
:onToggle="(active) => changeDrawType(active, 'Point')"
/>
<ol-control-toggle
<ol-toggle-control
html="<i class='fas fa-draw-polygon'></i>"
className="edit"
title="Polygon"
:onToggle="(active) => changeDrawType(active, 'Polygon')"
/>
<ol-control-toggle
<ol-toggle-control
html="<i class='fas fa-circle'></i>"
className="edit"
title="Circle"
:onToggle="(active) => changeDrawType(active, 'Circle')"
/>
<ol-control-toggle
<ol-toggle-control
html="<i class='fas fa-grip-lines'></i>"
className="edit"
title="LineString"
:onToggle="(active) => changeDrawType(active, 'LineString')"
/>
<ol-videorecorder-control @stop="videoStopped">
</ol-videorecorder-control>
<ol-control-printdialog />
<ol-printdialog-control />
</ol-control-bar>

<ol-mouseposition-control />
Expand All @@ -87,7 +87,7 @@
tipLabel="Fit to Turkey"
/>

<ol-context-menu :items="contextMenuItems" />
<ol-context-menu-control :items="contextMenuItems" />

<ol-interaction-clusterselect @select="featureSelected" :pointRadius="20">
<ol-style>
Expand Down

0 comments on commit 5622d23

Please sign in to comment.