Skip to content

Commit

Permalink
Change multiSelect to boxSelect
Browse files Browse the repository at this point in the history
  • Loading branch information
dopenguin committed Nov 8, 2024
1 parent f6ef6ab commit da374f2
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/clients/snowbox/src/mapConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export const mapConfiguration = {
gfi: {
mode: 'bboxDot',
activeLayerPath: 'plugin/layerChooser/activeMaskIds',
boxSelect: true,
layers: {
[uBahn]: {
geometry: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/Gfi/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

- Breaking: Upgrade `@masterportal/masterportalapi` from `2.8.0` to `2.40.0` and subsequently `ol` from `^7.1.0` to `^9.2.4`.
- Feature: Add new configuration parameter `isSelectable` that can be used to filter features to be unselectable.
- Feature: Add new configuration parameters `directSelect` and `multiSelect` to be able to select multiple features at once.
- Feature: Add new configuration parameters `directSelect` and `boxSelect` to be able to select multiple features at once.
- Fix: Adjust documentation to properly describe optionality of configuration parameters.
- Fix: Add missing configuration parameters `featureList` and `maxFeatures` to the general documentation and `filterBy` and `format` to `gfi.gfiLayerConfiguration`
- Fix: Add missing entry of `gfiContentComponent` to `GfiGetters`.
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/Gfi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ The GFI plugin can be used to fetch and optionally display GFI (GetFeatureInfo)
| layers | Record<string, gfiLayerConfiguration> | Maps a string (must be a layer ID) to a behaviour configuration for that layer. |
| activeLayerPath | string? | Optional store path to array of active mask layer ids. If used with `LayerChooser`, setting this to `'plugin/layerChooser/activeMaskIds'` will result in an info text in the GFI box, should no layer be active. If used without `LayerChooser`, the active mask layers have to be provided by another plugin or the client. If not set, the GFI plugin may e.g. show an empty list, which may be confusing to some users. |
| afterLoadFunction | function (featuresByLayerId: Record<string, GeoJsonFeature[]>): Record<layerId, GeoJsonFeature[]>? | This method can be used to extend, filter, or otherwise modify a GFI result. |
| boxSelect | boolean? | If set to `true`, multiple features can be selected at once by using the modifier key (CTRL on Windows or Command on macOS) and dragging the mouse. Similar to `gfi.directSelect`, features can be added and removed by selection / unselecting them. Does not work together with `extendedMasterportalapiMarkers` of `@polar/core`. Defaults to `false`. |
| customHighlightStyle | customHighlighStyle? | If required a user can change the stroke and fill of the highlighted feature. The default style as seen in the example will be used for each part that is not customized. An empty object will return the complete default style while e.g. for an object without a configured fill the default fill will be applied. |
| directSelect | boolean? | If set to `true`, a feature can be selected without defining a value in `gfi.coordinateSources`. It is also possible to add multiple features to the selection by using the modifier key (CTRL on Windows or Command on macOS). To delesect a feature, simply reclick it with the modifier key pressed. To create a new selection, click anywhere else without pressing the modifier key. Be careful when using this parameter together with some values set in `coordinateSources` as it may lead to unexpected results. Does not work together with `extendedMasterportalapiMarkers` of `@polar/core`. Defaults to `false`. |
| featureList | featureList? | If defined, a list of available vector layer features is visible when no feature is selected. Only usable if `renderType` is set to `iconMenu` and `window` is set to `true` for at least one configured layer. |
| gfiContentComponent | VueConstructor? | Allows overriding the GfiContent.vue component for custom design and functionality. Coding knowledge is required to use this feature, as any implementation will have to rely upon the VueX store model. Please refer to the implementation. |
| maxFeatures | number? | Limits the viewable GFIs per layer by this number. The first n elements are chosen arbitrarily. Useful if you e.g. just want one result, or to limit an endless stream of returns to e.g. 10. Infinite by default. |
| mode | enum["bboxDot", "intersects"]? | Method of calculating which feature has been chosen by the user. `bboxDot` utilizes the `bbox`-url parameter using the clicked coordinate while `intersects` uses a `Filter` to calculate the intersected features. Layers can have their own `gfiMode` parameter which would override this global mode. To apply this, add the desired value to the parameter in the `mapConfiguration`. Defaults to `'bboxDot'`. |
| multiSelect | boolean? | If set to `true`, multiple features can be selected at once by using the modifier key (CTRL on Windows or Command on macOS) and dragging the mouse. Similar to `gfi.directSelect`, features can be added and removed by selection / unselecting them. Does not work together with `extendedMasterportalapiMarkers` of `@polar/core`. Defaults to `false`. |
| renderType | ('iconMenu' \| 'independent')? | Only relevant if `window` is set to `true` for at least one layer. Whether the gfi plugin is rendered independently or as part of the IconMenu. Defaults to 'independent'. |

For details on the `displayComponent` attribute, refer to the [Global Plugin Parameters](../../core/README.md#global-plugin-parameters) section of `@polar/core`.
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/Gfi/src/store/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const makeActions = () => {
}
},
setupMultiSelection({ dispatch, getters, rootGetters }) {
if (getters.gfiConfiguration.multiSelect) {
if (getters.gfiConfiguration.boxSelect) {
const dragBox = new DragBox({ condition: platformModifierKeyOnly })
dragBox.on('boxend', () =>
dispatch('getFeatureInfo', {
Expand Down
2 changes: 1 addition & 1 deletion packages/types/custom/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
- Feature: Add new utility type `PartialBy`.
- Feature: Add new type `MasterportalApiConfig`.
- Feature: Change `MapConfig` to allow for partial configuration as some parameters have default values and have it be extended from `MasterportalApiConfig`.
- Feature: Add new configuration parameter `directSelect` and `multiSelect` to `GfiConfiguration`.
- Feature: Add new configuration parameter `directSelect` and `boxSelect` to `GfiConfiguration`.
- Fix: Document missing return type to `afterLoadFunction`, which may also return a Promise.
- Fix: Add `string` as option for `SearchType` since arbitrary strings can be registered.
- Fix: Remove unused parameters `proxyUrl` and `loadingStrategy` from `LayerConfigurationOptions`.
Expand Down
2 changes: 1 addition & 1 deletion packages/types/custom/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ export interface GfiConfiguration extends PluginOptions {
*/
maxFeatures?: number
mode?: 'bboxDot' | 'intersects'
multiSelect?: boolean
boxSelect?: boolean
renderType?: RenderType
}

Expand Down

0 comments on commit da374f2

Please sign in to comment.