cmv-app icon indicating copy to clipboard operation
cmv-app copied to clipboard

Removing infoTemplate on setMapClickMode

Open apatriz opened this issue 5 years ago • 2 comments

How often can you reproduce it?

  • [x ] Always
  • [ ] Sometimes
  • [ ] Rarely
  • [ ] Unable
  • [ ] I didn’t try

Description: When there is no defaultMapClickMode for the app and setting mapClickMode to anything other than 'identify', the Identify widget will remove the infoTemplate property from all graphicsLayers in the setMapClickMode method. This creates side-effects in widgets that may use the infoTemplate property.

Steps to reproduce:

  1. add any FeatureLayer(s) as operational layers and set infoTemplates on them
  2. set defaultMapClickMode: '' in config to remove the default 'identify' mapClickMode (i.e. left-clicking the map will NOT execute identify)
  3. left click a feature layer feature to open the infoTemplate (this is default functionality for featurelayers)
  4. publish the mapClickMode topic from another widget topic.publish('mapClickMode/setCurrent', 'draw')
  5. reset the mapClickMode to default topic.publish('mapClickMode/setDefault')
  6. left click a feature in a feature layer and no infoTemplate will be shown

Expected results:

InfoTemplates that are set on Feature Layers should always be available and not removed

Actual results: All infoTemplates are removed from all FeatureLayers on the map

Environment:

Software Version
CMV Version v 2.0.0 beta.2
Browser Chrome (latest)
Operating system Windows 10

apatriz avatar Apr 19 '19 20:04 apatriz

There may be an issue identified here when the defaultMapClickMode is set to an empty string. I suspect that isn't a common scenario - at least not one that I recall having been discussed here in the last 5+ years.

Regarding this statement,

InfoTemplates that are set on Feature Layers should always be available and not removed

If the Feature Layer infoTemplates were always available, they would interfere with widgets such as Drawing/Editing tools - The infoWindow popping up unexpectedly when attempting to draw or edit a feature is disruptive. Draw and Edit are just examples. There are many contributed tools that interact with the map in a similar fashion that would be affected by this change in behavior.

Over the years, there have been many "challenges" identified in the approach taken by Esri within the 3.x API with regards to interacting with graphics on top of the map.This includes features from a Feature layer. CMV has addressed this in a specific way that has worked for many years with few compromises in functionality. Esri revisited and improved this approach in the 4.x API and is investing close to zero time in the 3.x API. As we move forward with working with the 4.x API, I highly doubt the CMV team will be re-examining how we interact with the 3.x API.

tmcgee avatar Apr 22 '19 20:04 tmcgee

Completely agree with the 'challenges' of working with graphics in 3.x and regarding the time invested in 3.x functionality vs moving forward with 4.x.

Regarding defaultMapClickMode -- it can often lead to poor UX (at least in my client's scenario) when panning around the map and accidental left-click events will register an identify popup with no results, or generally unwanted identify popups. We decided to keep 'identify' as a right-click menu option, and leave left-click with default functionality -- setting defaultMapClickMode to empty string. Understand this may be an uncommon case.

setInfoWindowOnClick is what I use to toggle the default graphic popup behavior that might interfere in custom widgets (or Draw, Edit, Measurement, etc.).

I can see the issue with modifying all the community widgets to use the above method, but it may be possible to use that method in Identify, rather than removing the infoTemplate ? Not sure.

apatriz avatar Apr 25 '19 00:04 apatriz