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: Correctly parse <hotSpot> elements #1173

Merged
merged 2 commits into from
Dec 20, 2023
Merged

Conversation

SpecialMike
Copy link
Contributor

Fixes #1172

The library currently never parses <hotSpot> element in KML, because they are always empty tags. A valid <hotSpot> element should be empty, with the necessary attributes like the following:

<hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>

I also adjusted the test for parsing <hotSpot> to be a valid KML file (none of x, y, xunits, or yunits are valid attributes for <Style>), and with a valid and invalid <hotSpot> in the case of an invalid <hotSpot> the default anchor should be used.

Finally, I also added some warnings to clarify that the library only supports xunits and yunits that have the value "fraction". I would recommend that this clarification is made in the KML support table in the official developer docs. The warnings are the best way to let a user know about this, since there are other values that are part of the KML spec, and it's confusing why the <hotSpot> for a style isn't working when the units are "pixels" or "insetPixels".

In order to test with another application, I had to update the root and library build.gradle files to support Jitpack. Let me know if I should take these changes out of the PR, but the current Jitpack override in the library build.gradle does not work.

@google-cla
Copy link

google-cla bot commented Apr 10, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

build.gradle Outdated Show resolved Hide resolved
library/build.gradle Outdated Show resolved Hide resolved
@kikoso
Copy link
Collaborator

kikoso commented Dec 14, 2023

Hi @SpecialMike! I have left a couple of comments, mainly regarding your changes in the build.gradle files. We should leave those out from this PR.

Let me know if you have any questions.

@SpecialMike
Copy link
Contributor Author

Sorry, I don't think I meant to include that change, it was just me trying to get this built to work with another project for testing. I force-pushed to remove that commit.

Copy link
Collaborator

@kikoso kikoso left a comment

Choose a reason for hiding this comment

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

LGTM!

@wangela wangela merged commit 643d351 into googlemaps:main Dec 20, 2023
8 checks passed
googlemaps-bot pushed a commit that referenced this pull request Dec 20, 2023
## [3.8.1](v3.8.0...v3.8.1) (2023-12-20)

### Bug Fixes

* Correctly parse `<hotSpot>` elements ([#1173](#1173)) ([643d351](643d351))
@googlemaps-bot
Copy link
Contributor

🎉 This PR is included in version 3.8.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hotspot doesn't parse correctly
4 participants