diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 96730069..769f89c9 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -373,6 +373,10 @@ export const config: UserConfig = { text: "ol-printdialog-control", link: "/componentsguide/mapcontrols/printdialog/", }, + { + text: "ol-profile-control", + link: "/componentsguide/mapcontrols/profile/", + }, { text: "ol-rotate-control", link: "/componentsguide/mapcontrols/rotate/", diff --git a/docs/componentsguide/mapcontrols/profile/index.md b/docs/componentsguide/mapcontrols/profile/index.md new file mode 100644 index 00000000..bc76d7cb --- /dev/null +++ b/docs/componentsguide/mapcontrols/profile/index.md @@ -0,0 +1,69 @@ +# ol-profile-control + +> A profile control. + + + + + + +## Usage + +::: code-group + +<<< ../../../../src/demos/ProfileControlDemo.vue + +::: + +## Properties + +### Props from OpenLayers + +Properties are passed-trough from `ol-ext` directly. +Their types and default values can be checked-out [in the official OpenLayers docs: `ol-ext/control/Profile`](https://viglino.github.io/ol-ext/doc/doc-pages/ol.control.Profile.html). +Only some properties deviate caused by reserved keywords from Vue / HTML. +This deviating props are described in the section below. + +### Deviating Properties + +None. + +## Events + +You have access to all Events from the underlying `ol-ext` Profile Control API (without the `event:` prefix). +Check out [the official OpenLayers docs](https://viglino.github.io/ol-ext/doc/doc-pages/ol.control.Profile.html) to see the available events tht will be fired. + +For example: + +```html + +``` + +## Methods + +You have access to all Methods from the underlying `ol-ext` Profile Control API. +Check out [the official OpenLayers docs](https://viglino.github.io/ol-ext/doc/doc-pages/ol.control.Profile.html) to see the available methods. + +To access the source, you can use a `ref()` as shown below: + +```vue + + + +``` diff --git a/src/components/mapControls/OlProfileControl.vue b/src/components/mapControls/OlProfileControl.vue new file mode 100644 index 00000000..e5623032 --- /dev/null +++ b/src/components/mapControls/OlProfileControl.vue @@ -0,0 +1,35 @@ + + diff --git a/src/components/mapControls/index.ts b/src/components/mapControls/index.ts index 6b2ddc6c..97b52b3a 100644 --- a/src/components/mapControls/index.ts +++ b/src/components/mapControls/index.ts @@ -9,6 +9,7 @@ import OlLayerSwitcherImageControl from "./OlLayerSwitcherImageControl.vue"; import OlMousePositionControl from "./OlMousePositionControl.vue"; import OlOverviewMapControl from "./OlOverviewMapControl.vue"; import OlPrintDialogControl from "./OlPrintDialogControl.vue"; +import OlProfileControl from "./OlProfileControl.vue"; import OlRotateControl from "./OlRotateControl.vue"; import OlScaleLineControl from "./OlScaleLineControl.vue"; import OlSearchControl from "./OlSearchControl.vue"; @@ -37,6 +38,7 @@ function install(app: App) { app.component("ol-toggle-control", OlToggleControl); app.component("ol-button-control", OlButtonControl); app.component("ol-printdialog-control", OlPrintDialogControl); + app.component("ol-profile-control", OlProfileControl); app.component("ol-videorecorder-control", OlVideoRecorderControl); app.component("ol-layerswitcher-control", OlLayerSwitcherControl); app.component("ol-layerswitcherimage-control", OlLayerSwitcherImageControl); @@ -57,6 +59,7 @@ export { OlMousePositionControl, OlOverviewMapControl, OlPrintDialogControl, + OlProfileControl, OlRotateControl, OlScaleLineControl, OlSearchControl, diff --git a/src/composables/useControl.ts b/src/composables/useControl.ts index c9abe4e8..35cc56dc 100644 --- a/src/composables/useControl.ts +++ b/src/composables/useControl.ts @@ -18,6 +18,8 @@ import type Button from "ol-ext/control/Button"; import type { Options as ButtonOptions } from "ol-ext/control/Button"; import type PrintDialog from "ol-ext/control/PrintDialog"; import type { Options as PrintDialogOptions } from "ol-ext/control/PrintDialog"; +import type Profile from "ol-ext/control/Profile"; +import type { Options as ProfileOptions } from "ol-ext/control/Profile"; import type Toggle from "ol-ext/control/Toggle"; import type { Options as ToggleOptions } from "ol-ext/control/Toggle"; import type VideoRecorder from "ol-ext/control/VideoRecorder"; @@ -49,6 +51,7 @@ type InnerControlType = ( | Bar | Button | PrintDialog + | Profile | Toggle | VideoRecorder | FullScreen @@ -73,6 +76,7 @@ type InnerControlProperties = | BarOptions | ButtonOptions | PrintDialogOptions + | ProfileOptions | ToggleOptions | VideoRecorderOptions | LayerSwitcherOptions diff --git a/src/demos/LineString.vue b/src/demos/LineString.vue index c6fa1ea4..959070e1 100644 --- a/src/demos/LineString.vue +++ b/src/demos/LineString.vue @@ -17,7 +17,7 @@ - + - diff --git a/src/demos/ProfileControlDemo.vue b/src/demos/ProfileControlDemo.vue new file mode 100644 index 00000000..f58f0fd0 --- /dev/null +++ b/src/demos/ProfileControlDemo.vue @@ -0,0 +1,121 @@ + + + diff --git a/tests/__screenshots__/controls.test.ts/ol-profile-control-should-render-1.png b/tests/__screenshots__/controls.test.ts/ol-profile-control-should-render-1.png new file mode 100644 index 00000000..13be6848 Binary files /dev/null and b/tests/__screenshots__/controls.test.ts/ol-profile-control-should-render-1.png differ diff --git a/tests/controls.test.ts b/tests/controls.test.ts index 2d649d84..7cb736ed 100644 --- a/tests/controls.test.ts +++ b/tests/controls.test.ts @@ -108,6 +108,18 @@ test.describe("ol-printdialog-control", () => { }); }); +test.describe("ol-profile-control", () => { + test("should render", async ({ page }) => { + const map = new MapPage(page); + await map.goto("/componentsguide/mapcontrols/profile/"); + await map.waitUntilReady(); + await map.waitUntilCanvasLoaded(); + await map.page.locator(".ol-control").getByTitle("Profile").click(); + await map.hoverOnCanvas([104, 192]); + await map.checkCanvasScreenshot(); + }); +}); + test.describe("ol-rotate-control", () => { test("should render", async ({ page }) => { const map = new MapPage(page); diff --git a/vite.config.ts b/vite.config.ts index 5548789d..4d7ba104 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -111,6 +111,7 @@ export default defineConfig({ "ol-ext/control/Toggle": "Toggle", "ol-ext/control/VideoRecorder": "VideoRecorder", "ol-ext/control/MapZone": "MapZone", + "ol-ext/control/Profile": "Profile", "ol/control/Zoom": "Zoom", "ol/control/ZoomSlider": "ZoomSlider", "ol/control/ZoomToExtent": "ZoomToExtent",