Override modify style geometry until pointermove
This commit is contained in:
@@ -158,6 +158,8 @@ const source = new VectorSource();
|
|||||||
|
|
||||||
const modify = new Modify({source: source, style: modifyStyle});
|
const modify = new Modify({source: source, style: modifyStyle});
|
||||||
|
|
||||||
|
let tipPoint;
|
||||||
|
|
||||||
function styleFunction(feature, segments, drawType, tip) {
|
function styleFunction(feature, segments, drawType, tip) {
|
||||||
const styles = [style];
|
const styles = [style];
|
||||||
const geometry = feature.getGeometry();
|
const geometry = feature.getGeometry();
|
||||||
@@ -199,6 +201,7 @@ function styleFunction(feature, segments, drawType, tip) {
|
|||||||
type === 'Point' &&
|
type === 'Point' &&
|
||||||
!modify.getOverlay().getSource().getFeatures().length
|
!modify.getOverlay().getSource().getFeatures().length
|
||||||
) {
|
) {
|
||||||
|
tipPoint = geometry;
|
||||||
tipStyle.getText().setText(tip);
|
tipStyle.getText().setText(tip);
|
||||||
styles.push(tipStyle);
|
styles.push(tipStyle);
|
||||||
}
|
}
|
||||||
@@ -247,7 +250,11 @@ function addInteraction() {
|
|||||||
tip = activeTip;
|
tip = activeTip;
|
||||||
});
|
});
|
||||||
draw.on('drawend', function () {
|
draw.on('drawend', function () {
|
||||||
|
modifyStyle.setGeometry(tipPoint);
|
||||||
modify.setActive(true);
|
modify.setActive(true);
|
||||||
|
map.once('pointermove', function () {
|
||||||
|
modifyStyle.setGeometry();
|
||||||
|
});
|
||||||
tip = idleTip;
|
tip = idleTip;
|
||||||
});
|
});
|
||||||
modify.setActive(true);
|
modify.setActive(true);
|
||||||
@@ -263,4 +270,5 @@ addInteraction();
|
|||||||
|
|
||||||
showSegments.onchange = function () {
|
showSegments.onchange = function () {
|
||||||
vector.changed();
|
vector.changed();
|
||||||
|
draw.getOverlay().changed();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user