Skip to content
Snippets Groups Projects
Commit 5f958c83 authored by vil's avatar vil
Browse files

Geolocation and clearOne more stable

parent 7aaf9b56
No related branches found
No related tags found
No related merge requests found
...@@ -139,7 +139,10 @@ app.geoLocationControl = function(opt_options) { ...@@ -139,7 +139,10 @@ app.geoLocationControl = function(opt_options) {
geolocation.setTracking(false); geolocation.setTracking(false);
geoOverlay.getSource().clear(true); geoOverlay.getSource().clear(true);
} else {*/ } else {*/
map.removeInteraction(draw);
removeMouseOver(); removeMouseOver();
$('#deleteOne').removeClass('clearOneActive');
deleteObj = false;
geolocation.setTracking(true); geolocation.setTracking(true);
//} //}
}; };
...@@ -335,13 +338,18 @@ ol.inherits(app.geoLocationControl, ol.control.Control); ...@@ -335,13 +338,18 @@ ol.inherits(app.geoLocationControl, ol.control.Control);
map.forEachFeatureAtPixel(pixel, function(feature) { map.forEachFeatureAtPixel(pixel, function(feature) {
if (deleteObj){ if (deleteObj){
featureOverlay.getSource().removeFeature(feature); if (feature){
setTimeout(function() { //wait until feature is removed //debugger;
mouseOverlay.getSource().clear(true); featureOverlay.getSource().removeFeature(feature);
}, 100); setTimeout(function() { //wait until feature is removed
mouseOverlay.getSource().clear(true);
}, 100);
}
}else { }else {
featureOverlay.getSource().addFeature(feature); if (feature.getId()){
featureOverlay.getSource().addFeature(feature);
}
} }
}); });
}; };
...@@ -434,12 +442,13 @@ ol.inherits(app.geoLocationControl, ol.control.Control); ...@@ -434,12 +442,13 @@ ol.inherits(app.geoLocationControl, ol.control.Control);
if (deleteObj){ if (deleteObj){
$('#deleteOne').addClass('clearOneActive'); $('#deleteOne').addClass('clearOneActive');
chooseFromLayer(featureOverlay); chooseFromLayer(featureOverlay);
//map.removeInteraction(modify); map.removeInteraction(modify);
//map.removeInteraction(draw); map.removeInteraction(draw);
} else { } else {
$('#deleteOne').removeClass('clearOneActive'); $('#deleteOne').removeClass('clearOneActive');
removeMouseOver(); removeMouseOver();
mouseOverlay.getSource().clear(true); mouseOverlay.getSource().clear(true);
map.addInteraction(modify);
addDrawInteraction(); addDrawInteraction();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment