@open-pioneer/scale-bar 0.4.4 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/README.md +1 -1
- package/ScaleBar.d.ts +2 -5
- package/ScaleBar.js +2 -2
- package/ScaleBar.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @open-pioneer/scale-bar
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 310800c: Switch from `peerDependencies` to normal `dependencies`. Peer dependencies have some usability problems when used at scale.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 310800c: Update core packages version.
|
|
12
|
+
- 583f1d6: The `mapId` or `map` properties are now optional on individual components.
|
|
13
|
+
You can use the `DefaultMapProvider` to configure an implicit default value.
|
|
14
|
+
|
|
15
|
+
Note that configuring _neither_ a default _nor_ an explicit `map` or `mapId` will trigger a runtime error.
|
|
16
|
+
|
|
17
|
+
- 583f1d6: All UI components in this project now accept the `mapId` (a `string`) _or_ the `map` (a `MapModel`) directly.
|
|
18
|
+
- a8b3449: Switch to a new versioning strategy.
|
|
19
|
+
From now on, packages released by this repository share a common version number.
|
|
20
|
+
- 900eb11: Update dependencies.
|
|
21
|
+
- Updated dependencies [310800c]
|
|
22
|
+
- Updated dependencies [2502050]
|
|
23
|
+
- Updated dependencies [583f1d6]
|
|
24
|
+
- Updated dependencies [583f1d6]
|
|
25
|
+
- Updated dependencies [397d617]
|
|
26
|
+
- Updated dependencies [a8b3449]
|
|
27
|
+
- Updated dependencies [310800c]
|
|
28
|
+
- Updated dependencies [900eb11]
|
|
29
|
+
- Updated dependencies [583f1d6]
|
|
30
|
+
- Updated dependencies [397d617]
|
|
31
|
+
- @open-pioneer/map@0.7.0
|
|
32
|
+
|
|
3
33
|
## 0.4.4
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
package/README.md
CHANGED
package/ScaleBar.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
+
import { MapModelProps } from "@open-pioneer/map";
|
|
1
2
|
import { CommonComponentProps } from "@open-pioneer/react-utils";
|
|
2
3
|
import { FC } from "react";
|
|
3
4
|
/**
|
|
4
5
|
* These are the properties supported by the {@link ScaleBar}.
|
|
5
6
|
*/
|
|
6
|
-
export interface ScaleBarProps extends CommonComponentProps {
|
|
7
|
-
/**
|
|
8
|
-
* The map id.
|
|
9
|
-
*/
|
|
10
|
-
mapId: string;
|
|
7
|
+
export interface ScaleBarProps extends CommonComponentProps, MapModelProps {
|
|
11
8
|
/**
|
|
12
9
|
* Display the scale either as a line or a bar. Defaults to `"line"`.
|
|
13
10
|
*/
|
package/ScaleBar.js
CHANGED
|
@@ -6,9 +6,9 @@ import { ScaleLine } from 'ol/control.js';
|
|
|
6
6
|
import { Box } from '@open-pioneer/chakra-integration';
|
|
7
7
|
|
|
8
8
|
const ScaleBar = (props) => {
|
|
9
|
-
const {
|
|
9
|
+
const { displayMode = "line" } = props;
|
|
10
10
|
const { containerProps } = useCommonComponentProps("scale-bar", props);
|
|
11
|
-
const { map } = useMapModel(
|
|
11
|
+
const { map } = useMapModel(props);
|
|
12
12
|
const scaleBarElem = useRef(null);
|
|
13
13
|
useEffect(() => {
|
|
14
14
|
if (scaleBarElem.current && map) {
|
package/ScaleBar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScaleBar.js","sources":["ScaleBar.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { useMapModel } from \"@open-pioneer/map\";\nimport { CommonComponentProps, useCommonComponentProps } from \"@open-pioneer/react-utils\";\nimport { FC, useEffect, useRef } from \"react\";\nimport { ScaleLine } from \"ol/control\";\nimport { Box } from \"@open-pioneer/chakra-integration\";\n\n/**\n * These are the properties supported by the {@link ScaleBar}.\n */\nexport interface ScaleBarProps extends CommonComponentProps {\n /**\n *
|
|
1
|
+
{"version":3,"file":"ScaleBar.js","sources":["ScaleBar.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { MapModelProps, useMapModel } from \"@open-pioneer/map\";\nimport { CommonComponentProps, useCommonComponentProps } from \"@open-pioneer/react-utils\";\nimport { FC, useEffect, useRef } from \"react\";\nimport { ScaleLine } from \"ol/control\";\nimport { Box } from \"@open-pioneer/chakra-integration\";\n\n/**\n * These are the properties supported by the {@link ScaleBar}.\n */\nexport interface ScaleBarProps extends CommonComponentProps, MapModelProps {\n /**\n * Display the scale either as a line or a bar. Defaults to `\"line\"`.\n */\n displayMode?: \"bar\" | \"line\";\n}\n\nexport const ScaleBar: FC<ScaleBarProps> = (props) => {\n const { displayMode = \"line\" } = props;\n const { containerProps } = useCommonComponentProps(\"scale-bar\", props);\n const { map } = useMapModel(props);\n const scaleBarElem = useRef(null);\n\n useEffect(() => {\n if (scaleBarElem.current && map) {\n const olMap = map.olMap;\n const scaleLine = new ScaleLine({\n units: \"metric\",\n target: scaleBarElem.current,\n bar: displayMode === \"bar\"\n });\n olMap.addControl(scaleLine);\n return () => {\n olMap.removeControl(scaleLine);\n };\n }\n }, [displayMode, map]);\n\n return <Box {...containerProps} ref={scaleBarElem}></Box>;\n};\n"],"names":[],"mappings":";;;;;;;AAkBa,MAAA,QAAA,GAA8B,CAAC,KAAU,KAAA;AAClD,EAAM,MAAA,EAAE,WAAc,GAAA,MAAA,EAAW,GAAA,KAAA,CAAA;AACjC,EAAA,MAAM,EAAE,cAAA,EAAmB,GAAA,uBAAA,CAAwB,aAAa,KAAK,CAAA,CAAA;AACrE,EAAA,MAAM,EAAE,GAAA,EAAQ,GAAA,WAAA,CAAY,KAAK,CAAA,CAAA;AACjC,EAAM,MAAA,YAAA,GAAe,OAAO,IAAI,CAAA,CAAA;AAEhC,EAAA,SAAA,CAAU,MAAM;AACZ,IAAI,IAAA,YAAA,CAAa,WAAW,GAAK,EAAA;AAC7B,MAAA,MAAM,QAAQ,GAAI,CAAA,KAAA,CAAA;AAClB,MAAM,MAAA,SAAA,GAAY,IAAI,SAAU,CAAA;AAAA,QAC5B,KAAO,EAAA,QAAA;AAAA,QACP,QAAQ,YAAa,CAAA,OAAA;AAAA,QACrB,KAAK,WAAgB,KAAA,KAAA;AAAA,OACxB,CAAA,CAAA;AACD,MAAA,KAAA,CAAM,WAAW,SAAS,CAAA,CAAA;AAC1B,MAAA,OAAO,MAAM;AACT,QAAA,KAAA,CAAM,cAAc,SAAS,CAAA,CAAA;AAAA,OACjC,CAAA;AAAA,KACJ;AAAA,GACD,EAAA,CAAC,WAAa,EAAA,GAAG,CAAC,CAAA,CAAA;AAErB,EAAA,uBAAQ,GAAA,CAAA,GAAA,EAAA,EAAK,GAAG,cAAA,EAAgB,KAAK,YAAc,EAAA,CAAA,CAAA;AACvD;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@open-pioneer/scale-bar",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.7.0",
|
|
5
5
|
"description": "This package provides a UI component to show the scale as a line or bar to the user.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"open-pioneer-trails"
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"url": "https://github.com/open-pioneer/trails-openlayers-base-packages",
|
|
14
14
|
"directory": "src/packages/scale-bar"
|
|
15
15
|
},
|
|
16
|
-
"
|
|
17
|
-
"@open-pioneer/chakra-integration": "^
|
|
18
|
-
"@open-pioneer/react-utils": "^
|
|
19
|
-
"@open-pioneer/runtime": "^2.
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@open-pioneer/chakra-integration": "^2.3.0",
|
|
18
|
+
"@open-pioneer/react-utils": "^2.3.0",
|
|
19
|
+
"@open-pioneer/runtime": "^2.3.0",
|
|
20
20
|
"ol": "^9.2.4",
|
|
21
21
|
"react": "^18.3.1",
|
|
22
|
-
"@open-pioneer/map": "^0.
|
|
22
|
+
"@open-pioneer/map": "^0.7.0"
|
|
23
23
|
},
|
|
24
24
|
"exports": {
|
|
25
25
|
"./package.json": "./package.json",
|