Skip to content

Commit 9170d0f

Browse files
committed
Add internal hack to @polar/plugin-draw as well to ensure pins working
Simply checking for the Draw interaction to exist leads to unexpected behaviour when using the multiSelection in circle mode.
1 parent ea992a6 commit 9170d0f

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

packages/plugins/Draw/src/store/createInteractions/createTextInteractions.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ export default function (
2525
type: 'Point',
2626
style: textStyle,
2727
})
28+
// @ts-expect-error | internal hack to detect it in @polar/plugin-pins and @polar/plugin-gfi
29+
draw._isDrawPlugin = true
2830
draw.on('drawend', function (e) {
2931
e.feature.setStyle(textStyle)
3032
e.feature.set('text', textInput)

packages/plugins/Draw/src/store/createInteractions/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ export default function (
4040
type: drawMode,
4141
style,
4242
})
43+
// @ts-expect-error | internal hack to detect it in @polar/plugin-pins and @polar/plugin-gfi
44+
draw._isDrawPlugin = true
4345
draw.on('drawend', (e) => e.feature.setStyle(style))
4446

4547
return [draw, new Snap({ source: drawSource })]

packages/plugins/Gfi/src/store/actions/setupMultiSelection.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ const isDrawing = (map: Map) =>
2424
.getArray()
2525
.some(
2626
(interaction) =>
27-
// @ts-expect-error | internal hack to detect it from @polar/plugin-gfi
28-
(interaction instanceof Draw && interaction._isMultiSelect) ||
27+
(interaction instanceof Draw &&
28+
// @ts-expect-error | internal hack to detect it from @polar/plugin-gfi and @polar/plugin-draw
29+
(interaction._isMultiSelect || interaction._isDrawPlugin)) ||
2930
interaction instanceof Modify ||
3031
// @ts-expect-error | internal hack to detect it from @polar/plugin-draw
3132
interaction._isDeleteSelect ||

packages/plugins/Pins/src/store/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ export const makeStoreModule = () => {
5353
rootGetters.map.on('singleclick', async ({ coordinate }) => {
5454
const isDrawing = interactions.getArray().some(
5555
(interaction) =>
56-
// @ts-expect-error | internal hack to detect it from @polar/plugin-gfi
57-
(interaction instanceof Draw && interaction._isMultiSelect) ||
56+
(interaction instanceof Draw &&
57+
// @ts-expect-error | internal hack to detect it from @polar/plugin-gfi and @polar/plugin-draw
58+
(interaction._isMultiSelect || interaction._isDrawPlugin)) ||
5859
interaction instanceof Modify ||
5960
// @ts-expect-error | internal hack to detect it from @polar/plugin-draw
6061
interaction._isDeleteSelect ||

0 commit comments

Comments
 (0)