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: advanced marker anchoring #577

Merged
merged 6 commits into from
Oct 24, 2024

Conversation

mrMetalWood
Copy link
Collaborator

@mrMetalWood mrMetalWood commented Oct 17, 2024

First draft for improved and more robust advanced marker anchoring. Still needs some testing...

Main change is moving away from the "0, 0" div for the anchoring reset. That seemed to cause problems in a few situations

This should address and fix:

@mrMetalWood mrMetalWood marked this pull request as ready for review October 21, 2024 13:54
Copy link
Collaborator

@usefulthink usefulthink left a comment

Choose a reason for hiding this comment

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

Looking really good!

What I would really like to have still is an overview of which elements are created, when and why, and how this all works together. Not sure if that has to be in the documentation or just somewhere in the code. We could also tackle this in a follow-up.

@@ -148,8 +148,10 @@ describe('map and marker-library loaded', () => {
.get(google.maps.marker.AdvancedMarkerElement)
.at(0) as google.maps.marker.AdvancedMarkerElement;

expect(marker.content?.firstChild).toHaveClass('classname-test');
expect(marker.content?.firstChild).toHaveStyle('width: 200px');
expect(marker.content?.firstChild?.firstChild).toHaveClass(
Copy link
Collaborator

Choose a reason for hiding this comment

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

wondering if we should replace this with something like "expect that there is an element with classname-test somewhere in marker.content" – feels like specifying the exact hierarchy here isn't actually what we want to test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, that sounds like a better approach.

@@ -31,6 +31,10 @@ export function isAdvancedMarker(
);
}

function isElementNode(node: Node): node is HTMLElement {
return (node as Node).nodeType === Node.ELEMENT_NODE;
Copy link
Collaborator

Choose a reason for hiding this comment

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

isn't as Node redundant here, since that's the type given above?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah yes, you're right.

@usefulthink usefulthink changed the title Fix/advanced marker anchoring fix: advanced marker anchoring Oct 23, 2024
@mrMetalWood
Copy link
Collaborator Author

Looking really good!

What I would really like to have still is an overview of which elements are created, when and why, and how this all works together. Not sure if that has to be in the documentation or just somewhere in the code. We could also tackle this in a follow-up.

Agreed, that would be helpful.

@mrMetalWood mrMetalWood merged commit 97a98b2 into visgl:main Oct 24, 2024
2 checks passed
@mrMetalWood mrMetalWood deleted the fix/advanced-marker-anchoring branch October 24, 2024 10:27
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.

2 participants