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

Show how to combine a layer with a render function and a standard layer #15762

Merged
merged 1 commit into from Apr 25, 2024

Conversation

ahocevar
Copy link
Member

@ahocevar ahocevar commented Apr 22, 2024

See #15758. This example change should make life easier for users who want to combine standard layers with a layer with a custom render function.

Copy link

📦 Preview the website for this branch here: https://deploy-preview-15762--ol-site.netlify.app/.

@ahocevar
Copy link
Member Author

Copy link
Contributor

@MoonE MoonE left a comment

Choose a reason for hiding this comment

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

Works, just not sure what's behind the opacity change.

@@ -47,8 +52,21 @@ map.addLayer(
center[1] / svgResolution - height / 2,
);
svgContainer.style.transform = cssTransform;
svgContainer.style.opacity = this.getOpacity();
svgContainer.style.opacity = this.getOpacity() || 1;
Copy link
Contributor

@MoonE MoonE Apr 24, 2024

Choose a reason for hiding this comment

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

Why the || 1?
this.getOpacity() always returns 1 here; and what if opacity is zero?

Copy link
Member Author

@ahocevar ahocevar Apr 25, 2024

Choose a reason for hiding this comment

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

The idea was to avoid that the style ends up being the string 'undefined' if `getOpacity() returns undefined, which is not valid CSS. If it always returns 1, that's not necessary. Let me try. If it works, I'm going to remove this change.

Copy link
Member Author

Choose a reason for hiding this comment

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

You were absolutely right, @MoonE . I undid the opacity change. Thanks for the sharp eye.

@ahocevar ahocevar merged commit a8f94c4 into openlayers:main Apr 25, 2024
8 checks passed
@ahocevar ahocevar deleted the svg-layer-opacity branch April 25, 2024 09:33
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.

None yet

2 participants