Skip to content

Commit c84fd1e

Browse files
committed
fix vector layer detection in snap creation
1 parent 62cfb61 commit c84fd1e

File tree

1 file changed

+2
-1
lines changed
  • packages/plugins/Draw/src/store/createInteractions

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Map } from 'ol'
22
import { Snap } from 'ol/interaction'
33
import VectorLayer from 'ol/layer/Vector'
4+
import VectorSource from 'ol/source/Vector'
45

56
export const getSchnaps = (map: Map, snapIds: string[]): Snap[] =>
67
snapIds.reduce((accumulator, layerId) => {
@@ -10,7 +11,7 @@ export const getSchnaps = (map: Map, snapIds: string[]): Snap[] =>
1011
.getArray()
1112
.find((layer) => layer.get('id') === layerId) as VectorLayer
1213
)?.getSource?.()
13-
if (source) {
14+
if (source instanceof VectorSource) {
1415
accumulator.push(new Snap({ source }))
1516
} else {
1617
console.warn(

0 commit comments

Comments
 (0)