Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add measure tool #124

Open
wants to merge 115 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
8da31e4
Measure Tool working for Distances
LDWiegand Apr 10, 2024
5fabc3a
Added Area
LDWiegand Apr 11, 2024
95b1c7c
Measure with Geometry.getLength and getArea()
LDWiegand Apr 12, 2024
b65e333
Renaming the tool
LDWiegand Apr 15, 2024
d8efe41
Merge create-Folders in utils + Comments
LDWiegand Apr 16, 2024
1c5022b
Removing the Dataportal-Client, fixing the Distance/Area-Switch
LDWiegand Apr 18, 2024
98b68f4
Fix Lint-Errors
LDWiegand Apr 18, 2024
9db8643
Syntax Changes + Comments
LDWiegand Apr 19, 2024
a676f90
add measure plugin to snowbox's package.json
warm-coolguy Apr 26, 2024
c6beefa
update the top level documentation files
warm-coolguy Apr 26, 2024
17e61c2
add error message on invalid geometry
warm-coolguy Apr 26, 2024
c90e79e
remove unpublished dependency
warm-coolguy Apr 26, 2024
4ed5022
fix naming in comments
warm-coolguy Apr 26, 2024
5a84d61
add missing i18n
warm-coolguy Apr 29, 2024
249f1d1
fix unnecessary vertical scrollbar in FF
warm-coolguy Apr 29, 2024
108d372
change vue file name scheme to usual naming
warm-coolguy Apr 29, 2024
5f2c8c0
refactor code to meet lint requirements
warm-coolguy Apr 29, 2024
000b98b
add linting override for list-like functions
warm-coolguy Apr 29, 2024
45e06b3
remove error log (exit condition is workflow part)
warm-coolguy Apr 29, 2024
682308c
refactor to meet linting criteria
warm-coolguy Apr 29, 2024
a110a52
refactor to meet lint criteria
warm-coolguy Apr 29, 2024
7b985d9
refactor to meet linting requirements
warm-coolguy Apr 29, 2024
66a5b96
Merge branch 'main' of https://github.com/Dataport/polar into feature…
warm-coolguy Apr 29, 2024
aab4117
delete script for removed client
warm-coolguy Apr 29, 2024
053cf74
remove misplaced dependency
warm-coolguy Apr 29, 2024
398590f
Merge branch 'main' into feature/add-measure-tool
warm-coolguy May 30, 2024
4b2db52
Merge branch 'main' into feature/add-measure-tool
dopenguin May 31, 2024
b197cf5
Merge branch 'main' into feature/add-measure-tool
dopenguin Jun 4, 2024
60a1651
Merge branch 'main' into feature/add-measure-tool
warm-coolguy Jul 19, 2024
a18213a
Merge branch 'main' into feature/add-measure-tool
dopenguin Aug 5, 2024
5c847e6
Merge branch 'main' into feature/add-measure-tool
dopenguin Aug 12, 2024
fbd995c
Merge branch 'main' into feature/add-measure-tool
dopenguin Aug 14, 2024
1197b9c
Merge branch 'main' into feature/add-measure-tool
dopenguin Aug 14, 2024
244c7a5
Merge branch 'main' into feature/add-measure-tool
warm-coolguy Sep 5, 2024
3c81249
Merge branch 'main' into feature/add-measure-tool
dopenguin Dec 4, 2024
7d42e2c
Fix type issues related to the OpenLayers upgrade
dopenguin Dec 4, 2024
04b1e44
Merge branch 'main' into feature/add-measure-tool
dopenguin Dec 6, 2024
7f0211b
Adjust changelog of @polar/plugin-measure to be inline with the rest
dopenguin Dec 6, 2024
942cf80
Merge branch 'main' into feature/add-measure-tool
dopenguin Dec 11, 2024
fd18527
Done
dopenguin Dec 17, 2024
8c95d66
Done
dopenguin Dec 17, 2024
7a75d6d
Done
dopenguin Dec 17, 2024
1377a1d
Done
dopenguin Dec 17, 2024
9aeb501
Add new configuration options to @polar/plugin-measure
dopenguin Dec 17, 2024
e491ce2
Move RadioCard.vue from @polar/plugin-draw to @polar/core
dopenguin Dec 17, 2024
4cbd82f
Adjust a multitude of things
dopenguin Dec 17, 2024
7ad4fb7
Merge upstream branch
dopenguin Dec 18, 2024
0da5baf
Merge branch 'main' into feature/add-measure-tool
dopenguin Dec 19, 2024
9e84f1f
Fix linting issue
dopenguin Dec 19, 2024
0195e81
Remove unused code
dopenguin Dec 19, 2024
fd16d83
Fix type issue regarding undefined textStyle
dopenguin Dec 19, 2024
e8395b1
Use correct type for getters
dopenguin Dec 19, 2024
67df0c3
Re-add type to use it in another file as well
dopenguin Dec 19, 2024
d823408
Add whitespace
dopenguin Dec 19, 2024
6922d28
Move createDeleteInteraction to the correct place
dopenguin Dec 19, 2024
b1160b3
Adjust deletion process to be able to only delete corners
dopenguin Dec 19, 2024
71d90cb
Rename interface
dopenguin Dec 19, 2024
f23463e
Remove todo
dopenguin Dec 19, 2024
d9c87db
Remove unused locales and remove now redundant nesting
dopenguin Dec 19, 2024
76c9e0f
Use RadioCard instead of v-switch for cleaner UI
dopenguin Dec 19, 2024
feadbdc
Add transparent border to delete button to stop the wiggle
dopenguin Dec 19, 2024
b4399f7
Fix local version of custom types not being used by linking them again
dopenguin Dec 26, 2024
05fa7c1
Fix issue of directSelect working if draw is enabled
dopenguin Dec 30, 2024
58c3881
Add additional mode 'none' and internal variable to select interaction
dopenguin Dec 30, 2024
058d88a
Move action setupTooltip to a separate file to adhere to linting rules
dopenguin Dec 30, 2024
9fe6fa8
Use external package to be able to convert all hex values to rgb(a)
dopenguin Dec 30, 2024
e1fd916
Fix issue of some lines not being deleted
dopenguin Dec 30, 2024
3a0472b
Add information on how the deletion process works
dopenguin Jan 2, 2025
60a5cf1
Move actions to the correct place and ease usage of parameters
dopenguin Jan 2, 2025
cc58d24
Merge branch 'main' into feature/add-measure-tool
dopenguin Jan 4, 2025
196fea6
Merge branch 'main' into feature/add-measure-tool
dopenguin Jan 6, 2025
234cf9d
Merge branch 'main' into feature/add-measure-tool
warm-coolguy Jan 6, 2025
1f93fdb
Move @polar/core to be a peerDependency instead of a dependency
dopenguin Jan 6, 2025
9c749c4
Add used getters as documented values
dopenguin Jan 6, 2025
df4c565
Use includes instead of indexOf
dopenguin Jan 6, 2025
640d5a2
Rephrase German translation to be more polite
dopenguin Jan 6, 2025
6a19439
Adjust min-width to remove linebreak on no selection
dopenguin Jan 6, 2025
e2d7079
Fix linting error added in df4c5650
dopenguin Jan 6, 2025
7efb08e
Add units to locales
dopenguin Jan 6, 2025
6538e6f
Remove unused method
dopenguin Jan 6, 2025
8b7258f
Remove adjusted styling of lines in delete mode
dopenguin Jan 6, 2025
6099fe1
Rename specialStyle to currentModeStyle
dopenguin Jan 6, 2025
2722da6
Merge branch 'main' into feature/add-measure-tool
dopenguin Jan 10, 2025
c0d8153
Merge branch 'main' into feature/add-measure-tool
warm-coolguy Jan 20, 2025
9241dda
Merge branch 'main' into feature/add-measure-tool
warm-coolguy Jan 20, 2025
120fb5f
Merge branch 'main' into feature/add-measure-tool
warm-coolguy Jan 21, 2025
e9ab080
Merge branch 'main' into feature/add-measure-tool
warm-coolguy Jan 22, 2025
775f4db
Add documentation for new configuration parameter measureMode
dopenguin Jan 23, 2025
452926f
Add @turf/center-of-mass as a dependency for later use
dopenguin Jan 23, 2025
b1a1d60
Add relevant values to the store for measureMode
dopenguin Jan 23, 2025
7b867de
Add the radio for selecting measurements to the ui
dopenguin Jan 23, 2025
6211874
Adjust createDrawStyle to add the measured values to the drawn geometry
dopenguin Jan 23, 2025
ba62b3f
Change measureOptions to allow choosing which options can be selected
dopenguin Jan 23, 2025
c51dd95
Merge branch 'main' into feature/add-measure-tool
warm-coolguy Jan 23, 2025
35c5542
Use correct label representing the correct thing one can do when drawing
dopenguin Jan 23, 2025
fe57ab4
Fix some types to correctly reflect that they represent an object
dopenguin Jan 23, 2025
f318e29
Update initial drawMode to a selectable value if default is unselectable
dopenguin Jan 23, 2025
9dfba44
Extend measureOptions to optionally set a different initial option
dopenguin Jan 23, 2025
f78bf70
Implement initialOption for measureOptions
dopenguin Jan 23, 2025
08b8b25
Add measureOptions to @polar/snowbox
dopenguin Jan 23, 2025
cdf7047
Remove now migrated @polar/plugin-measure
dopenguin Jan 23, 2025
372e960
Merge remote-tracking branch 'refs/remotes/origin/feature/add-measure…
dopenguin Jan 23, 2025
24e386b
Remove unused subscriptions and html elements
dopenguin Jan 23, 2025
b32ee58
Refactor filter function call to please the linter
dopenguin Jan 23, 2025
d28bb91
Fix @polar/plugin-draw e2e tests
dopenguin Jan 23, 2025
58b15cd
Remove measure locales from @polar/plugin-icon-menu
dopenguin Jan 23, 2025
9597c25
Add missing changelog
dopenguin Jan 23, 2025
7aebb05
Update packages/plugins/Draw/README.md
dopenguin Jan 24, 2025
cc34f1b
Correctly place changelog entry
dopenguin Jan 24, 2025
28193f9
Add missing word in changelog
dopenguin Jan 24, 2025
518918d
Change wording
dopenguin Jan 24, 2025
e5c2485
Refactor filter function for ease of readability
dopenguin Jan 24, 2025
05194aa
Change filter and some function to be easier to read
dopenguin Jan 24, 2025
4089d78
Adjust changelog in precision
dopenguin Jan 24, 2025
8087760
Fix linting issues introduced after suggestion
dopenguin Jan 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions e2e/draw.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test('clicks to the map produce a fetchable pin coordinate', async ({
y += height / 2

await page.getByLabel('Draw tools').click()
await page.getByText('Draw and write').click()
await page.getByText('Draw, write and measure').click()
await page.getByText('Polygon').click()

const moves: [number, number, string][] = [
Expand Down Expand Up @@ -56,7 +56,7 @@ test('two features drawn at the same coordinate can be modified separately', asy
y += height / 2

await page.getByLabel('Draw tools').click()
await page.getByText('Draw and write').click()
await page.getByText('Draw, write and measure').click()
await page.getByText('Point').click()

await page.mouse.click(x, y)
Expand Down
1,614 changes: 979 additions & 635 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions packages/clients/snowbox/src/mapConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ export const mapConfiguration = {
],
},
draw: {
measureOptions: {
metres: true,
kilometres: true,
hectares: true,
},
selectableDrawModes: ['Circle', 'LineString', 'Point', 'Polygon', 'Text'],
textStyle: {
font: {
Expand Down
5 changes: 4 additions & 1 deletion packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# CHANGELOG

## 2.0.1
## unpublished

- Feature: Add new reusable component `RadioCard.vue` to the package.
dopenguin marked this conversation as resolved.
Show resolved Hide resolved

## 2.0.1
- Fix: Add `crossOrigin` differently to layer sources that are an instance of `ImageWMS` as they require it being set as `crossOrigin_` to be recognized.
- Fix: Add missing `font-family` css so that tooltips are always `Arial, sans-serif`.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<div>
<v-card-title :id="`polar-draw-${id}`">{{ $t(title) }}</v-card-title>
<v-card-title :id="`polar-${id}`">{{ $t(title) }}</v-card-title>
<v-card-text>
<v-radio-group
:aria-labelledby="`polar-draw-${id}`"
:aria-labelledby="`polar-${id}`"
dense
hide-details
:value="initialValue"
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { default as MapContainer } from './MapContainer.vue'
export { default as RadioCard } from './RadioCard.vue'
1 change: 1 addition & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import './monkeyCrossOrigin'
import './monkeyHeaderLoader'

export { NineLayout, NineLayoutTag } from './components/layouts'
export { RadioCard } from './components'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't this part of the @polar/components package? While that package was a little pointless for the MoveHandle.vue since that's only used in the core after all, RadioCard.vue seems to be a good general-purpose component that might finde reuse in other plugins later, and putting it in the components package will result in a nicer dependency graph.

But I remember we talked about this previously, and maybe I forgot some conclusion we came to?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last year, in the wake of #108, we had decided to deprecate @polar/components and move MoveHandle.vue to @polar/core. As that branch has not been merged yet, that change is not reflected in the current state.

IMO, having reusable components in either place seems fine. However, I currently lean towards @polar/core as that package will always be a part of any client and any plugin can rely that @polar/core exists.
On the other hand, it seems fitting to place it in a separate package to be inline with the current architecture and have a better separation of concerns.

I believe it may seem fitting to ☎️ and lay out the pros and cons.

export { setLayout, getLayout } from './utils/layout'
export { default as mpapiDefaults } from './utils/createMap/defaults'

Expand Down
7 changes: 7 additions & 0 deletions packages/plugins/Draw/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# CHANGELOG

## unpublished

- Feature: Add new configuration parameter `measureOptions` to allow users to select a measurement mode when drawing a feature. This way, a length / area in the selected unit is added to the drawn feature.
- Fix: Update initial value of `drawMode` to a selectable value if the default `Point` is not a drawable option.
- Fix: Adjust type `DrawGetters` regarding its keys `selectableDrawModes` and `selectableModes` to correctly reflect that they represent objects.
- Chore: Add `@polar/core` as a dependency as the component `RadioCard.vue` has been moved from this package to `@polar/core`.

## 2.0.0

- Breaking: Upgrade peerDependency `ol` from `^7.1.0` to `^9.2.4`.
Expand Down
10 changes: 10 additions & 0 deletions packages/plugins/Draw/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ The styling of the drawn features can be configured to overwrite the default ol-
| fieldName | type | description |
| - | - | - |
| enableOptions | boolean? | If `true`, draw options are displayed, like choosing and changing stroke color. Not available for texts features. Defaults to `false`. |
| measureOptions | measureOptions? | If set, an additional radio is being shown to the user to be able to let the (then) drawn features display their length and / or area. See [draw.measureOptions](#drawmeasureoptions) for further information. Not shown by default. |
| selectableDrawModes | string[]? | List 'Point', 'LineString', 'Circle', 'Text' and/or 'Polygon' as desired. All besides 'Text' are selectable by default. |
| style | style? | Please see example below for styling options. Defaults to standard OpenLayers styling. |
| textStyle | textStyle? | Use this object with properties 'font' and 'textColor' to style text feature. |
Expand Down Expand Up @@ -70,6 +71,15 @@ draw: {

</details>

#### draw.measureOptions

| fieldName | type | description |
| - | - | - |
| metres | boolean? | Whether to show the measure option `'m / m²'` to the user. `false` by default. |
| kilometres | boolean? | Whether to show the measure option `'km / km²'` to the user. `false` by default. |
| hectares | boolean? | Whether to show the measure option `'km / ha‚'` to the user. `false` by default. |
| initialOption | 'none' \| 'meters' \| 'kilometres' \| 'hectares' | The initial measure option to be selected. Defaults to `'none'`. |

#### draw.textStyle

| fieldName | type | description |
Expand Down
4 changes: 4 additions & 0 deletions packages/plugins/Draw/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
"src/**/*",
"CHANGELOG.md"
],
"dependencies": {
"@turf/center-of-mass": "^7.2.0"
},
"peerDependencies": {
"@polar/core": "^2.0.0",
"@repositoryname/vuex-generators": "^1.1.2",
"ol": "^9.2.4",
"vue": "^2.6.14",
Expand Down
32 changes: 22 additions & 10 deletions packages/plugins/Draw/src/components/Draw.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,29 @@
<v-scroll-x-reverse-transition>
<v-card class="polar-draw-menu" :style="flexStyle">
<RadioCard
id="mode"
id="draw-mode"
title="common:plugins.draw.title.mode"
:initial-value="mode"
:values="selectableModes"
:change-callback="setMode"
></RadioCard>
<RadioCard
v-if="mode === 'draw'"
id="drawMode"
id="draw-drawMode"
title="common:plugins.draw.title.drawMode"
:initial-value="drawMode"
:values="selectableDrawModes"
:change-callback="setDrawMode"
></RadioCard>
<DrawOptions v-if="showDrawOptions" />
<RadioCard
v-if="showMeasureOptions"
id="draw-measure"
title="common:plugins.draw.title.measureMode"
:initial-value="measureMode"
:values="selectableMeasureModes"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"km / km²" and "km / ha" are redundant in LineString mode. I propose we reduce the available options' display texts to "m" and "km" only.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woops, something I forgot to add yesterday. Was still on my stack - will add this!

:change-callback="setMeasureMode"
></RadioCard>
<v-subheader v-if="showSizeSlider" class="align-end">{{
$t('common:plugins.draw.label.textSize')
}}</v-subheader>
Expand Down Expand Up @@ -46,7 +54,7 @@
<script lang="ts">
import Vue from 'vue'
import { mapActions, mapGetters } from 'vuex'
import RadioCard from './RadioCard.vue'
import { RadioCard } from '@polar/core'
import DrawOptions from './DrawOptions.vue'

export default Vue.extend({
Expand All @@ -61,16 +69,19 @@ export default Vue.extend({
computed: {
...mapGetters(['hasSmallHeight', 'hasWindowSize']),
...mapGetters('plugin/draw', [
'mode',
'drawMode',
'fontSizes',
'measureMode',
'mode',
'selectableDrawModes',
'selectableMeasureModes',
'selectableModes',
'textInput',
'showTextInput',
'showDrawOptions',
'showMeasureOptions',
'selectedSize',
'fontSizes',
'showSizeSlider',
'showDrawOptions',
'showTextInput',
'textInput',
]),
flexStyle(): string {
return `flex-direction: ${
Expand All @@ -80,10 +91,11 @@ export default Vue.extend({
},
methods: {
...mapActions('plugin/draw', [
'setMode',
'setDrawMode',
'setTextInput',
'setMeasureMode',
'setMode',
'setSelectedSize',
'setTextInput',
]),
},
})
Expand Down
22 changes: 20 additions & 2 deletions packages/plugins/Draw/src/language.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ const language: LanguageOption[] = [
mode: {
none: 'Keine Interaktion',
draw: 'Zeichnen',
measure: 'Zeichnen und Messen',
write: 'Zeichnen und Schreiben',
writeAndMeasure: 'Zeichnen, Schreiben und Messen',
edit: 'Bearbeiten',
delete: 'Löschen',
},
Expand All @@ -20,12 +22,19 @@ const language: LanguageOption[] = [
polygon: 'Polygon',
text: 'Text',
},
measureMode: {
none: 'Keine Messung',
metres: 'm / m²',
kilometres: 'km / km²',
hectares: 'km / ha',
},
options: {
stroke: 'Linienfarbe',
},
title: {
mode: 'Modus',
drawMode: 'Zeichenmodus',
mode: 'Modus',
measureMode: 'Messmodus',
options: 'Zeichenoptionen',
},
label: {
Expand All @@ -43,7 +52,9 @@ const language: LanguageOption[] = [
mode: {
none: 'No interaction',
draw: 'Draw',
measure: 'Draw and measure',
write: 'Draw and write',
writeAndMeasure: 'Draw, write and measure',
edit: 'Edit',
delete: 'Delete',
},
Expand All @@ -54,12 +65,19 @@ const language: LanguageOption[] = [
polygon: 'Polygon',
text: 'Text',
},
measureMode: {
none: 'No measure',
metres: 'm / m²',
kilometres: 'km / km²',
hectares: 'km / ha',
},
options: {
stroke: 'Stroke color',
},
title: {
mode: 'Mode',
drawMode: 'Drawing mode',
mode: 'Mode',
measureMode: 'Measure mode',
options: 'Draw options',
},
label: {
Expand Down
35 changes: 27 additions & 8 deletions packages/plugins/Draw/src/store/actions.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import VectorSource from 'ol/source/Vector'
import { Interaction, Select } from 'ol/interaction'
import { PolarActionTree } from '@polar/lib-custom-types'
import { DrawMode, MeasureMode, PolarActionTree } from '@polar/lib-custom-types'
import GeoJSON from 'ol/format/GeoJSON'
import { Circle, Point } from 'ol/geom'
import createDrawLayer from '../utils/createDrawLayer'
import { DrawGetters, DrawState } from '../types'
import { DrawGetters, DrawState, Mode } from '../types'
import { createTextStyle } from '../utils/createTextStyle'
import createDrawStyle from '../utils/createDrawStyle'
import createInteractions from './createInteractions'
Expand All @@ -27,7 +27,7 @@ export const makeActions = () => {
setupModule({
commit,
dispatch,
getters: { configuration },
getters: { configuration, measureOptions, selectableDrawModes },
rootGetters: { map },
}) {
dispatch('initializeConfigStyle')
Expand All @@ -38,13 +38,25 @@ export const makeActions = () => {

map.addLayer(drawLayer)
dispatch('updateInteractions')

const drawModes = Object.keys(selectableDrawModes)
if (!drawModes.includes('Point')) {
commit('setDrawMode', drawModes[0])
}
if (measureOptions.initialOption) {
commit('setMeasureMode', measureOptions.initialOption)
}
},
setMode({ commit, dispatch }, mode) {
commit('setMode', mode)
setDrawMode({ commit, dispatch }, drawMode: DrawMode) {
commit('setDrawMode', drawMode)
dispatch('updateInteractions')
},
setDrawMode({ commit, dispatch }, drawMode) {
commit('setDrawMode', drawMode)
setMeasureMode({ commit, dispatch }, measureMode: MeasureMode) {
commit('setMeasureMode', measureMode)
dispatch('updateInteractions')
},
setMode({ commit, dispatch }, mode: Mode) {
commit('setMode', mode)
dispatch('updateInteractions')
},
setTextInput(
Expand All @@ -68,7 +80,12 @@ export const makeActions = () => {
}
},
setSelectedStrokeColor(
{ commit, dispatch, getters: { configuration, selectedFeature, mode } },
{
commit,
dispatch,
getters: { configuration, measureMode, mode, selectedFeature },
rootGetters: { map },
},
selectedStrokeColor
) {
const featureStyle = selectedFeature?.getStyle()
Expand All @@ -79,6 +96,8 @@ export const makeActions = () => {
const style = createDrawStyle(
selectedFeature?.getGeometry()?.getType() || mode,
selectedStrokeColor,
measureMode,
map.getView().getProjection(),
configuration?.style
)
selectedFeature.setStyle(style)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function (
selectedFeatures.clear()
})

// @ts-expect-error | internal hack to detect it in Pins plugin
// @ts-expect-error | internal hack to detect it in other plugins
selectInteraction._isDeleteSelect = true

return [selectInteraction, dragBoxInteraction]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ export default function (
getters: {
configuration,
drawMode,
measureMode,
mode,
selectedStrokeColor,
textInput,
textSize,
selectedStrokeColor,
},
rootGetters: { map },
}: PolarActionContext<DrawState, DrawGetters>,
{ drawSource, drawLayer }: CreateInteractionsPayload
): Interaction[] | Promise<Interaction[]> {
Expand All @@ -32,6 +34,8 @@ export default function (
const style = createDrawStyle(
drawMode,
selectedStrokeColor,
measureMode,
map.getView().getProjection(),
configuration?.style
)

Expand Down
Loading
Loading