Double-click event & infoWindow

2596
3
Jump to solution
07-27-2016 11:50 AM
SteveCole
Frequent Contributor


I'm having a little trouble with the double click event and infoWindows. My featureLayer has a popup associated with it which displays when features are single clicked. I want to implement a double click to toggle between starting/stopping vertex editing. When I double click a feature, I still get the popup window even though I think I have coded to prevent it:

        theLayer.on("dbl-click", function(evt) {
            map.infoWindow.hide();
            event.stop(evt);
             //Do Something...
        });

I would imagine that the event.stop() method is only addressing the double click event and not the single click event so how do I stop the popup during a double click event?

0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

Have you tried pausing the map's click event when you are doing vertex editing? "dojo/on" has a pausable method where you can stop and start the event as needed.

View solution in original post

3 Replies
KenBuja
MVP Esteemed Contributor

Have you tried pausing the map's click event when you are doing vertex editing? "dojo/on" has a pausable method where you can stop and start the event as needed.

SteveCole
Frequent Contributor

Thanks, Ken. I haven't looked into that method before. It seemed a little confusing at first but I think I know how I might implement it. I'm using a "control key + click" event in order to bring up the attributeInspector so I'm thinking I could also just pause the click event listener at that time and then resume it when the attributeInspector is dismissed.

We'll see how that goes. Thanks for the tip!

Steve

0 Kudos
SteveCole
Frequent Contributor

I marked Ken's response as correct because, well, it is technically correct and likely a sound approach. I have decided to go a simpler route instead since I was going to need to pause/resume click events on multiple feature layers and that seemed like it was destined to be a headache.

The alternative was to add a button to my attribute inspector and serve as a toggle button. Click once to enable vertex editing and click a second time to save changes.

vertexEditingEx.jpg

        editShapeButton.on('click',function(e) {
            if(app.editingEnabled) {
                app.editToolbar.deactivate();
                app.attInspector._currentFeature._layer.applyEdits(null,[app.attInspector._currentFeature],null);
                editShapeButton.set("label","Edit Shape");
                app.editingEnabled = false;
            } else {
                app.editToolbar.activate(Edit.EDIT_VERTICES, app.attInspector._currentFeature);
                editShapeButton.set("label","Save Edits");
                app.editingEnabled = true;
            }
        });   
0 Kudos