Make use of the Modify interaction's overlay source

This commit is contained in:
Andreas Hocevar
2020-12-06 17:02:04 +01:00
parent 44e054d528
commit 0e15720f2e
2 changed files with 5 additions and 6 deletions

View File

@@ -58,10 +58,9 @@ const modify = new Modify({
modify.on(['modifystart', 'modifyend'], function (evt) {
target.style.cursor = evt.type === 'modifystart' ? 'grabbing' : 'pointer';
});
map.on('pointermove', function (evt) {
if (!evt.dragging) {
target.style.cursor = map.hasFeatureAtPixel(evt.pixel) ? 'pointer' : '';
}
const overlaySource = modify.getOverlay().getSource();
overlaySource.on(['addfeature', 'removefeature'], function (evt) {
target.style.cursor = evt.type === 'addfeature' ? 'pointer' : '';
});
map.addInteraction(modify);