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

Fix popup display while zoomed out #226

Merged
merged 4 commits into from
Feb 6, 2023

Conversation

VijayanB
Copy link
Member

@VijayanB VijayanB commented Feb 5, 2023

Description

While zoom out, maps will have multiple copies of world map. Before this fix, popup will be displayed always at first copy even if users are hovering over another copy. This will make sure that hover shows up on where pointer is hovered.

Issues Resolved

List any issues this PR will resolve, e.g. Closes [...].

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
1. remove redundant else
2. add comments

Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
@VijayanB VijayanB requested a review from a team February 5, 2023 21:02
@VijayanB VijayanB self-assigned this Feb 5, 2023
@codecov-commenter
Copy link

codecov-commenter commented Feb 5, 2023

Codecov Report

Merging #226 (c10fc28) into main (ab56667) will increase coverage by 0.34%.
The diff coverage is n/a.

❗ Current head c10fc28 differs from pull request most recent head df39954. Consider uploading reports for the commit df39954 to get more accurate results

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main     #226      +/-   ##
==========================================
+ Coverage   91.09%   91.43%   +0.34%     
==========================================
  Files           7        8       +1     
  Lines         247      257      +10     
  Branches       33       34       +1     
==========================================
+ Hits          225      235      +10     
  Misses         16       16              
  Partials        6        6              
Impacted Files Coverage Δ
...shboards-maps/public/model/map/layer_operations.ts 100.00% <0.00%> (ø)
...ugins/dashboards-maps/public/model/map/boundary.ts 100.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@VijayanB VijayanB force-pushed the refactor-code branch 2 times, most recently from b2066ad to df39954 Compare February 6, 2023 00:48

export function isTooltipEnabledLayer(
layer: MapLayerSpecification
): layer is DocumentLayerSpecification {
return (
layer.type !== 'opensearch_vector_tile_map' &&
layer.type !== 'custom_map' &&
layer.source.showTooltips === true
layer.source.showTooltips === true &&
!!layer.source.tooltipFields?.length
Copy link
Member

Choose a reason for hiding this comment

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

Will the last condition !!layer.source.tooltipFields?.length returns false if tooltipFields are not provided after enabling toolTips?

Copy link
Member Author

Choose a reason for hiding this comment

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

showTooltips is a flag where user controls whether to show toolTip or not, however, tooltipFields contains list of tooltip fields. The last condition checks whether length of tooltipFields is > 0 or not

Copy link
Member

@naveentatikonda naveentatikonda Feb 6, 2023

Choose a reason for hiding this comment

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

Yes, I got it. But, I'm trying to understand what will be the value of !!layer.source.tooltipFields?.length if no tooltipFields are provided. If it is not an optional field it's value will be false. But, what will be the value when it is optional?

Copy link
Member Author

Choose a reason for hiding this comment

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

false

naveentatikonda
naveentatikonda previously approved these changes Feb 6, 2023
Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
@VijayanB VijayanB merged commit 88bfeb9 into opensearch-project:main Feb 6, 2023
@opensearch-trigger-bot
Copy link

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-226-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 88bfeb9724f0a6f2e98be6b5ca016cb0f30c568a
# Push it to GitHub
git push --set-upstream origin backport/backport-226-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-226-to-2.x.

opensearch-trigger-bot bot pushed a commit that referenced this pull request Feb 13, 2023
* Update tool tip condition
* Clean up code

Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
(cherry picked from commit 88bfeb9)
VijayanB pushed a commit that referenced this pull request Feb 14, 2023
* Update tool tip condition
* Clean up code

Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants