Skip to content

Commit 2222aaa

Browse files
committed
fix(selectmove): add a default style with a high zIndex to selectmove interaction
1 parent f3584b1 commit 2222aaa

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io/en/v6.4.3/build/ol.js"></script>
1515
<script src="https://unpkg.com/[email protected]/dist/mapbox-gl.js"></script>
1616
<script src="https://unpkg.com/[email protected]/dist/jsts.min.js"></script>
17-
<script src="build/index.js"></script>
17+
<script src="index.js"></script>
1818
<div id="app">
1919
<div id="header">
2020
<nav>

src/interaction/selectmove.js

+21
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
11
import Select from 'ol/interaction/Select';
2+
import { Circle, Style, Fill, Stroke } from 'ol/style';
23
import { click, shiftKeyOnly } from 'ol/events/condition';
34

5+
// Default style on moving geometries
6+
const selectMoveStyle = new Style({
7+
zIndex: 10000, // Always on top
8+
image: new Circle({
9+
radius: 5,
10+
fill: new Fill({
11+
color: '#05A0FF',
12+
}),
13+
stroke: new Stroke({ color: '#05A0FF', width: 2 }),
14+
}),
15+
stroke: new Stroke({
16+
color: '#05A0FF',
17+
width: 3,
18+
}),
19+
fill: new Fill({
20+
color: 'rgba(255,255,255,0.4)',
21+
}),
22+
});
23+
424
/**
525
* Select features for modification by a Move interaction.
626
*
@@ -18,6 +38,7 @@ class SelectMove extends Select {
1838
condition: click,
1939
toggleCondition: shiftKeyOnly,
2040
wrapX: false,
41+
style: selectMoveStyle,
2142
...options,
2243
});
2344
}

0 commit comments

Comments
 (0)