BrianBunker / cmv-widgets

Widgets based on the Esri jsapi, configured for the Configurable Map Viewer. Widgets include Drag and Drop, Goto, Map Navigation Hash, and Nearby.
https://brianbunker.github.com/cmv-widgets
MIT License
18 stars 24 forks source link

Prevent Identify when Dropping a Point #10

Closed kjmueller closed 8 years ago

kjmueller commented 9 years ago

I would like to utilize this widget but when I add it to the viewer and attempt to drop a point the identify executes and seems to prevent the analysis from occurring. The buffer draws but no features are returned. Thanks in advance for any help you can provide!

BrianBunker commented 9 years ago

I assume you are talking about the Nearby widget (issues in this repo are for all the widgets listed). Be sure to configure the widget with mapClickMode: true when including it in the CMV. That option should prevent map clicks from other widgets from being executed.

kjmueller commented 9 years ago

I am referring to the Nearby widget and thanks for the response! I currently have the widget configured with mapClickMode: true but the identify widget still executes when I drop the point.

capture

darinatch commented 9 years ago

kjnueller,

I solved the issue by adding the connectMapClick and disconnectMapClick functions to the widget, and modifying the activateMapPointDrop and handleDrawEnd functions. Also, require the "dojo/topic" module.

        disconnectMapClick: function () {
            topic.publish('mapClickMode/setCurrent', 'draw');
        },       
        connectMapClick: function () {
            topic.publish('mapClickMode/setDefault');
        },

        activateMapPointDrop: function (evt) {            
            this.disconnectMapClick();
            //            this.mapClickMode.current = 'draw';
            this.clearResults();
            this.dropPointButton.set('label', 'Waiting for point drop');
            this.dropPointButton.set('disabled', true);
            this.drawTool.activate(Draw.POINT);
        },

        handleDrawEnd: function (evt) {            
            this.connectMapClick();
            //            this.mapClickMode.current = this.mapClickMode.defaultMode;
            this.droppedPoint = evt;
            this.drawTool.deactivate();
            this.showPoint(this.droppedPoint.geometry);
            this.dropPointButton.set('label', 'Change point location');
            this.dropPointButton.set('disabled', false);
            put(this.clearDropButton.domNode, '!off');

            // do the analysis
            this.doNearbyAnalysis();
        },
BrianBunker commented 9 years ago

darinatch,

Thanks for responding! I haven't had a chance to dive in to this. Your improvement would make a great addition. Would you consider doing a pull request?

darinatch commented 9 years ago

Brian, Let me read the documentation of how to create a pull request, and I will do it. :)

darinatch commented 9 years ago

Brian, I did the pull request, but I am not sure I did it right. I chose to create a new branch, and I probably should have just committed to master. It is waiting to be merged. Please, let me know if I should do anything else. Thank you!

BrianBunker commented 9 years ago

Looks like you did the pull request on your own repository. You need to choose my repository when creating the pull request.