@open-pioneer/map-navigation 0.9.0-dev.20250220091855 → 0.9.0-dev.20250224083536
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 +116 -111
- package/History.js.map +1 -1
- package/InitialExtent.js.map +1 -1
- package/README.md +3 -3
- package/ViewHistoryModel.js.map +1 -1
- package/Zoom.js.map +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
# @open-pioneer/map-navigation
|
|
2
2
|
|
|
3
|
-
## 0.9.0-dev.
|
|
3
|
+
## 0.9.0-dev.20250224083536
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- cb94c75: update dependencies
|
|
8
|
+
- 8dc793e: Add `ButtonProps` to `ToolButton` in `@open-pioneer/geolocation` and `@open-pioneer/map-navigation`
|
|
8
9
|
|
|
9
10
|
Example:
|
|
10
11
|
|
|
@@ -12,200 +13,204 @@
|
|
|
12
13
|
|
|
13
14
|
### Patch Changes
|
|
14
15
|
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
- Updated dependencies [cb94c75]
|
|
17
|
+
- Updated dependencies [37cd707]
|
|
18
|
+
- Updated dependencies [32ed2cd]
|
|
19
|
+
- Updated dependencies [f327eec]
|
|
20
|
+
- Updated dependencies [f327eec]
|
|
21
|
+
- Updated dependencies [209eb8e]
|
|
22
|
+
- Updated dependencies [d72e42c]
|
|
23
|
+
- @open-pioneer/map-ui-components@0.9.0-dev.20250224083536
|
|
24
|
+
- @open-pioneer/map@0.9.0-dev.20250224083536
|
|
20
25
|
|
|
21
26
|
## 0.8.0
|
|
22
27
|
|
|
23
28
|
### Minor Changes
|
|
24
29
|
|
|
25
|
-
-
|
|
30
|
+
- 2fa8020: Update trails core package dependencies.
|
|
26
31
|
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
|
|
32
|
+
- Also updates Chakra UI to the latest 2.x version and Chakra React Select to version 5.
|
|
33
|
+
- Removes any obsolete references to `@chakra-ui/system`.
|
|
34
|
+
This dependency seems to be no longer required and may lead to duplicate packages in your dependency tree.
|
|
30
35
|
|
|
31
36
|
### Patch Changes
|
|
32
37
|
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
38
|
+
- 49f0207: Update trails core packages to version 2.4.0
|
|
39
|
+
- d8337a6: Refactor implementation to use the new reactive properties of the map model.
|
|
40
|
+
- Updated dependencies [b717121]
|
|
41
|
+
- Updated dependencies [e7978a8]
|
|
42
|
+
- Updated dependencies [7a5f1e1]
|
|
43
|
+
- Updated dependencies [7ae9f90]
|
|
44
|
+
- Updated dependencies [d8337a6]
|
|
45
|
+
- Updated dependencies [49f0207]
|
|
46
|
+
- Updated dependencies [b2127df]
|
|
47
|
+
- Updated dependencies [2fa8020]
|
|
48
|
+
- Updated dependencies [7ae9f90]
|
|
49
|
+
- Updated dependencies [d8337a6]
|
|
50
|
+
- @open-pioneer/map@0.8.0
|
|
51
|
+
- @open-pioneer/map-ui-components@0.8.0
|
|
47
52
|
|
|
48
53
|
## 0.7.0
|
|
49
54
|
|
|
50
55
|
### Minor Changes
|
|
51
56
|
|
|
52
|
-
-
|
|
57
|
+
- 440b165: Create new tool buttons that allow the user to navigate the history of map views (e.g. jump back to previous map extent):
|
|
53
58
|
|
|
54
59
|
```jsx
|
|
55
60
|
<HistoryBackward /* ... */ />
|
|
56
61
|
<HistoryForward /* ... */ />
|
|
57
62
|
```
|
|
58
63
|
|
|
59
|
-
-
|
|
64
|
+
- 310800c: Switch from `peerDependencies` to normal `dependencies`. Peer dependencies have some usability problems when used at scale.
|
|
60
65
|
|
|
61
66
|
### Patch Changes
|
|
62
67
|
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
|
|
66
|
-
-
|
|
67
|
-
|
|
68
|
+
- 310800c: Update core packages version.
|
|
69
|
+
- 483c416: Don't attempt to zoom past configured zoom limits (#356).
|
|
70
|
+
As a side effect of this change, clicks on the zoom in/out buttons are ignored during the brief animation period (currently 200ms).
|
|
71
|
+
- 583f1d6: The `mapId` or `map` properties are now optional on individual components.
|
|
72
|
+
You can use the `DefaultMapProvider` to configure an implicit default value.
|
|
68
73
|
|
|
69
74
|
Note that configuring _neither_ a default _nor_ an explicit `map` or `mapId` will trigger a runtime error.
|
|
70
75
|
|
|
71
|
-
-
|
|
72
|
-
-
|
|
73
|
-
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
-
|
|
85
|
-
-
|
|
86
|
-
-
|
|
76
|
+
- 583f1d6: All UI components in this project now accept the `mapId` (a `string`) _or_ the `map` (a `MapModel`) directly.
|
|
77
|
+
- a8b3449: Switch to a new versioning strategy.
|
|
78
|
+
From now on, packages released by this repository share a common version number.
|
|
79
|
+
- 900eb11: Update dependencies.
|
|
80
|
+
- Updated dependencies [310800c]
|
|
81
|
+
- Updated dependencies [2502050]
|
|
82
|
+
- Updated dependencies [583f1d6]
|
|
83
|
+
- Updated dependencies [583f1d6]
|
|
84
|
+
- Updated dependencies [397d617]
|
|
85
|
+
- Updated dependencies [a8b3449]
|
|
86
|
+
- Updated dependencies [310800c]
|
|
87
|
+
- Updated dependencies [900eb11]
|
|
88
|
+
- Updated dependencies [583f1d6]
|
|
89
|
+
- Updated dependencies [397d617]
|
|
90
|
+
- @open-pioneer/map-ui-components@0.7.0
|
|
91
|
+
- @open-pioneer/map@0.7.0
|
|
87
92
|
|
|
88
93
|
## 0.4.4
|
|
89
94
|
|
|
90
95
|
### Patch Changes
|
|
91
96
|
|
|
92
|
-
-
|
|
93
|
-
-
|
|
94
|
-
-
|
|
95
|
-
-
|
|
96
|
-
-
|
|
97
|
+
- b152428: Update trails dependencies
|
|
98
|
+
- Updated dependencies [b152428]
|
|
99
|
+
- Updated dependencies [291ccb6]
|
|
100
|
+
- @open-pioneer/map-ui-components@0.1.1
|
|
101
|
+
- @open-pioneer/map@0.6.1
|
|
97
102
|
|
|
98
103
|
## 0.4.3
|
|
99
104
|
|
|
100
105
|
### Patch Changes
|
|
101
106
|
|
|
102
|
-
-
|
|
103
|
-
-
|
|
104
|
-
-
|
|
105
|
-
-
|
|
106
|
-
-
|
|
107
|
-
-
|
|
108
|
-
-
|
|
107
|
+
- 28e092a: Update dependencies
|
|
108
|
+
- Updated dependencies [28e092a]
|
|
109
|
+
- Updated dependencies [0d51d2f]
|
|
110
|
+
- Updated dependencies [2090e72]
|
|
111
|
+
- Updated dependencies [76f8863]
|
|
112
|
+
- @open-pioneer/map-ui-components@0.1.0
|
|
113
|
+
- @open-pioneer/map@0.6.0
|
|
109
114
|
|
|
110
115
|
## 0.4.2
|
|
111
116
|
|
|
112
117
|
### Patch Changes
|
|
113
118
|
|
|
114
|
-
-
|
|
115
|
-
-
|
|
116
|
-
-
|
|
117
|
-
-
|
|
118
|
-
-
|
|
119
|
-
-
|
|
120
|
-
-
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
-
|
|
125
|
-
-
|
|
126
|
-
-
|
|
119
|
+
- 4140646: Update trails dependencies
|
|
120
|
+
- 4140646: Update to react 18.3.1
|
|
121
|
+
- f2912be: Added more context to some button labels and tooltips for better usability.
|
|
122
|
+
- 81bc7da: Update trails dependencies
|
|
123
|
+
- 2c092dc: Update dependencies
|
|
124
|
+
- Updated dependencies [4140646]
|
|
125
|
+
- Updated dependencies [4140646]
|
|
126
|
+
- Updated dependencies [b5bb7a1]
|
|
127
|
+
- Updated dependencies [81bc7da]
|
|
128
|
+
- Updated dependencies [2c092dc]
|
|
129
|
+
- Updated dependencies [4140646]
|
|
130
|
+
- @open-pioneer/react-utils@0.2.3
|
|
131
|
+
- @open-pioneer/map@0.5.1
|
|
127
132
|
|
|
128
133
|
## 0.4.1
|
|
129
134
|
|
|
130
135
|
### Patch Changes
|
|
131
136
|
|
|
132
|
-
-
|
|
133
|
-
-
|
|
137
|
+
- Updated dependencies [520a97b]
|
|
138
|
+
- @open-pioneer/map@0.5.0
|
|
134
139
|
|
|
135
140
|
## 0.4.0
|
|
136
141
|
|
|
137
142
|
### Minor Changes
|
|
138
143
|
|
|
139
|
-
-
|
|
144
|
+
- 9334e81: Update to OpenLayers 9
|
|
140
145
|
|
|
141
146
|
### Patch Changes
|
|
142
147
|
|
|
143
|
-
-
|
|
144
|
-
-
|
|
145
|
-
-
|
|
146
|
-
-
|
|
147
|
-
-
|
|
148
|
-
-
|
|
149
|
-
-
|
|
150
|
-
-
|
|
151
|
-
-
|
|
152
|
-
-
|
|
153
|
-
-
|
|
154
|
-
-
|
|
148
|
+
- 1a8ad89: Update package.json metadata
|
|
149
|
+
- 6162979: Update versions of core packages
|
|
150
|
+
- Updated dependencies [1a8ad89]
|
|
151
|
+
- Updated dependencies [a11bf72]
|
|
152
|
+
- Updated dependencies [fc6bf82]
|
|
153
|
+
- Updated dependencies [a0d8882]
|
|
154
|
+
- Updated dependencies [6162979]
|
|
155
|
+
- Updated dependencies [9334e81]
|
|
156
|
+
- Updated dependencies [ac7fdd1]
|
|
157
|
+
- Updated dependencies [13ea342]
|
|
158
|
+
- @open-pioneer/react-utils@0.2.2
|
|
159
|
+
- @open-pioneer/map@0.4.0
|
|
155
160
|
|
|
156
161
|
## 0.3.1
|
|
157
162
|
|
|
158
163
|
### Patch Changes
|
|
159
164
|
|
|
160
|
-
-
|
|
161
|
-
-
|
|
165
|
+
- Updated dependencies [611ddb9]
|
|
166
|
+
- @open-pioneer/map@0.3.1
|
|
162
167
|
|
|
163
168
|
## 0.3.0
|
|
164
169
|
|
|
165
170
|
### Minor Changes
|
|
166
171
|
|
|
167
|
-
-
|
|
172
|
+
- ee7c2d4: Update runtime version.
|
|
168
173
|
|
|
169
174
|
### Patch Changes
|
|
170
175
|
|
|
171
|
-
-
|
|
172
|
-
-
|
|
173
|
-
-
|
|
174
|
-
-
|
|
175
|
-
-
|
|
176
|
-
-
|
|
176
|
+
- Updated dependencies [ee7c2d4]
|
|
177
|
+
- Updated dependencies [a582e5e]
|
|
178
|
+
- Updated dependencies [0456500]
|
|
179
|
+
- Updated dependencies [762e7b9]
|
|
180
|
+
- @open-pioneer/map@0.3.0
|
|
181
|
+
- @open-pioneer/react-utils@0.2.1
|
|
177
182
|
|
|
178
183
|
## 0.2.0
|
|
179
184
|
|
|
180
185
|
### Minor Changes
|
|
181
186
|
|
|
182
|
-
-
|
|
187
|
+
- 70349a8: Update to new core packages major versions
|
|
183
188
|
|
|
184
189
|
### Patch Changes
|
|
185
190
|
|
|
186
|
-
-
|
|
187
|
-
-
|
|
188
|
-
-
|
|
191
|
+
- Updated dependencies [70349a8]
|
|
192
|
+
- @open-pioneer/map@0.2.0
|
|
193
|
+
- @open-pioneer/react-utils@0.2.0
|
|
189
194
|
|
|
190
195
|
## 0.1.1
|
|
191
196
|
|
|
192
197
|
### Patch Changes
|
|
193
198
|
|
|
194
|
-
-
|
|
195
|
-
-
|
|
196
|
-
-
|
|
197
|
-
-
|
|
198
|
-
-
|
|
199
|
+
- Updated dependencies [08bffbc]
|
|
200
|
+
- Updated dependencies [a58546b]
|
|
201
|
+
- Updated dependencies [a58546b]
|
|
202
|
+
- Updated dependencies [0c4ce04]
|
|
203
|
+
- @open-pioneer/map@0.1.1
|
|
199
204
|
|
|
200
205
|
## 0.1.0
|
|
201
206
|
|
|
202
207
|
### Minor Changes
|
|
203
208
|
|
|
204
|
-
-
|
|
209
|
+
- 70b2381: Initial release
|
|
205
210
|
|
|
206
211
|
### Patch Changes
|
|
207
212
|
|
|
208
|
-
-
|
|
209
|
-
-
|
|
210
|
-
-
|
|
211
|
-
-
|
|
213
|
+
- Updated dependencies [bb2f27a]
|
|
214
|
+
- Updated dependencies [182da1c]
|
|
215
|
+
- @open-pioneer/map@0.1.0
|
|
216
|
+
- @open-pioneer/react-utils@0.1.0
|
package/History.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"History.js","sources":["History.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 { ToolButton } from \"@open-pioneer/map-ui-components\";\nimport { CommonComponentProps, useCommonComponentProps } from \"@open-pioneer/react-utils\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport { PackageIntl } from \"@open-pioneer/runtime\";\nimport classNames from \"classnames\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { FC, ForwardedRef, forwardRef, RefAttributes } from \"react\";\nimport { FiCornerUpLeft, FiCornerUpRight } from \"react-icons/fi\";\nimport { useHistoryViewModel } from \"./ViewHistoryModel\";\nimport { ButtonProps } from \"@open-pioneer/chakra-integration\";\n\nexport type HistoryForwardProps = Omit<HistoryProps, \"viewDirection\">;\n\n/**\n * Provides a button by which the user can navigate to the next map view.\n *\n * This component composes {@link History}.\n */\nexport const HistoryForward: FC<HistoryForwardProps> = forwardRef(function HistoryForward(\n props: HistoryForwardProps,\n ref: ForwardedRef<HTMLButtonElement>\n) {\n return <History viewDirection=\"forward\" ref={ref} {...props} />;\n});\n\nexport type HistoryBackwardProps = HistoryForwardProps;\n\n/**\n * Provides a button by which the user can navigate to the previous map view.\n *\n * This component composes {@link History}.\n */\nexport const HistoryBackward: FC<HistoryBackwardProps> = forwardRef(function HistoryBackward(\n props: HistoryBackwardProps,\n ref: ForwardedRef<HTMLButtonElement>\n) {\n return <History viewDirection=\"backward\" ref={ref} {...props} />;\n});\n\nexport interface HistoryProps\n extends CommonComponentProps,\n RefAttributes<HTMLButtonElement>,\n MapModelProps {\n /**\n * Additional properties for the `Button` element.\n *\n * Note that the ToolButton also defines some of these props.\n */\n buttonProps?: Partial<ButtonProps>;\n\n /**\n * The view direction.\n *\n * The button will either view forward or view backward depending on this value.\n */\n viewDirection: \"forward\" | \"backward\";\n}\n\n/**\n * Provides a button by which the user can navigate forward or backward in the view history of the map.\n */\nexport const History: FC<HistoryProps> = forwardRef(function History(\n props: HistoryProps,\n ref: ForwardedRef<HTMLButtonElement>\n) {\n const intl = useIntl();\n const { buttonProps, viewDirection } = props;\n const { map } = useMapModel(props);\n const viewModel = useHistoryViewModel(map);\n const { defaultClassName, buttonLabel, buttonIcon } = getDirectionProps(intl, viewDirection);\n const { containerProps } = useCommonComponentProps(classNames(\"view\", defaultClassName), props);\n\n const canNavigate = useReactiveSnapshot(() => {\n if (!viewModel) {\n return false;\n }\n\n if (viewDirection === \"forward\") {\n return viewModel.canForward;\n } else {\n return viewModel.canBackward;\n }\n }, [viewModel, viewDirection]);\n const navigate = () => {\n if (!viewModel) {\n return;\n }\n\n if (viewDirection === \"forward\") {\n viewModel.forward();\n } else {\n viewModel.backward();\n }\n };\n\n return (\n viewModel && (\n <ToolButton\n ref={ref}\n {...containerProps}\n buttonProps={buttonProps}\n label={buttonLabel}\n icon={buttonIcon}\n onClick={navigate}\n isDisabled={!canNavigate}\n />\n )\n );\n});\n\nfunction getDirectionProps(intl: PackageIntl, viewDirection: \"forward\" | \"backward\") {\n switch (viewDirection) {\n case \"forward\":\n return {\n defaultClassName: \"view-forward\",\n buttonLabel: intl.formatMessage({ id: \"view-forward.title\" }),\n buttonIcon: <FiCornerUpRight />\n };\n case \"backward\":\n return {\n defaultClassName: \"view-backward\",\n buttonLabel: intl.formatMessage({ id: \"view-backward.title\" }),\n buttonIcon: <FiCornerUpLeft />\n };\n }\n}\n"],"names":["HistoryForward","HistoryBackward","History"],"mappings":";;;;;;;;;;;AAqBO,MAAM,cAA0C,GAAA,UAAA,CAAW,SAASA,eAAAA,CACvE,OACA,GACF,EAAA;AACE,EAAA,2BAAQ,OAAQ,EAAA,EAAA,aAAA,EAAc,SAAU,EAAA,GAAA,EAAW,GAAG,KAAO,EAAA,CAAA
|
|
1
|
+
{"version":3,"file":"History.js","sources":["History.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { MapModelProps, useMapModel } from \"@open-pioneer/map\";\nimport { ToolButton } from \"@open-pioneer/map-ui-components\";\nimport { CommonComponentProps, useCommonComponentProps } from \"@open-pioneer/react-utils\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport { PackageIntl } from \"@open-pioneer/runtime\";\nimport classNames from \"classnames\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { FC, ForwardedRef, forwardRef, RefAttributes } from \"react\";\nimport { FiCornerUpLeft, FiCornerUpRight } from \"react-icons/fi\";\nimport { useHistoryViewModel } from \"./ViewHistoryModel\";\nimport { ButtonProps } from \"@open-pioneer/chakra-integration\";\n\nexport type HistoryForwardProps = Omit<HistoryProps, \"viewDirection\">;\n\n/**\n * Provides a button by which the user can navigate to the next map view.\n *\n * This component composes {@link History}.\n */\nexport const HistoryForward: FC<HistoryForwardProps> = forwardRef(function HistoryForward(\n props: HistoryForwardProps,\n ref: ForwardedRef<HTMLButtonElement>\n) {\n return <History viewDirection=\"forward\" ref={ref} {...props} />;\n});\n\nexport type HistoryBackwardProps = HistoryForwardProps;\n\n/**\n * Provides a button by which the user can navigate to the previous map view.\n *\n * This component composes {@link History}.\n */\nexport const HistoryBackward: FC<HistoryBackwardProps> = forwardRef(function HistoryBackward(\n props: HistoryBackwardProps,\n ref: ForwardedRef<HTMLButtonElement>\n) {\n return <History viewDirection=\"backward\" ref={ref} {...props} />;\n});\n\nexport interface HistoryProps\n extends CommonComponentProps,\n RefAttributes<HTMLButtonElement>,\n MapModelProps {\n /**\n * Additional properties for the `Button` element.\n *\n * Note that the ToolButton also defines some of these props.\n */\n buttonProps?: Partial<ButtonProps>;\n\n /**\n * The view direction.\n *\n * The button will either view forward or view backward depending on this value.\n */\n viewDirection: \"forward\" | \"backward\";\n}\n\n/**\n * Provides a button by which the user can navigate forward or backward in the view history of the map.\n */\nexport const History: FC<HistoryProps> = forwardRef(function History(\n props: HistoryProps,\n ref: ForwardedRef<HTMLButtonElement>\n) {\n const intl = useIntl();\n const { buttonProps, viewDirection } = props;\n const { map } = useMapModel(props);\n const viewModel = useHistoryViewModel(map);\n const { defaultClassName, buttonLabel, buttonIcon } = getDirectionProps(intl, viewDirection);\n const { containerProps } = useCommonComponentProps(classNames(\"view\", defaultClassName), props);\n\n const canNavigate = useReactiveSnapshot(() => {\n if (!viewModel) {\n return false;\n }\n\n if (viewDirection === \"forward\") {\n return viewModel.canForward;\n } else {\n return viewModel.canBackward;\n }\n }, [viewModel, viewDirection]);\n const navigate = () => {\n if (!viewModel) {\n return;\n }\n\n if (viewDirection === \"forward\") {\n viewModel.forward();\n } else {\n viewModel.backward();\n }\n };\n\n return (\n viewModel && (\n <ToolButton\n ref={ref}\n {...containerProps}\n buttonProps={buttonProps}\n label={buttonLabel}\n icon={buttonIcon}\n onClick={navigate}\n isDisabled={!canNavigate}\n />\n )\n );\n});\n\nfunction getDirectionProps(intl: PackageIntl, viewDirection: \"forward\" | \"backward\") {\n switch (viewDirection) {\n case \"forward\":\n return {\n defaultClassName: \"view-forward\",\n buttonLabel: intl.formatMessage({ id: \"view-forward.title\" }),\n buttonIcon: <FiCornerUpRight />\n };\n case \"backward\":\n return {\n defaultClassName: \"view-backward\",\n buttonLabel: intl.formatMessage({ id: \"view-backward.title\" }),\n buttonIcon: <FiCornerUpLeft />\n };\n }\n}\n"],"names":["HistoryForward","HistoryBackward","History"],"mappings":";;;;;;;;;;;AAqBO,MAAM,cAA0C,GAAA,UAAA,CAAW,SAAS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;AAC7B,MAAA,SAAA,CAAU,OAAQ,EAAA;AAAA,KACf,MAAA;AACH,MAAA,SAAA,CAAU,QAAS,EAAA;AAAA;AACvB,GACJ;AAEA,EAAA,OACI,SACI,oBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACG,GAAA;AAAA,MACC,GAAG,cAAA;AAAA,MACJ,WAAA;AAAA,MACA,KAAO,EAAA,WAAA;AAAA,MACP,IAAM,EAAA,UAAA;AAAA,MACN,OAAS,EAAA,QAAA;AAAA,MACT,YAAY,CAAC;AAAA;AAAA,GACjB;AAGZ,CAAC;AAED,SAAS,iBAAA,CAAkB,MAAmB,aAAuC,EAAA;AACjF,EAAA,QAAQ,aAAe;AAAA,IACnB,KAAK,SAAA;AACD,MAAO,OAAA;AAAA,QACH,gBAAkB,EAAA,cAAA;AAAA,QAClB,aAAa,IAAK,CAAA,aAAA,CAAc,EAAE,EAAA,EAAI,sBAAsB,CAAA;AAAA,QAC5D,UAAA,sBAAa,eAAgB,EAAA,EAAA;AAAA,OACjC;AAAA,IACJ,KAAK,UAAA;AACD,MAAO,OAAA;AAAA,QACH,gBAAkB,EAAA,eAAA;AAAA,QAClB,aAAa,IAAK,CAAA,aAAA,CAAc,EAAE,EAAA,EAAI,uBAAuB,CAAA;AAAA,QAC7D,UAAA,sBAAa,cAAe,EAAA,EAAA;AAAA,OAChC;AAAA;AAEZ;;;;"}
|
package/InitialExtent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InitialExtent.js","sources":["InitialExtent.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonProps } from \"@open-pioneer/chakra-integration\";\nimport { MapModelProps, useMapModel } from \"@open-pioneer/map\";\nimport { ToolButton } from \"@open-pioneer/map-ui-components\";\nimport { CommonComponentProps, useCommonComponentProps } from \"@open-pioneer/react-utils\";\nimport { Extent } from \"ol/extent\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { FC, ForwardedRef, RefAttributes, forwardRef } from \"react\";\nimport { FiHome } from \"react-icons/fi\";\n\nexport interface InitialExtentProps\n extends CommonComponentProps,\n RefAttributes<HTMLButtonElement>,\n MapModelProps {\n /**\n * Additional properties for the `Button` element.\n *\n * Note that the ToolButton also defines some of these props.\n */\n buttonProps?: Partial<ButtonProps>;\n}\n\n/**\n * Provides a simple button that switches the view to its initial viewpoint.\n */\nexport const InitialExtent: FC<InitialExtentProps> = forwardRef(function InitialExtent(\n props: InitialExtentProps,\n ref: ForwardedRef<HTMLButtonElement>\n) {\n const { containerProps } = useCommonComponentProps(\"initial-extent\", props);\n const { map } = useMapModel(props);\n const intl = useIntl();\n const { buttonProps } = props;\n\n function setInitExtent() {\n const initialExtent = map?.initialExtent;\n if (initialExtent) {\n const newExtent: Extent = [\n initialExtent.xMin,\n initialExtent.yMin,\n initialExtent.xMax,\n initialExtent.yMax\n ];\n\n map.olView.fit(newExtent, { duration: 200 });\n }\n }\n\n return (\n <ToolButton\n ref={ref}\n buttonProps={buttonProps}\n label={intl.formatMessage({ id: \"initial-extent.title\" })}\n icon={<FiHome />}\n onClick={setInitExtent}\n {...containerProps}\n />\n );\n});\n"],"names":["InitialExtent"],"mappings":";;;;;;;;AA0BO,MAAM,aAAwC,GAAA,UAAA,CAAW,SAASA,cAAAA,CACrE,OACA,GACF,EAAA;AACE,EAAA,MAAM,EAAE,cAAA,EAAmB,GAAA,uBAAA,CAAwB,kBAAkB,KAAK,CAAA
|
|
1
|
+
{"version":3,"file":"InitialExtent.js","sources":["InitialExtent.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonProps } from \"@open-pioneer/chakra-integration\";\nimport { MapModelProps, useMapModel } from \"@open-pioneer/map\";\nimport { ToolButton } from \"@open-pioneer/map-ui-components\";\nimport { CommonComponentProps, useCommonComponentProps } from \"@open-pioneer/react-utils\";\nimport { Extent } from \"ol/extent\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { FC, ForwardedRef, RefAttributes, forwardRef } from \"react\";\nimport { FiHome } from \"react-icons/fi\";\n\nexport interface InitialExtentProps\n extends CommonComponentProps,\n RefAttributes<HTMLButtonElement>,\n MapModelProps {\n /**\n * Additional properties for the `Button` element.\n *\n * Note that the ToolButton also defines some of these props.\n */\n buttonProps?: Partial<ButtonProps>;\n}\n\n/**\n * Provides a simple button that switches the view to its initial viewpoint.\n */\nexport const InitialExtent: FC<InitialExtentProps> = forwardRef(function InitialExtent(\n props: InitialExtentProps,\n ref: ForwardedRef<HTMLButtonElement>\n) {\n const { containerProps } = useCommonComponentProps(\"initial-extent\", props);\n const { map } = useMapModel(props);\n const intl = useIntl();\n const { buttonProps } = props;\n\n function setInitExtent() {\n const initialExtent = map?.initialExtent;\n if (initialExtent) {\n const newExtent: Extent = [\n initialExtent.xMin,\n initialExtent.yMin,\n initialExtent.xMax,\n initialExtent.yMax\n ];\n\n map.olView.fit(newExtent, { duration: 200 });\n }\n }\n\n return (\n <ToolButton\n ref={ref}\n buttonProps={buttonProps}\n label={intl.formatMessage({ id: \"initial-extent.title\" })}\n icon={<FiHome />}\n onClick={setInitExtent}\n {...containerProps}\n />\n );\n});\n"],"names":["InitialExtent"],"mappings":";;;;;;;;AA0BO,MAAM,aAAwC,GAAA,UAAA,CAAW,SAASA,cAAAA,CACrE,OACA,GACF,EAAA;AACE,EAAA,MAAM,EAAE,cAAA,EAAmB,GAAA,uBAAA,CAAwB,kBAAkB,KAAK,CAAA;AAC1E,EAAA,MAAM,EAAE,GAAA,EAAQ,GAAA,WAAA,CAAY,KAAK,CAAA;AACjC,EAAA,MAAM,OAAO,OAAQ,EAAA;AACrB,EAAM,MAAA,EAAE,aAAgB,GAAA,KAAA;AAExB,EAAA,SAAS,aAAgB,GAAA;AACrB,IAAA,MAAM,gBAAgB,GAAK,EAAA,aAAA;AAC3B,IAAA,IAAI,aAAe,EAAA;AACf,MAAA,MAAM,SAAoB,GAAA;AAAA,QACtB,aAAc,CAAA,IAAA;AAAA,QACd,aAAc,CAAA,IAAA;AAAA,QACd,aAAc,CAAA,IAAA;AAAA,QACd,aAAc,CAAA;AAAA,OAClB;AAEA,MAAA,GAAA,CAAI,OAAO,GAAI,CAAA,SAAA,EAAW,EAAE,QAAA,EAAU,KAAK,CAAA;AAAA;AAC/C;AAGJ,EACI,uBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACG,GAAA;AAAA,MACA,WAAA;AAAA,MACA,OAAO,IAAK,CAAA,aAAA,CAAc,EAAE,EAAA,EAAI,wBAAwB,CAAA;AAAA,MACxD,IAAA,sBAAO,MAAO,EAAA,EAAA,CAAA;AAAA,MACd,OAAS,EAAA,aAAA;AAAA,MACR,GAAG;AAAA;AAAA,GACR;AAER,CAAC;;;;"}
|
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
This package provides a collection of the following map navigation controls:
|
|
4
4
|
|
|
5
|
-
-
|
|
6
|
-
-
|
|
7
|
-
-
|
|
5
|
+
- [Initial extent](#initial-extent): A button that allows the user to reset the map to the initial view.
|
|
6
|
+
- [Zoom](#zoom): Two buttons that allow the user to zoom in and zoom out of the map.
|
|
7
|
+
- [Navigate history forward and backward](#navigate-history-forward-and-backward): Two separate buttons that allow the user to navigate in the history of map views (e.g. jump back to previous map extent).
|
|
8
8
|
|
|
9
9
|
## Usage
|
|
10
10
|
|
package/ViewHistoryModel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewHistoryModel.js","sources":["ViewHistoryModel.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { MapModel } from \"@open-pioneer/map\";\nimport { View } from \"ol\";\nimport { EventsKey } from \"ol/events\";\nimport { unByKey } from \"ol/Observable\";\nimport OlMap from \"ol/Map\";\nimport { Reactive, reactive, ReactiveMap, reactiveMap } from \"@conterra/reactivity-core\";\nimport { Coordinate } from \"ol/coordinate\";\nimport { useEffect, useState } from \"react\";\n\ninterface MapViewState {\n /** Map resolution */\n resolution: number;\n\n /** Map center */\n center: Coordinate;\n}\n\nconst SIZE_LIMIT = 200;\n\nexport class ViewHistoryModel {\n private olMap: OlMap;\n private handle: EventsKey | undefined;\n\n private _mapViews: ReactiveMap<number, MapViewState> = reactiveMap<number, MapViewState>();\n private _activeViewId: Reactive<number> = reactive(0);\n\n constructor(map: MapModel) {\n this.olMap = map.olMap;\n this.handle = this.#subscribeToMapEvents();\n }\n\n destroy() {\n this.handle && unByKey(this.handle);\n this.handle = undefined;\n }\n\n get activeViewId(): number {\n return this._activeViewId.value;\n }\n\n get mapViews(): ReactiveMap<number, MapViewState> {\n return this._mapViews;\n }\n\n get canBackward(): boolean {\n return this.mapViews.get(this.activeViewId - 1) != null;\n }\n\n get canForward(): boolean {\n return this.mapViews.get(this.activeViewId + 1) != null;\n }\n\n backward = () => {\n if (this.canBackward) {\n this.#setActiveView(this.activeViewId - 1);\n this.#goto(this.activeViewId);\n } else throw new Error(\"Backward is not possible at the moment\");\n };\n\n forward = () => {\n if (this.canForward) {\n this.#setActiveView(this.activeViewId + 1);\n this.#goto(this.activeViewId);\n } else throw new Error(\"Forward is not possible at the moment\");\n };\n\n #goto(activeViewId: number) {\n const view = this.olMap.getView();\n this.olMap.setView(\n new View({\n center: this.mapViews.get(activeViewId)!.center,\n resolution: this.mapViews.get(activeViewId)!.resolution,\n projection: view.getProjection()\n })\n );\n }\n\n #setActiveView(activeViewId: number) {\n this._activeViewId.value = activeViewId;\n }\n\n #subscribeToMapEvents() {\n const eventsKey: EventsKey = this.olMap.on(\"moveend\", () => {\n onCenterResChange();\n });\n\n const onCenterResChange = () => {\n const olMap = this.olMap;\n const mapViews = this.mapViews;\n const view = olMap.getView();\n const resolution = view.getResolution();\n const center = view.getCenter();\n if (resolution != null && center != null) {\n if (\n center !== mapViews.get(this.activeViewId)?.center ||\n resolution !== mapViews.get(this.activeViewId)?.resolution\n ) {\n const mapState = {\n resolution: resolution,\n center: center\n };\n const nextViewId = this.activeViewId + 1;\n\n // Remove keys in the \"future\". Note: an array would probably be more efficient.\n for (const k of mapViews.keys()) {\n if (k > nextViewId) {\n mapViews.delete(k);\n }\n }\n\n // Remove old keys above limit (maps are sorted by insertion order, so this removes the oldest entries)\n for (const k of mapViews.keys()) {\n if (mapViews.size < SIZE_LIMIT) {\n break;\n }\n mapViews.delete(k);\n }\n\n this.#setActiveView(nextViewId);\n mapViews.set(nextViewId, mapState);\n }\n }\n };\n\n return eventsKey;\n }\n}\n\ninterface ViewModelState {\n vm: ViewHistoryModel;\n useCount: number; // 0 -> must destroy\n}\n\nconst VIEW_MODELS = new WeakMap<MapModel, ViewModelState>();\n\n/**\n * An internal hook that returns a shared HistoryViewModel.\n * History tools that are active at the same time share a single model.\n *\n * The model is destroyed when the last tool is unmounted.\n *\n * TODO: `undefined` only because the map can be undefined at the moment (loading).\n *\n * NOTE: May be useful to have this a general solution in the future; but this is the only usage right now.\n */\nexport function useHistoryViewModel(map: MapModel | undefined): ViewHistoryModel | undefined {\n const [vm, setVm] = useState<ViewHistoryModel>();\n useEffect(() => {\n if (!map) {\n return;\n }\n\n let state = VIEW_MODELS.get(map);\n if (state == null) {\n state = {\n vm: new ViewHistoryModel(map),\n useCount: 1\n };\n VIEW_MODELS.set(map, state);\n } else {\n state.useCount++;\n }\n setVm(state.vm);\n\n return () => {\n setVm(undefined);\n\n state.useCount--;\n if (state.useCount === 0) {\n state.vm.destroy();\n VIEW_MODELS.delete(map);\n }\n };\n }, [map]);\n return vm;\n}\n"],"names":[],"mappings":";;;;;AAmBA,MAAM,UAAa,GAAA,GAAA
|
|
1
|
+
{"version":3,"file":"ViewHistoryModel.js","sources":["ViewHistoryModel.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { MapModel } from \"@open-pioneer/map\";\nimport { View } from \"ol\";\nimport { EventsKey } from \"ol/events\";\nimport { unByKey } from \"ol/Observable\";\nimport OlMap from \"ol/Map\";\nimport { Reactive, reactive, ReactiveMap, reactiveMap } from \"@conterra/reactivity-core\";\nimport { Coordinate } from \"ol/coordinate\";\nimport { useEffect, useState } from \"react\";\n\ninterface MapViewState {\n /** Map resolution */\n resolution: number;\n\n /** Map center */\n center: Coordinate;\n}\n\nconst SIZE_LIMIT = 200;\n\nexport class ViewHistoryModel {\n private olMap: OlMap;\n private handle: EventsKey | undefined;\n\n private _mapViews: ReactiveMap<number, MapViewState> = reactiveMap<number, MapViewState>();\n private _activeViewId: Reactive<number> = reactive(0);\n\n constructor(map: MapModel) {\n this.olMap = map.olMap;\n this.handle = this.#subscribeToMapEvents();\n }\n\n destroy() {\n this.handle && unByKey(this.handle);\n this.handle = undefined;\n }\n\n get activeViewId(): number {\n return this._activeViewId.value;\n }\n\n get mapViews(): ReactiveMap<number, MapViewState> {\n return this._mapViews;\n }\n\n get canBackward(): boolean {\n return this.mapViews.get(this.activeViewId - 1) != null;\n }\n\n get canForward(): boolean {\n return this.mapViews.get(this.activeViewId + 1) != null;\n }\n\n backward = () => {\n if (this.canBackward) {\n this.#setActiveView(this.activeViewId - 1);\n this.#goto(this.activeViewId);\n } else throw new Error(\"Backward is not possible at the moment\");\n };\n\n forward = () => {\n if (this.canForward) {\n this.#setActiveView(this.activeViewId + 1);\n this.#goto(this.activeViewId);\n } else throw new Error(\"Forward is not possible at the moment\");\n };\n\n #goto(activeViewId: number) {\n const view = this.olMap.getView();\n this.olMap.setView(\n new View({\n center: this.mapViews.get(activeViewId)!.center,\n resolution: this.mapViews.get(activeViewId)!.resolution,\n projection: view.getProjection()\n })\n );\n }\n\n #setActiveView(activeViewId: number) {\n this._activeViewId.value = activeViewId;\n }\n\n #subscribeToMapEvents() {\n const eventsKey: EventsKey = this.olMap.on(\"moveend\", () => {\n onCenterResChange();\n });\n\n const onCenterResChange = () => {\n const olMap = this.olMap;\n const mapViews = this.mapViews;\n const view = olMap.getView();\n const resolution = view.getResolution();\n const center = view.getCenter();\n if (resolution != null && center != null) {\n if (\n center !== mapViews.get(this.activeViewId)?.center ||\n resolution !== mapViews.get(this.activeViewId)?.resolution\n ) {\n const mapState = {\n resolution: resolution,\n center: center\n };\n const nextViewId = this.activeViewId + 1;\n\n // Remove keys in the \"future\". Note: an array would probably be more efficient.\n for (const k of mapViews.keys()) {\n if (k > nextViewId) {\n mapViews.delete(k);\n }\n }\n\n // Remove old keys above limit (maps are sorted by insertion order, so this removes the oldest entries)\n for (const k of mapViews.keys()) {\n if (mapViews.size < SIZE_LIMIT) {\n break;\n }\n mapViews.delete(k);\n }\n\n this.#setActiveView(nextViewId);\n mapViews.set(nextViewId, mapState);\n }\n }\n };\n\n return eventsKey;\n }\n}\n\ninterface ViewModelState {\n vm: ViewHistoryModel;\n useCount: number; // 0 -> must destroy\n}\n\nconst VIEW_MODELS = new WeakMap<MapModel, ViewModelState>();\n\n/**\n * An internal hook that returns a shared HistoryViewModel.\n * History tools that are active at the same time share a single model.\n *\n * The model is destroyed when the last tool is unmounted.\n *\n * TODO: `undefined` only because the map can be undefined at the moment (loading).\n *\n * NOTE: May be useful to have this a general solution in the future; but this is the only usage right now.\n */\nexport function useHistoryViewModel(map: MapModel | undefined): ViewHistoryModel | undefined {\n const [vm, setVm] = useState<ViewHistoryModel>();\n useEffect(() => {\n if (!map) {\n return;\n }\n\n let state = VIEW_MODELS.get(map);\n if (state == null) {\n state = {\n vm: new ViewHistoryModel(map),\n useCount: 1\n };\n VIEW_MODELS.set(map, state);\n } else {\n state.useCount++;\n }\n setVm(state.vm);\n\n return () => {\n setVm(undefined);\n\n state.useCount--;\n if (state.useCount === 0) {\n state.vm.destroy();\n VIEW_MODELS.delete(map);\n }\n };\n }, [map]);\n return vm;\n}\n"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AAA;AACH,MAAM,KAAA,CAAA,QAAA,EAAA;AAAA;AAEV,IAAA,KAAA,CAAM,MAAM,EAAE,CAAA;AAEd,IAAA,OAAO,MAAM;AACT,MAAA,KAAA,CAAM,MAAS,CAAA;AAEf,MAAM,KAAA,CAAA,QAAA,EAAA;AACN,MAAI,IAAA,KAAA,CAAM,aAAa,CAAG,EAAA;AACtB,QAAA,KAAA,CAAM,GAAG,OAAQ,EAAA;AACjB,QAAA,WAAA,CAAY,OAAO,GAAG,CAAA;AAAA;AAC1B,KACJ;AAAA,GACJ,EAAG,CAAC,GAAG,CAAC,CAAA;AACR,EAAO,OAAA,EAAA;AACX;;;;"}
|
package/Zoom.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Zoom.js","sources":["Zoom.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonProps } from \"@open-pioneer/chakra-integration\";\nimport { MapModelProps, useMapModel } from \"@open-pioneer/map\";\nimport { ToolButton } from \"@open-pioneer/map-ui-components\";\nimport { CommonComponentProps, useCommonComponentProps } from \"@open-pioneer/react-utils\";\nimport { PackageIntl } from \"@open-pioneer/runtime\";\nimport classNames from \"classnames\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { FC, ForwardedRef, RefAttributes, forwardRef, useState } from \"react\";\nimport { FiMinus, FiPlus } from \"react-icons/fi\";\n\nexport type ZoomInProps = Omit<ZoomProps, \"zoomDirection\">;\n\n/**\n * Provides a button by which the user can zoom into the map.\n *\n * This component composes {@link Zoom}.\n */\nexport const ZoomIn: FC<ZoomInProps> = forwardRef(function ZoomIn(props, ref) {\n return <Zoom zoomDirection=\"in\" ref={ref} {...props} />;\n});\n\nexport type ZoomOutProps = ZoomInProps;\n\n/**\n * Provides a button by which the user can zoom out of the map.\n *\n * This component composes {@link Zoom}.\n */\nexport const ZoomOut: FC<ZoomOutProps> = forwardRef(function ZoomOut(props, ref) {\n return <Zoom zoomDirection=\"out\" ref={ref} {...props} />;\n});\n\nexport interface ZoomProps\n extends CommonComponentProps,\n RefAttributes<HTMLButtonElement>,\n MapModelProps {\n /**\n * Additional properties for the `Button` element.\n *\n * Note that the ToolButton also defines some of these props.\n */\n buttonProps?: Partial<ButtonProps>;\n\n /**\n * The zoom direction.\n *\n * The button will either zoom in or zoom out depending on this value.\n */\n zoomDirection: \"in\" | \"out\";\n}\n\n/**\n * Provides a button by which the user can zoom in or zoom out of the map.\n */\nexport const Zoom: FC<ZoomProps> = forwardRef(function Zoom(\n props: ZoomProps,\n ref: ForwardedRef<HTMLButtonElement>\n) {\n const { buttonProps, zoomDirection } = props;\n const { map } = useMapModel(props);\n const intl = useIntl();\n const [disabled, setDisabled] = useState<boolean>(false);\n const { defaultClassName, buttonLabel, buttonIcon } = getDirectionProps(intl, zoomDirection);\n\n const { containerProps } = useCommonComponentProps(classNames(\"zoom\", defaultClassName), props);\n\n function zoom() {\n if (disabled) {\n return;\n }\n setDisabled(true);\n const view = map?.olView;\n let currZoom = map?.zoomLevel;\n\n const maxZoom = view?.getMaxZoom() || Number.MAX_SAFE_INTEGER;\n const minZoom = view?.getMinZoom() || 0;\n if (view && currZoom !== undefined) {\n if (zoomDirection === \"in\" && currZoom < maxZoom) {\n ++currZoom;\n } else if (zoomDirection === \"out\" && currZoom > minZoom) {\n --currZoom;\n }\n\n view.animate({ zoom: currZoom, duration: 200 }, () => setDisabled(false));\n }\n }\n\n return (\n <ToolButton\n ref={ref}\n buttonProps={buttonProps}\n label={buttonLabel}\n icon={buttonIcon}\n onClick={zoom}\n {...containerProps}\n />\n );\n});\n\nfunction getDirectionProps(intl: PackageIntl, zoomDirection: \"in\" | \"out\") {\n switch (zoomDirection) {\n case \"in\":\n return {\n defaultClassName: \"zoom-in\",\n buttonLabel: intl.formatMessage({ id: \"zoom-in.title\" }),\n buttonIcon: <FiPlus />\n };\n case \"out\":\n return {\n defaultClassName: \"zoom-out\",\n buttonLabel: intl.formatMessage({ id: \"zoom-out.title\" }),\n buttonIcon: <FiMinus />\n };\n }\n}\n"],"names":["ZoomIn","ZoomOut","Zoom"],"mappings":";;;;;;;;;AAmBO,MAAM,MAA0B,GAAA,UAAA,CAAW,SAASA,OAAAA,CAAO,OAAO,GAAK,EAAA;AAC1E,EAAA,2BAAQ,IAAK,EAAA,EAAA,aAAA,EAAc,IAAK,EAAA,GAAA,EAAW,GAAG,KAAO,EAAA,CAAA
|
|
1
|
+
{"version":3,"file":"Zoom.js","sources":["Zoom.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonProps } from \"@open-pioneer/chakra-integration\";\nimport { MapModelProps, useMapModel } from \"@open-pioneer/map\";\nimport { ToolButton } from \"@open-pioneer/map-ui-components\";\nimport { CommonComponentProps, useCommonComponentProps } from \"@open-pioneer/react-utils\";\nimport { PackageIntl } from \"@open-pioneer/runtime\";\nimport classNames from \"classnames\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { FC, ForwardedRef, RefAttributes, forwardRef, useState } from \"react\";\nimport { FiMinus, FiPlus } from \"react-icons/fi\";\n\nexport type ZoomInProps = Omit<ZoomProps, \"zoomDirection\">;\n\n/**\n * Provides a button by which the user can zoom into the map.\n *\n * This component composes {@link Zoom}.\n */\nexport const ZoomIn: FC<ZoomInProps> = forwardRef(function ZoomIn(props, ref) {\n return <Zoom zoomDirection=\"in\" ref={ref} {...props} />;\n});\n\nexport type ZoomOutProps = ZoomInProps;\n\n/**\n * Provides a button by which the user can zoom out of the map.\n *\n * This component composes {@link Zoom}.\n */\nexport const ZoomOut: FC<ZoomOutProps> = forwardRef(function ZoomOut(props, ref) {\n return <Zoom zoomDirection=\"out\" ref={ref} {...props} />;\n});\n\nexport interface ZoomProps\n extends CommonComponentProps,\n RefAttributes<HTMLButtonElement>,\n MapModelProps {\n /**\n * Additional properties for the `Button` element.\n *\n * Note that the ToolButton also defines some of these props.\n */\n buttonProps?: Partial<ButtonProps>;\n\n /**\n * The zoom direction.\n *\n * The button will either zoom in or zoom out depending on this value.\n */\n zoomDirection: \"in\" | \"out\";\n}\n\n/**\n * Provides a button by which the user can zoom in or zoom out of the map.\n */\nexport const Zoom: FC<ZoomProps> = forwardRef(function Zoom(\n props: ZoomProps,\n ref: ForwardedRef<HTMLButtonElement>\n) {\n const { buttonProps, zoomDirection } = props;\n const { map } = useMapModel(props);\n const intl = useIntl();\n const [disabled, setDisabled] = useState<boolean>(false);\n const { defaultClassName, buttonLabel, buttonIcon } = getDirectionProps(intl, zoomDirection);\n\n const { containerProps } = useCommonComponentProps(classNames(\"zoom\", defaultClassName), props);\n\n function zoom() {\n if (disabled) {\n return;\n }\n setDisabled(true);\n const view = map?.olView;\n let currZoom = map?.zoomLevel;\n\n const maxZoom = view?.getMaxZoom() || Number.MAX_SAFE_INTEGER;\n const minZoom = view?.getMinZoom() || 0;\n if (view && currZoom !== undefined) {\n if (zoomDirection === \"in\" && currZoom < maxZoom) {\n ++currZoom;\n } else if (zoomDirection === \"out\" && currZoom > minZoom) {\n --currZoom;\n }\n\n view.animate({ zoom: currZoom, duration: 200 }, () => setDisabled(false));\n }\n }\n\n return (\n <ToolButton\n ref={ref}\n buttonProps={buttonProps}\n label={buttonLabel}\n icon={buttonIcon}\n onClick={zoom}\n {...containerProps}\n />\n );\n});\n\nfunction getDirectionProps(intl: PackageIntl, zoomDirection: \"in\" | \"out\") {\n switch (zoomDirection) {\n case \"in\":\n return {\n defaultClassName: \"zoom-in\",\n buttonLabel: intl.formatMessage({ id: \"zoom-in.title\" }),\n buttonIcon: <FiPlus />\n };\n case \"out\":\n return {\n defaultClassName: \"zoom-out\",\n buttonLabel: intl.formatMessage({ id: \"zoom-out.title\" }),\n buttonIcon: <FiMinus />\n };\n }\n}\n"],"names":["ZoomIn","ZoomOut","Zoom"],"mappings":";;;;;;;;;AAmBO,MAAM,M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4
|
+
"version": "0.9.0-dev.20250224083536",
|
|
5
5
|
"description": "This package provides a collection of map navigation controls.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"open-pioneer-trails"
|
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@conterra/reactivity-core": "^0.4.3",
|
|
18
|
-
"@open-pioneer/chakra-integration": "
|
|
19
|
-
"@open-pioneer/react-utils": "
|
|
20
|
-
"@open-pioneer/reactivity": "
|
|
21
|
-
"@open-pioneer/runtime": "
|
|
18
|
+
"@open-pioneer/chakra-integration": "3.0.0-dev.20250221111321",
|
|
19
|
+
"@open-pioneer/react-utils": "3.0.0-dev.20250221111321",
|
|
20
|
+
"@open-pioneer/reactivity": "3.0.0-dev.20250221111321",
|
|
21
|
+
"@open-pioneer/runtime": "3.0.0-dev.20250221111321",
|
|
22
22
|
"classnames": "^2.3.2",
|
|
23
|
-
"ol": "^10.
|
|
24
|
-
"react": "^
|
|
23
|
+
"ol": "^10.4.0",
|
|
24
|
+
"react": "^19.0.0",
|
|
25
25
|
"react-icons": "^5.3.0",
|
|
26
|
-
"@open-pioneer/map": "^0.9.0-dev.
|
|
27
|
-
"@open-pioneer/map-ui-components": "^0.9.0-dev.
|
|
26
|
+
"@open-pioneer/map": "^0.9.0-dev.20250224083536",
|
|
27
|
+
"@open-pioneer/map-ui-components": "^0.9.0-dev.20250224083536"
|
|
28
28
|
},
|
|
29
29
|
"exports": {
|
|
30
30
|
"./package.json": "./package.json",
|