Problem with Changing Layer.visible of Google map

  • ---

    ### Google Map Layer Visibility Issue

    **Previous Version (1.19):**
    In version 1.19, there were no issues.

    **Current Version (1.21):**
    However, in version 1.21, changing the `layer.visible` property of the Google map is not working.

    **Details:**
    I am using `<layer url='googlemap.js' />` from Google Map version 1.21. I toggle between the Google map and my custom image map. When switching maps, I use `set()` to change both `layer.visible` and `layer.alpha`.

    The custom image map works fine, but after updating to version 1.21, the Google map disappears and does not display properly.

    **Problem:**
    After extensive investigation, I discovered the issue. The Google map layer's visibility is not updating correctly even though the `visible` value changes. In other words, even if the map layer's `visible` property is `true`, it does not display but still exists.

    **Solution:**
    Instead of changing both `layer.visible` and `layer.alpha`, only change `layer.alpha`. Ensure that the layer's `autoalpha` property is set to `true`.

    **Note:**
    Although I find `autoalpha` convenient, it can cause bugs, such as disappearing hotspots in krpano version 1.19. However, in version 1.21, I had to use `autoalpha` to fix the Google map layer disappearance issue.

    ---

  • Kabkee May 24, 2024 at 6:29 AM

    Changed the title of the thread from “Changing Layer.visible of Google map” to “Problem with Changing Layer.visible of Google map”.
    • Official Post

    Hi,

    I have just tried that - toggling the visible setting of a layer that contains the googlemap plugin - and it works normal.

    And I must admit it would be very strange if it wouldn't work. It's just a normal layer (internally a html div element) and changing visible, changes the css display style value, e.g. to display=none).

    So I would assume the reason for the problem is something else.
    Do you have a link to your example?

    Best regards,
    Klaus

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!