I've got one FeatureLayer with a popup in the map. I'm trying to use the SketchViewModel sample for sketching temporary geometries. How can I disable popups while the sketching is active so clicking on a feature in the FeatureLayer doesn't open the popup?
Solved! Go to Solution.
Blake,
OK, it seems that the point draw-complete is fired before the mapView hittest is returned.
Here is the fix:
sketchViewModel.on("draw-complete", function(evt) {
setTimeout(function(){
myFeatureLayer.popupEnabled = true;
},200);
Blake,
Just disable the layers popup before you start sketching using the layers popupEnabled property.
Hi Robert,
Not quite sure where would be the best place to represent "stert sketching." I added the FeatureLayer popupEnabled = false to the onclick functions of each button in that SketchViewModel example. Then I change popupEnabled back to true in the on draw-complete function. It seems to work for line and polygon but isn't working for points.
Blake,
Are you placing your code at the beginning of the onclick functions?
Yes, for example:
// *************************************
// activate the sketch to create a point
// *************************************
var drawPointButton = document.getElementById("pointButton");
drawPointButton.onclick = function() {
myFeatureLayer.popupEnabled = false;
// set the sketch to create a point geometry
sketchViewModel.create("point");
setActiveButton(this);
};
Then I set it back to true in the on draw-complete function:
sketchViewModel.on("draw-complete", function(evt) {
myFeatureLayer.popupEnabled = true;
// add the graphic to the graphics layer
tempGraphicsLayer.add(evt.graphic);
setActiveButton();
});
Blake,
OK, it seems that the point draw-complete is fired before the mapView hittest is returned.
Here is the fix:
sketchViewModel.on("draw-complete", function(evt) {
setTimeout(function(){
myFeatureLayer.popupEnabled = true;
},200);
That does it. Thanks!