Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added clickFeatureAction config to the Layer Level #2488

Merged
merged 15 commits into from
Aug 15, 2024

Conversation

alonakos
Copy link

No description provided.

@robyngit robyngit self-requested a review July 24, 2024 16:42
Copy link
Member

@robyngit robyngit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work on the click feature implementation! I see you've effectively used optional chaining (.?) and handled different scenarios well. I tested setting the clickFeatureAction to "showDetails" on the Geohash layer in the config for the map in the arctic theme locally. I just temporarily added a line around here with clickFeatureAction: "showDetails", but it didn't seem to work. When I clicked a geohash tile, the map did not zoom, but it did not show the details panel either.

I believe it's becuase we are also checking for the value of the Map's clickFeatureAction in the MapView here. We only render the feature details panel if the clickFeatureAction is set to "showDetails" at the map level! The details panel is hidden until a feature is clicked on the map, then the contents of the panel is updated and the panel is shown. Before, we were expecting that this would never happen if the map is set to "zoom", but now we can have the details panel show up if any layer in the map is set to "showDetails".

With these changes, we can render the panel either way and not check anymore what the map-level clickFeatureAction is set to. Could you please remove the check for the map-level clickFeatureAction in the MapView and test if the details panel shows up when the Geohash layer is set to "showDetails"? I'd be happy to walk through this idea and discuss it further if you'd like!

@@ -28,7 +28,7 @@ define([
* @since 2.27.0
* @extends Backbone.Model
*/
var MapInteraction = Backbone.Model.extend(
let MapInteraction = Backbone.Model.extend(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for changing from var! One day we'll get them all. In this case, since the value of MapInteraction never changes, we should use const rather than let.

Suggested change
let MapInteraction = Backbone.Model.extend(
const MapInteraction = Backbone.Model.extend(

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for noticing!

@@ -108,6 +108,9 @@ define([
* from the layer list.
* @property {boolean} [showOpacitySlider = true] Set to true to show opacity slider
* for the layer.
* @property {boolean} [clickFeatureAction = null] The action to take when a user clicks on a feature on the layer. The
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @property {boolean} [clickFeatureAction = null] The action to take when a user clicks on a feature on the layer. The
* @property {"showDetails"|"zoom"} [clickFeatureAction = null] The action to take when a user clicks on a feature on the layer. The

Comment on lines 61 to 64
* @property {string} [clickFeatureAction] - The default
* action to take when a user clicks on a feature on the layer. The
* available options are "showDetails" (show the feature details in the
* sidebar) or "zoom" (zoom to the feature's location).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was committed by accident?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed, thank you!

@robyngit robyngit linked an issue Jul 24, 2024 that may be closed by this pull request
3 tasks
@alonakos alonakos requested a review from robyngit August 3, 2024 21:35
Copy link
Member

@robyngit robyngit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonderful!! 🎉 Reviewed & tested and it all looks great. Thanks for working on this @alonakos!!

@robyngit robyngit merged commit 22b83ac into NCEAS:develop Aug 15, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add more config options for layers in the Map Config
2 participants