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

Google maps webkit svg bug #1243

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Google maps webkit svg bug #1243

wants to merge 3 commits into from

Conversation

kevbradwick
Copy link

This PR addresses the issue outlined in openlayers/openlayers#1207.

I've added a manual test that demonstrates the issue as well as a fix. However, I'm not 100% sure the fix is in the right place. The problem is solved by turning on GPU acceleration when Google Maps V3 base layer is present.

I could have put a style declaration in the default theme css but I guess not everyone will include it when using OL. So, I've put some logic in the SVG renderer. It checks for the presence of google.maps.Map and if present, adds the style declaration to turn on GPU acceleration. Part of me thinks it shouldn't be here - the render shouldn't need to know about any external global objects i.e. google, but couldn't think of a better place to put it.

@@ -450,6 +450,10 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
createRenderRoot: function() {
var svg = this.nodeFactory(this.container.id + "_svgRoot", "svg");
svg.style.display = "block";

if (window.google && window.google.maps && window.google.maps.Map) {
svg.style['-webkit-transform'] = 'translateZ(0)';
Copy link
Member

Choose a reason for hiding this comment

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

Actually I liked the pure css solution better.

.olForeignContainer svg {
    -webkit-transform: translateZ(0);
}

Especially because all GPU acceleration in OpenLayers is set in style.css too.

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